@lokalise/node-api
Advanced tools
Comparing version 1.4.0 to 1.5.0-rc1
# Lokalise API Node Client Changelog | ||
## 1.5.0 | ||
* Set `noImplicitAny` and `strictNullChecks` to `true` in `tsconfig.json` | ||
* Fixed errors related to the options above | ||
## 1.4.0 (13-Nov-19) | ||
@@ -4,0 +9,0 @@ |
@@ -36,3 +36,3 @@ "use strict"; | ||
let childClass = this.constructor; | ||
let arr = new Array(); | ||
let arr = []; | ||
let jsonArray = json[childClass.rootElementName]; | ||
@@ -67,3 +67,3 @@ for (let obj of jsonArray) { | ||
exports.BaseCollection = BaseCollection; | ||
BaseCollection.rootElementName = null; | ||
BaseCollection.rootElementName = ''; | ||
BaseCollection.rootElementNameSingular = null; | ||
@@ -70,0 +70,0 @@ BaseCollection.endpoint = null; |
@@ -38,4 +38,4 @@ "use strict"; | ||
populateGroupFromJsonRoot(json) { | ||
json = json['group']; | ||
return this.populateObjectFromJson(json); | ||
const formatted_json = json['group']; | ||
return this.populateObjectFromJson(formatted_json); | ||
} | ||
@@ -42,0 +42,0 @@ } |
@@ -301,4 +301,4 @@ declare module '@lokalise/node-api' { | ||
export class ApiRequest { | ||
private urlRoot; | ||
promise: Promise<Object>; | ||
private urlRoot: string; | ||
promise: Promise<any>; | ||
params: any; | ||
@@ -316,6 +316,6 @@ constructor(uri: any, method: any, body?: any, params?: {}); | ||
protected static rootElementName: string; | ||
protected static rootElementNameSingular: string; | ||
protected static endpoint: string; | ||
protected static prefixURI: string; | ||
protected static elementClass: any; | ||
protected static rootElementNameSingular: string | null; | ||
protected static endpoint: string | null; | ||
protected static prefixURI: string | null; | ||
protected static elementClass: any | null; | ||
get(id: any, params?: StandartParams, body?: any): Promise<any>; | ||
@@ -346,5 +346,5 @@ list(params?: StandartParams): Promise<any[]>; | ||
protected static elementClass: Object; | ||
create(body, params: StandartParams): Promise<any>; | ||
update(id, body, params : StandartParams) : Promise<any>; | ||
merge(id, body, params: StandartParams) : Promise<any>; | ||
create(body: any, params: StandartParams): Promise<any>; | ||
update(id: any, body: any, params : StandartParams) : Promise<any>; | ||
merge(id: any, body: any, params: StandartParams) : Promise<any>; | ||
} | ||
@@ -399,3 +399,3 @@ | ||
create(raw_body: any, params?: StandartParams): Promise<any>; | ||
update(id, body, params: StandartParams): Promise<any>; | ||
update(id: any, body: any, params: StandartParams): Promise<any>; | ||
} | ||
@@ -428,4 +428,4 @@ | ||
protected static elementClass: Object; | ||
create(raw_body, params: StandartParams): Promise<any>; | ||
update(id, body, params : StandartParams) : Promise<any>; | ||
create(raw_body: any, params: StandartParams): Promise<any>; | ||
update(id: any, body: any, params : StandartParams) : Promise<any>; | ||
} | ||
@@ -438,4 +438,4 @@ | ||
protected static elementClass: Object; | ||
restore(id, params: StandartParams): Promise<any>; | ||
create(body, params: StandartParams): Promise<any>; | ||
restore(id: any, params: StandartParams): Promise<any>; | ||
create(body: any, params: StandartParams): Promise<any>; | ||
} | ||
@@ -449,4 +449,4 @@ | ||
create(body, params: StandartParams): Promise<any>; | ||
update(id, body, params : StandartParams) : Promise<any>; | ||
create(body: any, params: StandartParams): Promise<any>; | ||
update(id: any, body: any, params : StandartParams) : Promise<any>; | ||
} | ||
@@ -459,3 +459,3 @@ | ||
protected static elementClass: Object; | ||
update(id, body, params : StandartParams) : Promise<any>; | ||
update(id: any, body: any, params : StandartParams) : Promise<any>; | ||
} | ||
@@ -480,3 +480,3 @@ | ||
protected static elementClass: Object; | ||
update(id, body, params : StandartParams) : Promise<any>; | ||
update(id: any, body: any, params : StandartParams) : Promise<any>; | ||
} | ||
@@ -490,4 +490,4 @@ | ||
create(body, params: StandartParams): Promise<any>; | ||
update(id, body, params: StandartParams): Promise<any>; | ||
create(body: any, params: StandartParams): Promise<any>; | ||
update(id: any, body: any, params: StandartParams): Promise<any>; | ||
available_colors(params: StandartParams): Promise<any>; | ||
@@ -501,7 +501,7 @@ } | ||
create(body: any, params?: StandartParams): Promise<any>; | ||
update(id, body, params : StandartParams) : Promise<any>; | ||
add_projects_to_group(team_id, group_id, raw_body: any[], params): Promise<any>; | ||
remove_projects_from_group(team_id, group_id, raw_body: any[], params): Promise<any>; | ||
add_members_to_group(team_id, group_id, raw_body: any[], params): Promise<any>; | ||
remove_members_from_group(team_id, group_id, raw_body: any[], params): Promise<any>; | ||
update(id: any, body: any, params : StandartParams) : Promise<any>; | ||
add_projects_to_group(team_id: any, group_id: any, raw_body: any[], params: any): Promise<any>; | ||
remove_projects_from_group(team_id: any, group_id: any, raw_body: any[], params: any): Promise<any>; | ||
add_members_to_group(team_id: any, group_id: any, raw_body: any[], params: any): Promise<any>; | ||
remove_members_from_group(team_id: any, group_id: any, raw_body: any[], params: any): Promise<any>; | ||
} | ||
@@ -515,4 +515,4 @@ | ||
create(body, params: StandartParams): Promise<any>; | ||
update(id, body, params : StandartParams) : Promise<any> | ||
create(body: any, params: StandartParams): Promise<any>; | ||
update(id: any, body: any, params: StandartParams) : Promise<any> | ||
} | ||
@@ -543,4 +543,4 @@ | ||
export class LokaliseApi extends LocaliseApiMethods { | ||
static apiKey: string; | ||
private static _instance; | ||
static apiKey: string | null; | ||
private static _instance: LokaliseApi; | ||
apiKey: string; | ||
@@ -552,4 +552,4 @@ /** | ||
*/ | ||
constructor(params?: Object); | ||
constructor(params?: any); | ||
} | ||
} |
{ | ||
"name": "@lokalise/node-api", | ||
"version": "1.4.0", | ||
"version": "1.5.0-rc1", | ||
"description": "Official Lokalise API 2.0 Node.js client", | ||
@@ -26,3 +26,3 @@ "license": "MIT", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.12.7", | ||
"@types/node": "^12.12.14", | ||
"acorn": "^7.1.0", | ||
@@ -29,0 +29,0 @@ "dotenv": "^8.2.0", |
@@ -5,9 +5,9 @@ import { ApiRequest } from '../http_client/base'; | ||
export class BaseCollection { | ||
protected static rootElementName: string = null; | ||
protected static rootElementNameSingular: string = null; | ||
protected static endpoint: string = null; | ||
protected static prefixURI: string = null; | ||
protected static rootElementName: string = ''; | ||
protected static rootElementNameSingular: string | null = null; | ||
protected static endpoint: string | null = null; | ||
protected static prefixURI: string | null = null; | ||
protected static elementClass: any = null; | ||
get(id, params: StandartParams = {}, body: any = null) : Promise<any> { | ||
get(id: any, params: StandartParams = {}, body: any = null) : Promise<any> { | ||
params['id'] = id; | ||
@@ -21,7 +21,7 @@ return this.createPromise('GET', params, this.populateObjectFromJsonRoot, this.handleReject, body) | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateObjectFromJson, this.handleReject, body); | ||
} | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params: StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -31,3 +31,3 @@ return this.createPromise('PUT', params, this.populateObjectFromJson, this.handleReject, body); | ||
delete(id, params : StandartParams = {}) { | ||
delete(id: any, params: StandartParams = {}) { | ||
params['id'] = id; | ||
@@ -37,3 +37,3 @@ return this.createPromise('DELETE', params, this.returnBareJSON, this.handleReject, null); | ||
protected populateObjectFromJsonRoot(json: Object): this { | ||
protected populateObjectFromJsonRoot(json: any): this { | ||
let childClass = <typeof BaseCollection>this.constructor; | ||
@@ -53,4 +53,4 @@ if (childClass.rootElementNameSingular != null) { | ||
let childClass = <typeof BaseCollection>this.constructor; | ||
let arr: this[] = new Array(); | ||
let jsonArray = json[childClass.rootElementName]; | ||
let arr: this[] = []; | ||
let jsonArray = json[(childClass as any).rootElementName]; | ||
for (let obj of jsonArray) { | ||
@@ -66,3 +66,3 @@ arr.push(this.populateObjectFromJson(obj)); | ||
protected handleReject(data) { | ||
protected handleReject(data: any) { | ||
console.log(data); | ||
@@ -72,3 +72,3 @@ return; | ||
protected createPromise(method, params, resolveFn, rejectFn = this.handleReject, body = null, uri = null) : Promise<any> { | ||
protected createPromise(method: any, params: any, resolveFn: any, rejectFn = this.handleReject, body: any = null, uri: any = null) : Promise<any> { | ||
let childClass = <typeof BaseCollection>this.constructor; | ||
@@ -75,0 +75,0 @@ if (uri == null) { |
@@ -11,7 +11,7 @@ import { BaseCollection } from './base_collection'; | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -21,3 +21,3 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
merge(id, body = {}, params: StandartParams = {}) : Promise<any> { | ||
merge(id: any, body: any = {}, params: StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -24,0 +24,0 @@ return this.createPromise('POST', params, this.returnBareJSON, this.handleReject, |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateArrayFromJson, this.handleReject, body); | ||
@@ -14,0 +14,0 @@ } |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
create(raw_body, params: StandartParams = {}): Promise<any> { | ||
create(raw_body: any, params: StandartParams = {}): Promise<any> { | ||
const body = {'contributors': raw_body}; | ||
@@ -18,3 +18,3 @@ return this.createPromise('POST', params, this.populateArrayFromJson, this.handleReject, body, | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -21,0 +21,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
create(raw_body, params: StandartParams = {}): Promise<any> { | ||
create(raw_body: any, params: StandartParams = {}): Promise<any> { | ||
const body = {'keys': raw_body}; | ||
@@ -17,3 +17,3 @@ return this.createPromise('POST', params, this.populateArrayFromJson, this.handleReject, body); | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -20,0 +20,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -15,3 +15,3 @@ import { Language } from '../models/language'; | ||
create(raw_body, params: StandartParams = {}): Promise<any> { | ||
create(raw_body: any, params: StandartParams = {}): Promise<any> { | ||
const body = {"languages": raw_body}; | ||
@@ -21,3 +21,3 @@ return this.createPromise('POST', params, this.populateArrayFromJson, this.handleReject, body); | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -24,0 +24,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -9,3 +9,3 @@ import { Project } from '../models/project'; | ||
empty(project_id) { | ||
empty(project_id: any) { | ||
return this.createPromise('PUT', { project_id: project_id}, | ||
@@ -12,0 +12,0 @@ this.populateObjectFromJson, this.handleReject, null, 'projects/{!:project_id}/empty'); |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
create(raw_body, params: StandartParams = {}): Promise<any> { | ||
create(raw_body: any, params: StandartParams = {}): Promise<any> { | ||
const body = {"screenshots": raw_body}; | ||
@@ -17,3 +17,3 @@ return this.createPromise('POST', params, this.populateArrayFromJson, this.handleReject, body); | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -20,0 +20,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
restore(id, params: StandartParams){ | ||
restore(id: any, params: StandartParams){ | ||
params['id'] = id; | ||
@@ -17,5 +17,5 @@ return this.createPromise('POST', params, this.returnBareJSON, this.handleReject, {}); | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
} |
@@ -11,7 +11,7 @@ import { BaseCollection } from './base_collection'; | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateObjectFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -18,0 +18,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -14,0 +14,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateObjectFromJsonRoot, | ||
@@ -17,3 +17,3 @@ this.handleReject, body); | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -20,0 +20,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -14,0 +14,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -10,7 +10,7 @@ import { BaseCollection } from './base_collection'; | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateGroupFromJsonRoot, this.handleReject, body); | ||
} | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -20,3 +20,3 @@ return this.createPromise('PUT', params, this.populateGroupFromJsonRoot, this.handleReject, body); | ||
add_members_to_group(team_id, group_id, raw_body: any[], params = {}): Promise<any> { | ||
add_members_to_group(team_id: any, group_id: any, raw_body: any[], params: any = {}): Promise<any> { | ||
params['team_id'] = team_id; | ||
@@ -29,3 +29,3 @@ params['group_id'] = group_id; | ||
remove_members_from_group(team_id, group_id, raw_body: any[], params = {}): Promise<any> { | ||
remove_members_from_group(team_id: any, group_id: any, raw_body: any[], params: any = {}): Promise<any> { | ||
params['team_id'] = team_id; | ||
@@ -38,3 +38,3 @@ params['group_id'] = group_id; | ||
add_projects_to_group(team_id, group_id, raw_body: any[], params = {}): Promise<any> { | ||
add_projects_to_group(team_id: any, group_id: any, raw_body: any[], params: any = {}): Promise<any> { | ||
params['team_id'] = team_id; | ||
@@ -47,3 +47,3 @@ params['group_id'] = group_id; | ||
remove_projects_from_group(team_id, group_id, raw_body: any[], params = {}): Promise<any> { | ||
remove_projects_from_group(team_id: any, group_id: any, raw_body: any[], params: any = {}): Promise<any> { | ||
params['team_id'] = team_id; | ||
@@ -56,6 +56,6 @@ params['group_id'] = group_id; | ||
protected populateGroupFromJsonRoot(json: Object): this { | ||
json = json['group']; | ||
return this.populateObjectFromJson(json); | ||
protected populateGroupFromJsonRoot(json: any): this { | ||
const formatted_json = json['group']; | ||
return this.populateObjectFromJson(formatted_json); | ||
} | ||
} |
@@ -11,3 +11,3 @@ import { BaseCollection } from './base_collection'; | ||
create(body, params: StandartParams = {}): Promise<any> { | ||
create(body: any, params: StandartParams = {}): Promise<any> { | ||
return this.createPromise('POST', params, this.populateObjectFromJsonRoot, | ||
@@ -17,3 +17,3 @@ this.handleReject, body); | ||
update(id, body, params : StandartParams = {}) : Promise<any> { | ||
update(id: any, body: any, params : StandartParams = {}) : Promise<any> { | ||
params['id'] = id; | ||
@@ -20,0 +20,0 @@ return this.createPromise('PUT', params, this.populateObjectFromJsonRoot, this.handleReject, body); |
@@ -5,8 +5,7 @@ import request = require('request'); | ||
export class ApiRequest { | ||
private urlRoot:string = 'https://api.lokalise.co/api2/'; | ||
public promise: Promise<Object>; | ||
private urlRoot: string = 'https://api.lokalise.co/api2/'; | ||
public promise: Promise<any>; | ||
public params: any = {}; | ||
constructor(uri, method, body = null, params={}) { | ||
constructor(uri: any, method: any, body: any = null, params: any = {}) { | ||
this.params = params; | ||
@@ -17,4 +16,4 @@ this.promise = this.createPromise(uri, method, body); | ||
createPromise(uri, method, body) { | ||
let options = { | ||
createPromise(uri: any, method: any, body: any) { | ||
let options: any = { | ||
url: this.urlRoot + this.composeURI(uri), | ||
@@ -34,3 +33,3 @@ method: method, | ||
return new Promise((resolve, reject) => { | ||
request(options, (error, response, body) => { | ||
request(options, (error: any, response: any, body: any) => { | ||
if (error) { | ||
@@ -52,3 +51,3 @@ reject(error); | ||
protected composeURI(uri) { | ||
protected composeURI(uri: any) { | ||
let regexp: RegExp = /{(!{0,1}):(\w*)}/g; | ||
@@ -58,4 +57,4 @@ return uri.replace(regexp, this.mapUriParams(this.params)); | ||
protected mapUriParams(params) { | ||
return (entity, isMandaratory, paramName) => { | ||
protected mapUriParams(params: any) { | ||
return (entity: any, isMandaratory: any, paramName: any) => { | ||
if (params[paramName] != null) { | ||
@@ -76,3 +75,3 @@ let t_param = params[paramName]; | ||
constructParameters(method, params) {} | ||
constructParameters(method: any, params: any) {} | ||
} |
import { LocaliseApiMethods } from './api_methods'; | ||
export class LokaliseApi extends LocaliseApiMethods { | ||
public static apiKey: string = null; | ||
public static apiKey: string | null = null; | ||
private static _instance: LokaliseApi; | ||
@@ -14,3 +14,3 @@ | ||
*/ | ||
constructor(params: Object = {}) { | ||
constructor(params: any = {}) { | ||
super(); | ||
@@ -17,0 +17,0 @@ LokaliseApi.apiKey = params['apiKey']; |
@@ -5,5 +5,5 @@ import { ApiRequest } from '../http_client/base'; | ||
export class BaseModel { | ||
constructor(params: Object) { | ||
constructor(params: any) { | ||
for(let key of Object.keys(params)){ | ||
this[key] = params[key]; | ||
(this as any)[key] = params[key]; | ||
} | ||
@@ -10,0 +10,0 @@ return this; |
@@ -8,3 +8,5 @@ { | ||
"rootDirs": ["src", "node_modules"], | ||
"typeRoots": ["node_modules/@types"] | ||
"typeRoots": ["node_modules/@types"], | ||
"noImplicitAny": true, | ||
"strictNullChecks": true | ||
}, | ||
@@ -11,0 +13,0 @@ "files": [ |
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
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
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
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
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
770504
3625
1