@lokalise/node-api
Advanced tools
Comparing version 8.0.1 to 8.0.2
@@ -5,1 +5,2 @@ import { LokaliseApi } from "./lokalise/lokalise_api"; | ||
export { LokaliseApi, LokaliseAuth, LokaliseApiOAuth }; | ||
export * from "./interfaces"; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -10,2 +24,3 @@ exports.LokaliseApiOAuth = exports.LokaliseAuth = exports.LokaliseApi = void 0; | ||
Object.defineProperty(exports, "LokaliseAuth", { enumerable: true, get: function () { return lokalise_auth_1.LokaliseAuth; } }); | ||
__exportStar(require("./interfaces"), exports); | ||
//# sourceMappingURL=main.js.map |
import { AuthData as AuthDataInterface } from "../interfaces/auth_data"; | ||
import { RequestTokenResponse } from "../models/request_token_response"; | ||
export declare class LokaliseAuth { | ||
@@ -6,3 +7,3 @@ authData: AuthDataInterface; | ||
auth(scope: string | string[], redirect_uri?: string, state?: string): string; | ||
token(code: string): Promise<any>; | ||
token(code: string): Promise<RequestTokenResponse>; | ||
refresh(refresh_token: string): Promise<any>; | ||
@@ -9,0 +10,0 @@ private doRequest; |
# Changelog | ||
## 8.0.2 (03-Oct-2022) | ||
* Properly export common interfaces like `ApiError`, `Comment`, `File`, and so on. | ||
* Update dependencies. | ||
## 8.0.1 (01-Sep-2022) | ||
@@ -4,0 +9,0 @@ |
@@ -17,4 +17,2 @@ # Exception handling | ||
[Access to all endpoints is limited](https://app.lokalise.com/api2docs/curl/#resource-rate-limits) to 6 requests per second from 14 September, 2021. This limit is applied per API token and per IP address. If you exceed the limit, a 429 HTTP status code will be returned and the corresponding exception will be raised that you should handle properly. To handle such errors, we recommend an exponential backoff mechanism with a limited number of retries. | ||
Only one concurrent request per token is allowed. | ||
[Access to all endpoints is limited](https://app.lokalise.com/api2docs/curl/#resource-rate-limits) to 6 requests per second from 14 September, 2021. This limit is applied per API token and per IP address. If you exceed the limit, a 429 HTTP status code will be returned and the corresponding exception will be raised that you should handle properly. To handle such errors, we recommend an exponential backoff mechanism with a limited number of retries. |
{ | ||
"name": "@lokalise/node-api", | ||
"version": "8.0.1", | ||
"version": "8.0.2", | ||
"description": "Official Lokalise API 2.0 Node.js client", | ||
@@ -25,3 +25,3 @@ "license": "BSD-3-Clause", | ||
"@types/chai": "^4.2.22", | ||
"@types/mocha": "^9.0.0", | ||
"@types/mocha": "^10.0.0", | ||
"@types/node": "^18.6.1", | ||
@@ -28,0 +28,0 @@ "@typescript-eslint/eslint-plugin": "^5.4.0", |
@@ -5,1 +5,2 @@ import { LokaliseApi } from "./lokalise/lokalise_api"; | ||
export { LokaliseApi, LokaliseAuth, LokaliseApiOAuth }; | ||
export * from "./interfaces"; |
import { AuthData as AuthDataInterface } from "../interfaces/auth_data"; | ||
import { AuthRequest } from "./auth_request"; | ||
import { AuthError } from "../models/auth_error"; | ||
import { RequestTokenResponse } from "../models/request_token_response"; | ||
@@ -59,3 +60,3 @@ export class LokaliseAuth { | ||
async token(code: string): Promise<any> { | ||
async token(code: string): Promise<RequestTokenResponse> { | ||
const params = { | ||
@@ -62,0 +63,0 @@ ...this.base_params(), |
@@ -1,2 +0,2 @@ | ||
import { ApiError } from "../../src/interfaces/api_error"; | ||
import { ApiError } from "../../src/main"; | ||
@@ -3,0 +3,0 @@ require("../setup"); |
@@ -5,2 +5,3 @@ require("../setup"); | ||
import { LokaliseApi } from "../../src/lokalise/lokalise_api"; | ||
import { PaginatedResult, Comment } from "../../src/main"; | ||
@@ -16,5 +17,7 @@ describe("Comments", function () { | ||
.createTest("list_project_comments", async () => { | ||
const comments = await lokaliseApi.comments().list_project_comments({ | ||
project_id: project_id, | ||
}); | ||
const comments: PaginatedResult<Comment> = await lokaliseApi | ||
.comments() | ||
.list_project_comments({ | ||
project_id: project_id, | ||
}); | ||
@@ -21,0 +24,0 @@ expect(comments.items[0].comment_id).to.eq(comment_id); |
require("../setup"); | ||
import { expect } from "chai"; | ||
import { Cassettes } from "mocha-cassettes"; | ||
import { LokaliseAuth } from "../../src/oauth2/lokalise_auth"; | ||
import { AuthError } from "../../src/interfaces/auth_error"; | ||
import { | ||
RequestTokenResponse, | ||
RefreshTokenResponse, | ||
AuthError, | ||
LokaliseAuth, | ||
} from "../../src/main"; | ||
@@ -57,10 +61,10 @@ describe("LokaliseAuth", function () { | ||
.createTest("valid code", async () => { | ||
const resp = await lokaliseAuth.token( | ||
const resp: RequestTokenResponse = await lokaliseAuth.token( | ||
"fdf9876214cffa10c6ebbb01bd2399077ba9c49e" | ||
); | ||
expect(resp["access_token"]).to.eq("stubbed access"); | ||
expect(resp["refresh_token"]).to.eq("stubbed refresh"); | ||
expect(resp["expires_in"]).to.eq(3600); | ||
expect(resp["token_type"]).to.eq("Bearer"); | ||
expect(resp.access_token).to.eq("stubbed access"); | ||
expect(resp.refresh_token).to.eq("stubbed refresh"); | ||
expect(resp.expires_in).to.eq(3600); | ||
expect(resp.token_type).to.eq("Bearer"); | ||
}) | ||
@@ -86,8 +90,10 @@ .register(this); | ||
.createTest("valid token", async () => { | ||
const resp = await lokaliseAuth.refresh("stubbed refresh"); | ||
const resp: RefreshTokenResponse = await lokaliseAuth.refresh( | ||
"stubbed refresh" | ||
); | ||
expect(resp["access_token"]).to.eq("stubbed access"); | ||
expect(resp["scope"]).to.eq("write_team_groups read_projects"); | ||
expect(resp["expires_in"]).to.eq(3600); | ||
expect(resp["token_type"]).to.eq("Bearer"); | ||
expect(resp.access_token).to.eq("stubbed access"); | ||
expect(resp.scope).to.eq("write_team_groups read_projects"); | ||
expect(resp.expires_in).to.eq(3600); | ||
expect(resp.token_type).to.eq("Bearer"); | ||
}) | ||
@@ -94,0 +100,0 @@ .register(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1425008
675
8866