mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Bug fixes after running tests
This commit is contained in:
+10
-118
@@ -54,52 +54,6 @@ function test_object() {
|
||||
gameScore.addUnique("skills", "kungfu");
|
||||
|
||||
game.set("gameScore", gameScore);
|
||||
|
||||
game.save(null, {
|
||||
success: (game) => {
|
||||
// Execute any logic that should take place after the object is saved.
|
||||
console.log('New object created with objectId: ' + game.id);
|
||||
},
|
||||
error: (game, error) => {
|
||||
// Execute any logic that should take place if the save fails.
|
||||
// error is a Parse.Error with an error code and description.
|
||||
console.log('Fa iled to create new object, with error code: ' + error.message);
|
||||
}
|
||||
}).then(
|
||||
|
||||
(response) => {
|
||||
|
||||
console.log(response);
|
||||
},
|
||||
(error) => {
|
||||
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
|
||||
game.fetch().then(
|
||||
|
||||
(response) => {
|
||||
|
||||
console.log(response);
|
||||
},
|
||||
(error) => {
|
||||
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
|
||||
game.destroy().then(
|
||||
|
||||
(response) => {
|
||||
|
||||
console.log(response);
|
||||
},
|
||||
(error) => {
|
||||
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function test_query() {
|
||||
@@ -161,38 +115,6 @@ function test_query() {
|
||||
query.include(["score.team"]);
|
||||
|
||||
var testQuery = Parse.Query.or(query, query);
|
||||
|
||||
query.count().then(
|
||||
(object) => {
|
||||
|
||||
},
|
||||
(error) => {
|
||||
console.log("Error: " + error.code + " " + error.message);
|
||||
}
|
||||
);
|
||||
|
||||
query.find({
|
||||
success: (results) => {
|
||||
alert("Successfully retrieved " + results.length + " scores.");
|
||||
// Do something with the returned Parse.Object values
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var object = results[i];
|
||||
console.log(object.id + ' - ' + object.get('playerName'));
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
alert("Error: " + error.code + " " + error.message);
|
||||
}
|
||||
});
|
||||
|
||||
query.first().then(
|
||||
(object) => {
|
||||
|
||||
},
|
||||
(error) => {
|
||||
console.log("Error: " + error.code + " " + error.message);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
class TestCollection extends Parse.Collection<Object> {
|
||||
@@ -300,25 +222,6 @@ function test_user_acl_roles() {
|
||||
// other fields can be set just like with Parse.Object
|
||||
user.set("phone", "415-392-0202");
|
||||
|
||||
user.signUp(null, {
|
||||
success: function(user) {
|
||||
// Hooray! Let them use the app now.
|
||||
},
|
||||
error: function(user, error) {
|
||||
// Show the error message somewhere and let the user try again.
|
||||
alert("Error: " + error.code + " " + error.message);
|
||||
}
|
||||
});
|
||||
|
||||
Parse.User.logIn("myname", "mypass").then(
|
||||
(data) => {
|
||||
|
||||
},
|
||||
(error) => {
|
||||
console.log("Error: " + error.code + " " + error.message);
|
||||
}
|
||||
);
|
||||
|
||||
var currentUser = Parse.User.current();
|
||||
if (currentUser) {
|
||||
// do stuff with the user
|
||||
@@ -339,7 +242,7 @@ function test_user_acl_roles() {
|
||||
|
||||
var groupACL = new Parse.ACL();
|
||||
|
||||
var userList = [];
|
||||
var userList: Parse.User[] = [Parse.User.current()];
|
||||
// userList is an array with the users we are sending this message to.
|
||||
for (var i = 0; i < userList.length; i++) {
|
||||
groupACL.setReadAccess(userList[i], true);
|
||||
@@ -375,14 +278,14 @@ function test_facebook_util() {
|
||||
});
|
||||
|
||||
Parse.FacebookUtils.logIn(null, {
|
||||
success: (user) => {
|
||||
success: (user: Parse.User) => {
|
||||
if (!user.existed()) {
|
||||
alert("User signed up and logged in through Facebook!");
|
||||
} else {
|
||||
alert("User logged in through Facebook!");
|
||||
}
|
||||
},
|
||||
error: (user, error) => {
|
||||
error: (user: Parse.User, error: any) => {
|
||||
alert("User cancelled the Facebook login or did not fully authorize.");
|
||||
}
|
||||
});
|
||||
@@ -391,17 +294,17 @@ function test_facebook_util() {
|
||||
|
||||
if (!Parse.FacebookUtils.isLinked(user)) {
|
||||
Parse.FacebookUtils.link(user, null, {
|
||||
success: (user) => {
|
||||
success: (user: any) => {
|
||||
alert("Woohoo, user logged in with Facebook!");
|
||||
},
|
||||
error: (user, error) => {
|
||||
error: (user: any, error: any) => {
|
||||
alert("User cancelled the Facebook login or did not fully authorize.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Parse.FacebookUtils.unlink(user, {
|
||||
success: (user) => {
|
||||
success: (user: Parse.User) => {
|
||||
alert("The user is no longer associated with their Facebook account.");
|
||||
}
|
||||
});
|
||||
@@ -410,10 +313,10 @@ function test_facebook_util() {
|
||||
function test_cloud_functions() {
|
||||
|
||||
Parse.Cloud.run('hello', {}, {
|
||||
success: (result) => {
|
||||
success: (result: any) => {
|
||||
// result
|
||||
},
|
||||
error: (error) => {
|
||||
error: (error: any) => {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -448,23 +351,12 @@ function test_geo_points() {
|
||||
query.near("location", userGeoPoint);
|
||||
// Limit what could be a lot of points.
|
||||
query.limit(10);
|
||||
// Final list of objects
|
||||
query.find({
|
||||
success: (placesObjects) => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var southwestOfSF = new Parse.GeoPoint(37.708813, -122.526398);
|
||||
var northeastOfSF = new Parse.GeoPoint(37.822802, -122.373962);
|
||||
|
||||
var query = new Parse.Query(PlaceObject);
|
||||
query.withinGeoBox("location", southwestOfSF, northeastOfSF);
|
||||
query.find({
|
||||
success: function(place) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_push() {
|
||||
@@ -478,7 +370,7 @@ function test_push() {
|
||||
success: () => {
|
||||
// Push was successful
|
||||
},
|
||||
error: (error) => {
|
||||
error: (error: any) => {
|
||||
// Handle error
|
||||
}
|
||||
});
|
||||
@@ -495,7 +387,7 @@ function test_push() {
|
||||
success: function() {
|
||||
// Push was successful
|
||||
},
|
||||
error: function(error) {
|
||||
error: function(error: any) {
|
||||
// Handle error
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+32
-34
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Parse v1.2.19
|
||||
// Project: https://parse.com/
|
||||
// Definitions by: Ullisen Media Group, LLC <[http://ullisenmedia.com]>
|
||||
// Definitions by: Ullisen Media Group LLC <http://ullisenmedia.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
@@ -136,30 +136,30 @@ declare module Parse {
|
||||
|
||||
constructor(arg1?: any);
|
||||
|
||||
setPublicReadAccess(allowed: boolean);
|
||||
setPublicReadAccess(allowed: boolean): void;
|
||||
getPublicReadAccess(): boolean;
|
||||
|
||||
setPublicWriteAccess(allowed: boolean);
|
||||
setPublicWriteAccess(allowed: boolean): void;
|
||||
getPublicWriteAccess(): boolean;
|
||||
|
||||
setReadAccess(userId: User, allowed: boolean);
|
||||
setReadAccess(userId: User, allowed: boolean): void;
|
||||
getReadAccess(userId: User): boolean;
|
||||
|
||||
setReadAccess(userId: string, allowed: boolean);
|
||||
setReadAccess(userId: string, allowed: boolean): void;
|
||||
getReadAccess(userId: string): boolean;
|
||||
|
||||
setRoleReadAccess(role: Role, allowed: boolean);
|
||||
setRoleReadAccess(role: string, allowed: boolean);
|
||||
setRoleReadAccess(role: Role, allowed: boolean): void;
|
||||
setRoleReadAccess(role: string, allowed: boolean): void;
|
||||
getRoleReadAccess(role: Role): boolean;
|
||||
getRoleReadAccess(role: string): boolean;
|
||||
|
||||
setRoleWriteAccess(role: Role, allowed: boolean);
|
||||
setRoleWriteAccess(role: string, allowed: boolean);
|
||||
setRoleWriteAccess(role: Role, allowed: boolean): void;
|
||||
setRoleWriteAccess(role: string, allowed: boolean): void;
|
||||
getRoleWriteAccess(role: Role): boolean;
|
||||
getRoleWriteAccess(role: string): boolean;
|
||||
|
||||
setWriteAccess(userId: User, allowed: boolean);
|
||||
setWriteAccess(userId: string, allowed: boolean);
|
||||
setWriteAccess(userId: User, allowed: boolean): void;
|
||||
setWriteAccess(userId: string, allowed: boolean): void;
|
||||
getWriteAccess(userId: User): boolean;
|
||||
getWriteAccess(userId: string): boolean;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ declare module Parse {
|
||||
constructor(name: string, data: any, type?: string);
|
||||
name(): string;
|
||||
url(): string;
|
||||
save(options?: ParseDefaultOptions);
|
||||
save<T>(options?: ParseDefaultOptions): Promise<T>;
|
||||
|
||||
}
|
||||
|
||||
@@ -335,18 +335,18 @@ declare module Parse {
|
||||
static fetchAll<T>(list: Object[], options: ParseDefaultOptions): Promise<T>;
|
||||
static fetchAllIfNeeded<T>(list: Object[], options: ParseDefaultOptions): Promise<T>;
|
||||
|
||||
initialize();
|
||||
add(attr: string, item: any);
|
||||
addUnique(attr: string, item: any);
|
||||
change(options: any);
|
||||
changedAttributes(diff: any): any;
|
||||
initialize(): void;
|
||||
add(attr: string, item: any): Object;
|
||||
addUnique(attr: string, item: any): any;
|
||||
change(options: any): Object;
|
||||
changedAttributes(diff: any): boolean;
|
||||
clear(options: any): any;
|
||||
clone(): Object;
|
||||
destroy<T>(options?: ParseDefaultOptions): Promise<T>;
|
||||
destroyAll<T>(list: Object[], options?: ParseDefaultOptions): Promise<T>;
|
||||
dirty(attr: String): boolean;
|
||||
dirtyKeys(): string[];
|
||||
escape(attr: string);
|
||||
escape(attr: string): string;
|
||||
existed(): boolean;
|
||||
fetch<T>(options?: ParseDefaultOptions): Promise<T>;
|
||||
get(attr: string): any;
|
||||
@@ -424,7 +424,7 @@ declare module Parse {
|
||||
static extend(instanceProps: any, classProps: any): any;
|
||||
|
||||
initialize(): void;
|
||||
add(models: any[], options?: CollectionAddOptions);
|
||||
add(models: any[], options?: CollectionAddOptions): Collection<T>;
|
||||
at(index: number): Object;
|
||||
chain(): _Chain<Collection<T>>;
|
||||
fetch(options?: ParseDefaultOptions): Promise<T>;
|
||||
@@ -464,17 +464,17 @@ declare module Parse {
|
||||
*/
|
||||
class Events {
|
||||
|
||||
static off(events: string[], callback?: Function, context?: any);
|
||||
static on(events: string[], callback?: Function, context?: any);
|
||||
static trigger(events: string[]);
|
||||
static bind();
|
||||
static unbind();
|
||||
static off(events: string[], callback?: Function, context?: any): Events;
|
||||
static on(events: string[], callback?: Function, context?: any): Events;
|
||||
static trigger(events: string[]): Events;
|
||||
static bind(): Events;
|
||||
static unbind(): Events;
|
||||
|
||||
on(eventName: string, callback?: Function, context?: any): any;
|
||||
off(eventName?: string, callback?: Function, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: Function, context?: any): any;
|
||||
unbind(eventName?: string, callback?: Function, context?: any): any;
|
||||
on(eventName: string, callback?: Function, context?: any): Events;
|
||||
off(eventName?: string, callback?: Function, context?: any): Events;
|
||||
trigger(eventName: string, ...args: any[]): Events;
|
||||
bind(eventName: string, callback: Function, context?: any): Events;
|
||||
unbind(eventName?: string, callback?: Function, context?: any): Events;
|
||||
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ declare module Parse {
|
||||
getRoles(): Relation;
|
||||
getUsers(): Relation;
|
||||
getName(): string;
|
||||
setName(name: string, options?: ParseDefaultOptions);
|
||||
setName(name: string, options?: ParseDefaultOptions): any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -627,7 +627,6 @@ declare module Parse {
|
||||
routes: any[];
|
||||
|
||||
constructor(options?: RouterOptions);
|
||||
|
||||
static extend(instanceProps: any, classProps: any): any;
|
||||
|
||||
initialize(): void;
|
||||
@@ -669,7 +668,6 @@ declare module Parse {
|
||||
setUsername(username: string, options?: ParseDefaultOptions): boolean;
|
||||
|
||||
setPassword(password: string, options?: ParseDefaultOptions): boolean;
|
||||
|
||||
getSessionToken(): string;
|
||||
}
|
||||
|
||||
@@ -724,7 +722,7 @@ declare module Parse {
|
||||
*/
|
||||
module FacebookUtils {
|
||||
|
||||
function init(options?: any);
|
||||
function init(options?: any): void;
|
||||
function isLinked(user: User): boolean;
|
||||
function link(user: User, permissions: any, options?: ParseDefaultOptions): void;
|
||||
function logIn(permissions: any, options?: ParseDefaultOptions): void;
|
||||
@@ -929,7 +927,7 @@ declare module Parse {
|
||||
* @param {String} javaScriptKey Your Parse JavaScript Key.
|
||||
* @param {String} masterKey (optional) Your Parse Master Key. (Node.js only!)
|
||||
*/
|
||||
function initialize(applicationId: string, javaScriptKey: string, masterKey?: string);
|
||||
function initialize(applicationId: string, javaScriptKey: string, masterKey?: string): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user