Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions backendless.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
declare module __Backendless {
import Backendless = __Backendless;

var debugMode:boolean;
var serverURL:string;
var applicationId:string;
var secretKey:string;
Expand All @@ -19,7 +20,7 @@ declare module __Backendless {
/**
* @dictionary
*/
var PublishOptionsHeaders:{ [key: string]: string; };
var PublishOptionsHeaders:{ [key:string]:string; };


/**
Expand Down Expand Up @@ -105,7 +106,7 @@ declare module __Backendless {
* @constructor
*/
class Async {
constructor(onSuccess?:(data?:Object) => void, onError?:((data:Object) => void) | Object, context?:Object);
constructor(onSuccess?:(data?:Object) => void, onError?:((data:Object) => void)|Object, context?:Object);

success(data:Object):void;

Expand Down Expand Up @@ -224,7 +225,7 @@ declare module __Backendless {
*/
class GeoCluster extends Backendless.GeoPoint {
totalPoints:number;
geoQuery:Backendless.GeoQuery | Backendless.RectangleGeoQueryI | Backendless.CircleGeoQueryI;
geoQuery:Backendless.GeoQuery|Backendless.RectangleGeoQueryI|Backendless.CircleGeoQueryI;
}

/**
Expand Down Expand Up @@ -322,7 +323,7 @@ declare module __Backendless {
class Proxy {
eventHandlers:Object;

on(eventName:string, handler:(data:any)=>any):void;
on(eventName:string, handler:(data:any) => any):void;

fireEvent(eventName:string, data:any):void;
}
Expand Down Expand Up @@ -830,23 +831,23 @@ declare module __Backendless {
}

interface PersistencePermissionI {
grantUserSync(userId: string, dataItem: Backendless.ExistDataItemI): Backendless.ExistDataItemI;
grantUser(userId: string, dataItem: ExistDataItemI): Promise<Backendless.ExistDataItemI>;
grantUserSync(userId:string, dataItem:Backendless.ExistDataItemI):Backendless.ExistDataItemI;
grantUser(userId:string, dataItem:ExistDataItemI):Promise<Backendless.ExistDataItemI>;

grantRoleSync(roleName: string, dataItem: Backendless.ExistDataItemI): Backendless.ExistDataItemI;
grantRole(roleName: string, dataItem: Backendless.ExistDataItemI): Promise<Backendless.ExistDataItemI>;
grantRoleSync(roleName:string, dataItem:Backendless.ExistDataItemI):Backendless.ExistDataItemI;
grantRole(roleName:string, dataItem:Backendless.ExistDataItemI):Promise<Backendless.ExistDataItemI>;

grantSync(dataItem: Backendless.ExistDataItemI): Backendless.ExistDataItemI;
grant(dataItem: Backendless.ExistDataItemI): Promise<Backendless.ExistDataItemI>;
grantSync(dataItem:Backendless.ExistDataItemI):Backendless.ExistDataItemI;
grant(dataItem:Backendless.ExistDataItemI):Promise<Backendless.ExistDataItemI>;

denyUserSync(userId: string, dataItem: Backendless.ExistDataItemI): Backendless.ExistDataItemI;
denyUser(userId: string, dataItem: Backendless.ExistDataItemI): Promise<Backendless.ExistDataItemI>;
denyUserSync(userId:string, dataItem:Backendless.ExistDataItemI):Backendless.ExistDataItemI;
denyUser(userId:string, dataItem:Backendless.ExistDataItemI):Promise<Backendless.ExistDataItemI>;

denyRoleSync(roleName: string, dataItem: Backendless.ExistDataItemI): Backendless.ExistDataItemI;
denyRole(roleName: string, dataItem: Backendless.ExistDataItemI): Promise<Backendless.ExistDataItemI>;
denyRoleSync(roleName:string, dataItem:Backendless.ExistDataItemI):Backendless.ExistDataItemI;
denyRole(roleName:string, dataItem:Backendless.ExistDataItemI):Promise<Backendless.ExistDataItemI>;

denySync(dataItem: Backendless.ExistDataItemI): Backendless.ExistDataItemI;
deny(dataItem: Backendless.ExistDataItemI): Promise<Backendless.ExistDataItemI>;
denySync(dataItem:Backendless.ExistDataItemI):Backendless.ExistDataItemI;
deny(dataItem:Backendless.ExistDataItemI):Promise<Backendless.ExistDataItemI>;
}

interface FilePermissionI {
Expand Down Expand Up @@ -927,6 +928,7 @@ declare module __Backendless {
subscriptionId:string;
restUrl:string;
proxy:Proxy;

cancelSubscription():void;
}

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"copyfiles": "^1.1.0",
"cross-env": "^5.0.5",
"cross-env": "^5.1.0",
"eslint": "^3.12.2",
"karma": "^1.3.0",
"karma": "^1.7.1",
"karma-babel-preprocessor": "^6.0.1",
"karma-browserify": "^5.1.0",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"mocha": "^3.2.0",
"rimraf": "^2.5.4",
"typescript": "^2.0.3",
"uglify-js": "^3.0.15",
"rimraf": "^2.6.2",
"typescript": "^2.5.3",
"uglify-js": "^3.1.4",
"watch": "^1.0.2",
"watchify": "^3.8.0",
"webpack": "^3.5.5"
"webpack": "^3.8.1"
},
"dependencies": {
"backendless-request": "^0.0.9"
"backendless-request": "^0.0.10"
}
}
2 changes: 1 addition & 1 deletion src/cache/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function put(key, value, timeToLive, asyncHandler) {
timeToLive = undefined
}

if (timeToLive && !Utils.isNumber(key)) {
if (timeToLive && !Utils.isNumber(timeToLive)) {
throw new Error('Cache timeToLive must be Number')
}

Expand Down
2 changes: 1 addition & 1 deletion src/data/store/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function getObjectCount(condition, asyncHandler) {
}

if (condition instanceof DataQueryBuilder) {
condition = condition.build().condition
condition = condition.build().condition || undefined
}

return Request.get({
Expand Down
4 changes: 4 additions & 0 deletions src/request/request-for-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const sendRequest = config => {
} else {
const contentType = config.data ? 'application/json' : 'application/x-www-form-urlencoded'

if (contentType === 'application/json' && config.data && typeof config.data !== 'string') {
config.data = JSON.stringify(config.data)
}

xhr.setRequestHeader('Content-Type', contentType)
}

Expand Down
6 changes: 5 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Utils = {
return Object.prototype.toString.call(obj).slice(8, -1) === 'Date'
},

isBrowser: (new Function('try {return this===window;}catch(e){ return false;}'))(),
isBrowser: isBrowser(),

castArray(value) {
if (Utils.isArray(value)) {
Expand Down Expand Up @@ -184,6 +184,10 @@ const Utils = {
}
}

function isBrowser(){
return (typeof self === 'object' && self.self === self) && (typeof window === 'object' && window === self)
}

function classWrapper(obj) {
//TODO: refactor it
const wrapper = obj => {
Expand Down
9 changes: 8 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ const uglify = new webpack.optimize.UglifyJsPlugin({

module.exports = {
devtool: 'source-map',
target : 'node',

target : 'web',

node: {
Buffer: false
},

module: {
noParse: /backendless-request/,

rules: [
{
test : /\.js$/,
Expand Down