smartling-api-sdk-nodejs 2.20.0 → 2.21.1
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/.nvmrc +1 -0
- package/.scannerwork/report-task.txt +2 -2
- package/CLAUDE.md +67 -0
- 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/projects/dto/project-dto.ts +3 -9
- package/api/projects/dto/project-without-target-locales-dto.ts +13 -0
- package/api/projects/index.ts +16 -0
- package/api/projects/params/list-projects-parameters.ts +37 -0
- 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/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 +4 -0
- 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/index.d.ts +8 -0
- package/built/index.js +8 -0
- package/built/index.js.map +1 -1
- package/built/package.json +10 -7
- package/index.ts +8 -0
- package/package.json +10 -7
- package/test/access-token-provider.spec.ts +0 -1
- package/test/glossaries.spec.ts +89 -0
- package/test/projects.spec.ts +45 -0
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v18.20.8
|
|
@@ -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=AZg2oi-ALw_GP6qdp7B5
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZg2oi-ALw_GP6qdp7B5
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This is the Smartling Translation API SDK for Node.js, providing TypeScript interfaces for interacting with Smartling's translation services. The SDK covers all major API endpoints including files, jobs, locales, projects, and translation management.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
### Build Commands
|
|
12
|
+
- `npm run build` - Production build (TypeScript compilation to `built/` directory)
|
|
13
|
+
- `npm run build:dev` - Development build (includes test files)
|
|
14
|
+
|
|
15
|
+
### Testing
|
|
16
|
+
- `npm test` - Run full test suite with lint, build, and coverage
|
|
17
|
+
- `npm run test:dev` - Run tests without JUnit reporting (for development)
|
|
18
|
+
|
|
19
|
+
### Linting
|
|
20
|
+
- `npm run pretest` - Run ESLint on all TypeScript files
|
|
21
|
+
- ESLint configuration in `.eslintrc` with TypeScript, Airbnb, and custom rules
|
|
22
|
+
|
|
23
|
+
### Single Test Execution
|
|
24
|
+
Run individual test files using Mocha directly:
|
|
25
|
+
```bash
|
|
26
|
+
npm run build:dev && npx mocha built/test/[specific-test].spec.js
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Architecture
|
|
30
|
+
|
|
31
|
+
### Core Structure
|
|
32
|
+
- **API Layer**: Organized by feature domains (`/api/`)
|
|
33
|
+
- `auth/` - Authentication and token management
|
|
34
|
+
- `files/` - File upload/download operations
|
|
35
|
+
- `jobs/` - Translation job management
|
|
36
|
+
- `locales/` - Language and locale handling
|
|
37
|
+
- `projects/` - Project management
|
|
38
|
+
- `strings/` - String resource management
|
|
39
|
+
- `context/` - Context matching for translations
|
|
40
|
+
- `job-batches/` - Batch job processing
|
|
41
|
+
- `published-files/` - Published file management
|
|
42
|
+
- `file-translations/` - File translation services
|
|
43
|
+
- `mt/` - Machine translation services
|
|
44
|
+
|
|
45
|
+
### Pattern Structure
|
|
46
|
+
Each API domain follows a consistent pattern:
|
|
47
|
+
- `index.ts` - Main API client class
|
|
48
|
+
- `dto/` - Data transfer objects (response/request types)
|
|
49
|
+
- `params/` - Parameter classes for API calls
|
|
50
|
+
|
|
51
|
+
### Key Components
|
|
52
|
+
- **SmartlingApiClientBuilder**: Main entry point for creating API clients
|
|
53
|
+
- **AccessTokenProvider**: Interface for authentication (with StaticAccessTokenProvider implementation)
|
|
54
|
+
- **SmartlingListResponse**: Generic wrapper for paginated API responses
|
|
55
|
+
- **Logger**: Centralized logging utility
|
|
56
|
+
|
|
57
|
+
### TypeScript Configuration
|
|
58
|
+
- Uses `tsconfig.json` for production builds
|
|
59
|
+
- Uses `tsconfig.dev.json` for development (includes test files)
|
|
60
|
+
- Targets ES6 with CommonJS modules
|
|
61
|
+
- Generates declaration files and source maps
|
|
62
|
+
|
|
63
|
+
### Testing Framework
|
|
64
|
+
- Mocha test runner with TypeScript support
|
|
65
|
+
- Sinon for mocking and stubbing
|
|
66
|
+
- NYC for code coverage reporting
|
|
67
|
+
- Tests located in `/test/` directory matching API structure
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FallbackLocaleDto } from "./fallback-locale-dto";
|
|
2
|
+
|
|
3
|
+
export interface GlossaryDto {
|
|
4
|
+
glossaryUid: string;
|
|
5
|
+
accountUid: string;
|
|
6
|
+
glossaryName: string;
|
|
7
|
+
description: string;
|
|
8
|
+
verificationMode: boolean;
|
|
9
|
+
archived: boolean;
|
|
10
|
+
createdByUserUid: string;
|
|
11
|
+
modifiedByUserUid: string;
|
|
12
|
+
createdDate: Date;
|
|
13
|
+
modifiedDate: Date;
|
|
14
|
+
localeIds: Array<string>;
|
|
15
|
+
fallbackLocales: Array<FallbackLocaleDto>;
|
|
16
|
+
entriesCount: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
+
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
|
+
import { Logger } from "../logger";
|
|
4
|
+
import { GlossaryDto } from "./dto/glossary-dto";
|
|
5
|
+
import { SearchGlossariesParameters } from "./params/search-glossaries-parameters";
|
|
6
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
7
|
+
|
|
8
|
+
export class SmartlingGlossariesApi extends SmartlingBaseApi {
|
|
9
|
+
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger) {
|
|
10
|
+
super(logger);
|
|
11
|
+
this.authApi = authApi;
|
|
12
|
+
this.entrypoint = `${smartlingApiBaseUrl}/glossary-api/v3`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async searchGlossaries(
|
|
16
|
+
accountUid: string,
|
|
17
|
+
parameters: SearchGlossariesParameters
|
|
18
|
+
): Promise<SmartlingListResponse<GlossaryDto>> {
|
|
19
|
+
return await this.makeRequest(
|
|
20
|
+
"post",
|
|
21
|
+
`${this.entrypoint}/accounts/${accountUid}/glossaries/search`,
|
|
22
|
+
JSON.stringify(parameters.export())
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async getGlossary(accountUid: string, glossaryUid: string): Promise<GlossaryDto> {
|
|
27
|
+
return await this.makeRequest(
|
|
28
|
+
"get",
|
|
29
|
+
`${this.entrypoint}/accounts/${accountUid}/glossaries/${glossaryUid}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
import { PaginationDto } from "../dto/pagination-dto";
|
|
3
|
+
import { SortingDto } from "../dto/sorting-dto";
|
|
4
|
+
|
|
5
|
+
export class SearchGlossariesParameters extends BaseParameters {
|
|
6
|
+
setQuery(query: string): SearchGlossariesParameters {
|
|
7
|
+
this.set("query", query);
|
|
8
|
+
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setGlossaryState(glossaryState: "ACTIVE" | "ARCHIVED" | "BOTH"): SearchGlossariesParameters {
|
|
13
|
+
this.set("glossaryState", glossaryState);
|
|
14
|
+
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setTargetLocaleId(targetLocaleId: string): SearchGlossariesParameters {
|
|
19
|
+
this.set("targetLocaleId", targetLocaleId);
|
|
20
|
+
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
setGlossaryUids(glossaryUids: Array<string>): SearchGlossariesParameters {
|
|
25
|
+
this.set("glossaryUids", glossaryUids);
|
|
26
|
+
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setPaging(paging: PaginationDto): SearchGlossariesParameters {
|
|
31
|
+
this.set("paging", paging);
|
|
32
|
+
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setSorting(sorting: SortingDto): SearchGlossariesParameters {
|
|
37
|
+
this.set("sorting", sorting);
|
|
38
|
+
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setIncludeEntriesCount(includeEntriesCount: boolean): SearchGlossariesParameters {
|
|
43
|
+
this.set("includeEntriesCount", includeEntriesCount);
|
|
44
|
+
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { LocaleDto } from "./locale-dto";
|
|
2
|
+
import { ProjectWithoutTargetLocalesDto } from "./project-without-target-locales-dto";
|
|
2
3
|
|
|
3
|
-
interface ProjectDto {
|
|
4
|
-
|
|
5
|
-
archived: boolean;
|
|
6
|
-
projectId: string;
|
|
7
|
-
projectName: string;
|
|
8
|
-
projectTypeCode: string;
|
|
9
|
-
sourceLocaleDescription: string;
|
|
10
|
-
sourceLocaleId: string;
|
|
11
|
-
targetLocales: Array<LocaleDto>
|
|
4
|
+
interface ProjectDto extends ProjectWithoutTargetLocalesDto {
|
|
5
|
+
targetLocales: Array<LocaleDto>;
|
|
12
6
|
}
|
|
13
7
|
|
|
14
8
|
export { ProjectDto };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ProjectWithoutTargetLocalesDto {
|
|
2
|
+
accountUid: string;
|
|
3
|
+
archived: boolean;
|
|
4
|
+
projectId: string;
|
|
5
|
+
projectName: string;
|
|
6
|
+
projectTypeCode: string;
|
|
7
|
+
sourceLocaleDescription: string;
|
|
8
|
+
sourceLocaleId: string;
|
|
9
|
+
projectTypeDisplayValue: string;
|
|
10
|
+
packageUid: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { ProjectWithoutTargetLocalesDto };
|
package/api/projects/index.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { SmartlingBaseApi } from "../base/index";
|
|
|
2
2
|
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
3
|
import { Logger } from "../logger";
|
|
4
4
|
import { ProjectDto } from "./dto/project-dto";
|
|
5
|
+
import { ListProjectsParameters } from "./params/list-projects-parameters";
|
|
6
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
7
|
+
import { ProjectWithoutTargetLocalesDto } from "./dto/project-without-target-locales-dto";
|
|
5
8
|
|
|
6
9
|
export class SmartlingProjectsApi extends SmartlingBaseApi {
|
|
7
10
|
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger) {
|
|
@@ -16,4 +19,17 @@ export class SmartlingProjectsApi extends SmartlingBaseApi {
|
|
|
16
19
|
`${this.entrypoint}/${projectId}`
|
|
17
20
|
);
|
|
18
21
|
}
|
|
22
|
+
|
|
23
|
+
async listProjects(
|
|
24
|
+
accountUid: string,
|
|
25
|
+
parameters?: ListProjectsParameters
|
|
26
|
+
): Promise<SmartlingListResponse<ProjectWithoutTargetLocalesDto>> {
|
|
27
|
+
const accountsEndpoint = this.entrypoint.replace("/projects-api/v2/projects", `/accounts-api/v2/accounts/${accountUid}/projects`);
|
|
28
|
+
|
|
29
|
+
return await this.makeRequest(
|
|
30
|
+
"get",
|
|
31
|
+
accountsEndpoint,
|
|
32
|
+
parameters ? parameters.export() : undefined
|
|
33
|
+
);
|
|
34
|
+
}
|
|
19
35
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
|
|
3
|
+
export class ListProjectsParameters extends BaseParameters {
|
|
4
|
+
setProjectNameFilter(projectNameFilter: string): ListProjectsParameters {
|
|
5
|
+
this.set("projectNameFilter", projectNameFilter);
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setIncludeArchived(includeArchived: boolean): ListProjectsParameters {
|
|
10
|
+
this.set("includeArchived", includeArchived);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setOffset(offset: number): ListProjectsParameters {
|
|
15
|
+
if (offset >= 0) {
|
|
16
|
+
this.set("offset", offset);
|
|
17
|
+
}
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setLimit(limit: number): ListProjectsParameters {
|
|
22
|
+
if (limit > 0) {
|
|
23
|
+
this.set("limit", limit);
|
|
24
|
+
}
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setProjectTypeCode(projectTypeCode: string): ListProjectsParameters {
|
|
29
|
+
this.set("projectTypeCode", projectTypeCode);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setProjectTypeCodes(projectTypeCodes: Array<string>): ListProjectsParameters {
|
|
34
|
+
this.set("projectTypeCodes", projectTypeCodes);
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback-locale-dto.js","sourceRoot":"","sources":["../../../../api/glossaries/dto/fallback-locale-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FallbackLocaleDto } from "./fallback-locale-dto";
|
|
2
|
+
export interface GlossaryDto {
|
|
3
|
+
glossaryUid: string;
|
|
4
|
+
accountUid: string;
|
|
5
|
+
glossaryName: string;
|
|
6
|
+
description: string;
|
|
7
|
+
verificationMode: boolean;
|
|
8
|
+
archived: boolean;
|
|
9
|
+
createdByUserUid: string;
|
|
10
|
+
modifiedByUserUid: string;
|
|
11
|
+
createdDate: Date;
|
|
12
|
+
modifiedDate: Date;
|
|
13
|
+
localeIds: Array<string>;
|
|
14
|
+
fallbackLocales: Array<FallbackLocaleDto>;
|
|
15
|
+
entriesCount: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glossary-dto.js","sourceRoot":"","sources":["../../../../api/glossaries/dto/glossary-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-dto.js","sourceRoot":"","sources":["../../../../api/glossaries/dto/pagination-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorting-dto.js","sourceRoot":"","sources":["../../../../api/glossaries/dto/sorting-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
+
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
|
+
import { Logger } from "../logger";
|
|
4
|
+
import { GlossaryDto } from "./dto/glossary-dto";
|
|
5
|
+
import { SearchGlossariesParameters } from "./params/search-glossaries-parameters";
|
|
6
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
7
|
+
export declare class SmartlingGlossariesApi extends SmartlingBaseApi {
|
|
8
|
+
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
|
|
9
|
+
searchGlossaries(accountUid: string, parameters: SearchGlossariesParameters): Promise<SmartlingListResponse<GlossaryDto>>;
|
|
10
|
+
getGlossary(accountUid: string, glossaryUid: string): Promise<GlossaryDto>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.SmartlingGlossariesApi = void 0;
|
|
13
|
+
const index_1 = require("../base/index");
|
|
14
|
+
class SmartlingGlossariesApi extends index_1.SmartlingBaseApi {
|
|
15
|
+
constructor(smartlingApiBaseUrl, authApi, logger) {
|
|
16
|
+
super(logger);
|
|
17
|
+
this.authApi = authApi;
|
|
18
|
+
this.entrypoint = `${smartlingApiBaseUrl}/glossary-api/v3`;
|
|
19
|
+
}
|
|
20
|
+
searchGlossaries(accountUid, parameters) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return yield this.makeRequest("post", `${this.entrypoint}/accounts/${accountUid}/glossaries/search`, JSON.stringify(parameters.export()));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
getGlossary(accountUid, glossaryUid) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return yield this.makeRequest("get", `${this.entrypoint}/accounts/${accountUid}/glossaries/${glossaryUid}`);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.SmartlingGlossariesApi = SmartlingGlossariesApi;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/glossaries/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAOjD,MAAa,sBAAuB,SAAQ,wBAAgB;IACxD,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,kBAAkB,CAAC;IAC/D,CAAC;IAEK,gBAAgB,CAClB,UAAkB,EAClB,UAAsC;;YAEtC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,aAAa,UAAU,oBAAoB,EAC7D,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CACtC,CAAC;QACN,CAAC;KAAA;IAEK,WAAW,CAAC,UAAkB,EAAE,WAAmB;;YACrD,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,aAAa,UAAU,eAAe,WAAW,EAAE,CACxE,CAAC;QACN,CAAC;KAAA;CACJ;AAxBD,wDAwBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
import { PaginationDto } from "../dto/pagination-dto";
|
|
3
|
+
import { SortingDto } from "../dto/sorting-dto";
|
|
4
|
+
export declare class SearchGlossariesParameters extends BaseParameters {
|
|
5
|
+
setQuery(query: string): SearchGlossariesParameters;
|
|
6
|
+
setGlossaryState(glossaryState: "ACTIVE" | "ARCHIVED" | "BOTH"): SearchGlossariesParameters;
|
|
7
|
+
setTargetLocaleId(targetLocaleId: string): SearchGlossariesParameters;
|
|
8
|
+
setGlossaryUids(glossaryUids: Array<string>): SearchGlossariesParameters;
|
|
9
|
+
setPaging(paging: PaginationDto): SearchGlossariesParameters;
|
|
10
|
+
setSorting(sorting: SortingDto): SearchGlossariesParameters;
|
|
11
|
+
setIncludeEntriesCount(includeEntriesCount: boolean): SearchGlossariesParameters;
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchGlossariesParameters = void 0;
|
|
4
|
+
const index_1 = require("../../parameters/index");
|
|
5
|
+
class SearchGlossariesParameters extends index_1.BaseParameters {
|
|
6
|
+
setQuery(query) {
|
|
7
|
+
this.set("query", query);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
setGlossaryState(glossaryState) {
|
|
11
|
+
this.set("glossaryState", glossaryState);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
setTargetLocaleId(targetLocaleId) {
|
|
15
|
+
this.set("targetLocaleId", targetLocaleId);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
setGlossaryUids(glossaryUids) {
|
|
19
|
+
this.set("glossaryUids", glossaryUids);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
setPaging(paging) {
|
|
23
|
+
this.set("paging", paging);
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
setSorting(sorting) {
|
|
27
|
+
this.set("sorting", sorting);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
setIncludeEntriesCount(includeEntriesCount) {
|
|
31
|
+
this.set("includeEntriesCount", includeEntriesCount);
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.SearchGlossariesParameters = SearchGlossariesParameters;
|
|
36
|
+
//# sourceMappingURL=search-glossaries-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-glossaries-parameters.js","sourceRoot":"","sources":["../../../../api/glossaries/params/search-glossaries-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAIxD,MAAa,0BAA2B,SAAQ,sBAAc;IAC1D,QAAQ,CAAC,KAAa;QAClB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gBAAgB,CAAC,aAA6C;QAC1D,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,iBAAiB,CAAC,cAAsB;QACpC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAE3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,eAAe,CAAC,YAA2B;QACvC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,MAAqB;QAC3B,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,OAAmB;QAC1B,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,sBAAsB,CAAC,mBAA4B;QAC/C,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QAErD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA1CD,gEA0CC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { LocaleDto } from "./locale-dto";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
archived: boolean;
|
|
5
|
-
projectId: string;
|
|
6
|
-
projectName: string;
|
|
7
|
-
projectTypeCode: string;
|
|
8
|
-
sourceLocaleDescription: string;
|
|
9
|
-
sourceLocaleId: string;
|
|
2
|
+
import { ProjectWithoutTargetLocalesDto } from "./project-without-target-locales-dto";
|
|
3
|
+
interface ProjectDto extends ProjectWithoutTargetLocalesDto {
|
|
10
4
|
targetLocales: Array<LocaleDto>;
|
|
11
5
|
}
|
|
12
6
|
export { ProjectDto };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface ProjectWithoutTargetLocalesDto {
|
|
2
|
+
accountUid: string;
|
|
3
|
+
archived: boolean;
|
|
4
|
+
projectId: string;
|
|
5
|
+
projectName: string;
|
|
6
|
+
projectTypeCode: string;
|
|
7
|
+
sourceLocaleDescription: string;
|
|
8
|
+
sourceLocaleId: string;
|
|
9
|
+
projectTypeDisplayValue: string;
|
|
10
|
+
packageUid: string;
|
|
11
|
+
}
|
|
12
|
+
export { ProjectWithoutTargetLocalesDto };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-without-target-locales-dto.js","sourceRoot":"","sources":["../../../../api/projects/dto/project-without-target-locales-dto.ts"],"names":[],"mappings":""}
|
|
@@ -2,7 +2,11 @@ import { SmartlingBaseApi } from "../base/index";
|
|
|
2
2
|
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
3
|
import { Logger } from "../logger";
|
|
4
4
|
import { ProjectDto } from "./dto/project-dto";
|
|
5
|
+
import { ListProjectsParameters } from "./params/list-projects-parameters";
|
|
6
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
7
|
+
import { ProjectWithoutTargetLocalesDto } from "./dto/project-without-target-locales-dto";
|
|
5
8
|
export declare class SmartlingProjectsApi extends SmartlingBaseApi {
|
|
6
9
|
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
|
|
7
10
|
getProjectDetails(projectId: string): Promise<ProjectDto>;
|
|
11
|
+
listProjects(accountUid: string, parameters?: ListProjectsParameters): Promise<SmartlingListResponse<ProjectWithoutTargetLocalesDto>>;
|
|
8
12
|
}
|
|
@@ -22,6 +22,12 @@ class SmartlingProjectsApi extends index_1.SmartlingBaseApi {
|
|
|
22
22
|
return yield this.makeRequest("get", `${this.entrypoint}/${projectId}`);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
listProjects(accountUid, parameters) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const accountsEndpoint = this.entrypoint.replace("/projects-api/v2/projects", `/accounts-api/v2/accounts/${accountUid}/projects`);
|
|
28
|
+
return yield this.makeRequest("get", accountsEndpoint, parameters ? parameters.export() : undefined);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
32
|
exports.SmartlingProjectsApi = SmartlingProjectsApi;
|
|
27
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/projects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/projects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAQjD,MAAa,oBAAqB,SAAQ,wBAAgB;IACtD,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,2BAA2B,CAAC;IACxE,CAAC;IAEK,iBAAiB,CAAC,SAAiB;;YACrC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,EAAE,CACpC,CAAC;QACN,CAAC;KAAA;IAEK,YAAY,CACd,UAAkB,EAClB,UAAmC;;YAEnC,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,2BAA2B,EAAE,6BAA6B,UAAU,WAAW,CAAC,CAAC;YAElI,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,gBAAgB,EAChB,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAC/C,CAAC;QACN,CAAC;KAAA;CACJ;AA1BD,oDA0BC"}
|
|
@@ -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"}
|
package/built/index.d.ts
CHANGED
|
@@ -43,6 +43,12 @@ export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
|
43
43
|
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
|
44
44
|
export * from "./api/files/dto/last-modified-for-locale-dto";
|
|
45
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";
|
|
46
52
|
export * from "./api/http/smartling-list-response";
|
|
47
53
|
export * from "./api/job-batches/index";
|
|
48
54
|
export * from "./api/job-batches/dto/batch-dto";
|
|
@@ -93,7 +99,9 @@ export * from "./api/parameters/index";
|
|
|
93
99
|
export * from "./api/parameters/order";
|
|
94
100
|
export * from "./api/projects/index";
|
|
95
101
|
export * from "./api/projects/dto/project-dto";
|
|
102
|
+
export * from "./api/projects/dto/project-without-target-locales-dto";
|
|
96
103
|
export * from "./api/projects/dto/locale-dto";
|
|
104
|
+
export * from "./api/projects/params/list-projects-parameters";
|
|
97
105
|
export * from "./api/published-files/index";
|
|
98
106
|
export * from "./api/published-files/dto/published-file-dto";
|
|
99
107
|
export * from "./api/published-files/params/recently-published-files-parameters";
|
package/built/index.js
CHANGED
|
@@ -59,6 +59,12 @@ __exportStar(require("./api/files/dto/file-status-for-all-locales-dto"), exports
|
|
|
59
59
|
__exportStar(require("./api/files/dto/file-status-for-locale-item-dto"), exports);
|
|
60
60
|
__exportStar(require("./api/files/dto/last-modified-for-locale-dto"), exports);
|
|
61
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);
|
|
62
68
|
__exportStar(require("./api/http/smartling-list-response"), exports);
|
|
63
69
|
__exportStar(require("./api/job-batches/index"), exports);
|
|
64
70
|
__exportStar(require("./api/job-batches/dto/batch-dto"), exports);
|
|
@@ -109,7 +115,9 @@ __exportStar(require("./api/parameters/index"), exports);
|
|
|
109
115
|
__exportStar(require("./api/parameters/order"), exports);
|
|
110
116
|
__exportStar(require("./api/projects/index"), exports);
|
|
111
117
|
__exportStar(require("./api/projects/dto/project-dto"), exports);
|
|
118
|
+
__exportStar(require("./api/projects/dto/project-without-target-locales-dto"), exports);
|
|
112
119
|
__exportStar(require("./api/projects/dto/locale-dto"), exports);
|
|
120
|
+
__exportStar(require("./api/projects/params/list-projects-parameters"), exports);
|
|
113
121
|
__exportStar(require("./api/published-files/index"), exports);
|
|
114
122
|
__exportStar(require("./api/published-files/dto/published-file-dto"), exports);
|
|
115
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,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,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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartling-api-sdk-nodejs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.1",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -32,17 +32,18 @@
|
|
|
32
32
|
"@types/mocha": "^9.0.0",
|
|
33
33
|
"cross-fetch": "^3.1.4",
|
|
34
34
|
"default-user-agent": "^1.0.0",
|
|
35
|
-
"form-data": "^4.0.
|
|
35
|
+
"form-data": "^4.0.4",
|
|
36
36
|
"merge-deep": "^3.0.3",
|
|
37
37
|
"querystring": "^0.2.1",
|
|
38
38
|
"string-to-file-stream": "^2.0.0",
|
|
39
|
-
"typescript": "^4.3.5"
|
|
39
|
+
"typescript": "^4.3.5",
|
|
40
|
+
"semver": "^5.7.2"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
43
44
|
"@typescript-eslint/parser": "^4.29.0",
|
|
44
45
|
"ansi-regex": "^5.0.1",
|
|
45
|
-
"babel-eslint": "^
|
|
46
|
+
"babel-eslint": "^10.1.0",
|
|
46
47
|
"eslint": "^7.31.0",
|
|
47
48
|
"eslint-config-airbnb": "^16.1.0",
|
|
48
49
|
"eslint-plugin-flowtype": "^2.41.0",
|
|
@@ -51,11 +52,13 @@
|
|
|
51
52
|
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
52
53
|
"eslint-plugin-promise": "^3.6.0",
|
|
53
54
|
"eslint-plugin-react": "^7.10.0",
|
|
54
|
-
"mocha": "^
|
|
55
|
+
"mocha": "^10.0.0",
|
|
55
56
|
"mocha-junit-reporter": "^2.0.2",
|
|
56
|
-
"nyc": "^
|
|
57
|
+
"nyc": "^17.1.0",
|
|
57
58
|
"sinon": "^11.1.2",
|
|
58
|
-
"ts-mocha": "^10.0.0"
|
|
59
|
+
"ts-mocha": "^10.0.0",
|
|
60
|
+
"braces": "^3.0.3",
|
|
61
|
+
"json5": "^1.0.2"
|
|
59
62
|
},
|
|
60
63
|
"nyc": {
|
|
61
64
|
"reporter": [
|
package/index.ts
CHANGED
|
@@ -43,6 +43,12 @@ export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
|
43
43
|
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
|
44
44
|
export * from "./api/files/dto/last-modified-for-locale-dto";
|
|
45
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";
|
|
46
52
|
export * from "./api/http/smartling-list-response";
|
|
47
53
|
export * from "./api/job-batches/index";
|
|
48
54
|
export * from "./api/job-batches/dto/batch-dto";
|
|
@@ -93,7 +99,9 @@ export * from "./api/parameters/index";
|
|
|
93
99
|
export * from "./api/parameters/order";
|
|
94
100
|
export * from "./api/projects/index";
|
|
95
101
|
export * from "./api/projects/dto/project-dto";
|
|
102
|
+
export * from "./api/projects/dto/project-without-target-locales-dto";
|
|
96
103
|
export * from "./api/projects/dto/locale-dto";
|
|
104
|
+
export * from "./api/projects/params/list-projects-parameters";
|
|
97
105
|
export * from "./api/published-files/index";
|
|
98
106
|
export * from "./api/published-files/dto/published-file-dto";
|
|
99
107
|
export * from "./api/published-files/params/recently-published-files-parameters";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartling-api-sdk-nodejs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.1",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -32,17 +32,18 @@
|
|
|
32
32
|
"@types/mocha": "^9.0.0",
|
|
33
33
|
"cross-fetch": "^3.1.4",
|
|
34
34
|
"default-user-agent": "^1.0.0",
|
|
35
|
-
"form-data": "^4.0.
|
|
35
|
+
"form-data": "^4.0.4",
|
|
36
36
|
"merge-deep": "^3.0.3",
|
|
37
37
|
"querystring": "^0.2.1",
|
|
38
38
|
"string-to-file-stream": "^2.0.0",
|
|
39
|
-
"typescript": "^4.3.5"
|
|
39
|
+
"typescript": "^4.3.5",
|
|
40
|
+
"semver": "^5.7.2"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
43
44
|
"@typescript-eslint/parser": "^4.29.0",
|
|
44
45
|
"ansi-regex": "^5.0.1",
|
|
45
|
-
"babel-eslint": "^
|
|
46
|
+
"babel-eslint": "^10.1.0",
|
|
46
47
|
"eslint": "^7.31.0",
|
|
47
48
|
"eslint-config-airbnb": "^16.1.0",
|
|
48
49
|
"eslint-plugin-flowtype": "^2.41.0",
|
|
@@ -51,11 +52,13 @@
|
|
|
51
52
|
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
52
53
|
"eslint-plugin-promise": "^3.6.0",
|
|
53
54
|
"eslint-plugin-react": "^7.10.0",
|
|
54
|
-
"mocha": "^
|
|
55
|
+
"mocha": "^10.0.0",
|
|
55
56
|
"mocha-junit-reporter": "^2.0.2",
|
|
56
|
-
"nyc": "^
|
|
57
|
+
"nyc": "^17.1.0",
|
|
57
58
|
"sinon": "^11.1.2",
|
|
58
|
-
"ts-mocha": "^10.0.0"
|
|
59
|
+
"ts-mocha": "^10.0.0",
|
|
60
|
+
"braces": "^3.0.3",
|
|
61
|
+
"json5": "^1.0.2"
|
|
59
62
|
},
|
|
60
63
|
"nyc": {
|
|
61
64
|
"reporter": [
|
|
@@ -6,7 +6,6 @@ describe("AccessTokenProvider", () => {
|
|
|
6
6
|
|
|
7
7
|
it("should return the static token and token type", async () => {
|
|
8
8
|
const provider = new StaticAccessTokenProvider(staticToken, "Bearer");
|
|
9
|
-
const response = await provider.getAccessToken();
|
|
10
9
|
|
|
11
10
|
assert.strictEqual(await provider.getAccessToken(), staticToken);
|
|
12
11
|
assert.strictEqual(await provider.getTokenType(), "Bearer");
|
|
@@ -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
|
});
|