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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ integration/test_logs
.DS_Store
.idea/
integration/test_logs
out/

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: node_js
node_js:
- '5'
- '6.11.4'

branches:
only:
Expand Down
20 changes: 20 additions & 0 deletions jsdoc-conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"plugins": ["node_modules/jsdoc-babel"],
"babel": {
"plugins": ["transform-flow-strip-types"]
},
"source": {
"include": ["./package.json", "./README.md"],
"excludePattern": "(^|\\/|\\\\)_"
},
"templates": {
"default": {
"outputSourceFiles": false
},
"cleverLinks": false,
"monospaceLinks": false
},
"opts": {
"recurse": true
}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@
"gulp-uglify": "^2.1.2",
"jasmine-reporters": "~2.2.1",
"jest-cli": "^19.0.2",
"jsdoc": "^3.5.5",
"jsdoc-babel": "^0.3.0",
"vinyl-source-stream": "^1.1.0"
},
"scripts": {
"build": "./build_releases.sh",
"release": "./build_releases.sh && npm publish",
"test": "PARSE_BUILD=node jest"
"test": "PARSE_BUILD=node jest",
"docs": "jsdoc -c ./jsdoc-conf.json ./src"
},
"jest": {
"automock": true,
Expand Down
2 changes: 2 additions & 0 deletions src/Analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type ParsePromise from './ParsePromise';
*
* @class Parse.Analytics
* @static
* @hideconstructor
*/

/**
Expand All @@ -44,6 +45,7 @@ import type ParsePromise from './ParsePromise';
* There is a default limit of 8 dimensions per event tracked.
*
* @method track
* @name Parse.Analytics.track
* @param {String} name The name of the custom event to report to Parse as
* having happened.
* @param {Object} dimensions The dictionary of information by which to
Expand Down
2 changes: 2 additions & 0 deletions src/Cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ import ParsePromise from './ParsePromise';
*
* @class Parse.Cloud
* @static
* @hideconstructor
*/

/**
* Makes a call to a cloud function.
* @method run
* @name Parse.Cloud.run
* @param {String} name The function name.
* @param {Object} data The parameters to send to the cloud function.
* @param {Object} options A Backbone-style options object
Expand Down
2 changes: 1 addition & 1 deletion src/CoreManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
Expand Down
13 changes: 11 additions & 2 deletions src/FacebookUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ var provider = {
* Provides a set of utilities for using Parse with Facebook.
* @class Parse.FacebookUtils
* @static
* @hideconstructor
*/
var FacebookUtils = {
/**
Expand All @@ -105,6 +106,7 @@ var FacebookUtils = {
* with these arguments.
*
* @method init
* @name Parse.FacebookUtils.init
* @param {Object} options Facebook options argument as described here:
* <a href=
* "https://developers.facebook.com/docs/reference/javascript/FB.init/">
Expand Down Expand Up @@ -141,6 +143,7 @@ var FacebookUtils = {
* Gets whether the user has their account linked to Facebook.
*
* @method isLinked
* @name Parse.FacebookUtils.isLinked
* @param {Parse.User} user User to check for a facebook link.
* The user must be logged in on this device.
* @return {Boolean} <code>true</code> if the user has their account
Expand All @@ -156,13 +159,15 @@ var FacebookUtils = {
* creates, in the case where it is a new user) a Parse.User.
*
* @method logIn
* @param {String, Object} permissions The permissions required for Facebook
* @name Parse.FacebookUtils.logIn
* @param {(String|Object)} permissions The permissions required for Facebook
* log in. This is a comma-separated string of permissions.
* Alternatively, supply a Facebook authData object as described in our
* REST API docs if you want to handle getting facebook auth tokens
* yourself.
* @param {Object} options Standard options object with success and error
* callbacks.
* @returns {Parse.Promise}
*/
logIn(permissions, options) {
if (!permissions || typeof permissions === 'string') {
Expand Down Expand Up @@ -191,15 +196,17 @@ var FacebookUtils = {
* the account to the Parse.User.
*
* @method link
* @name Parse.FacebookUtils.link
* @param {Parse.User} user User to link to Facebook. This must be the
* current user.
* @param {String, Object} permissions The permissions required for Facebook
* @param {(String|Object)} permissions The permissions required for Facebook
* log in. This is a comma-separated string of permissions.
* Alternatively, supply a Facebook authData object as described in our
* REST API docs if you want to handle getting facebook auth tokens
* yourself.
* @param {Object} options Standard options object with success and error
* callbacks.
* @returns {Parse.Promise}
*/
link(user, permissions, options) {
if (!permissions || typeof permissions === 'string') {
Expand All @@ -226,10 +233,12 @@ var FacebookUtils = {
* Unlinks the Parse.User from a Facebook account.
*
* @method unlink
* @name Parse.FacebookUtils.unlink
* @param {Parse.User} user User to unlink from Facebook. This must be the
* current user.
* @param {Object} options Standard options object with success and error
* callbacks.
* @returns {Parse.Promise}
*/
unlink: function(user, options) {
if (!initialized) {
Expand Down
29 changes: 12 additions & 17 deletions src/LiveQueryClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ let generateInterval = (k) => {
*
* javascriptKey and masterKey are used for verifying the LiveQueryClient when it tries
* to connect to the LiveQuery server
*
* @class Parse.LiveQueryClient
* @constructor
* @param {Object} options
* @param {string} options.applicationId - applicationId of your Parse app
* @param {string} options.serverURL - <b>the URL of your LiveQuery server</b>
* @param {string} options.javascriptKey (optional)
* @param {string} options.masterKey (optional) Your Parse Master Key. (Node.js only!)
* @param {string} options.sessionToken (optional)
*
*
* We expose three events to help you monitor the status of the LiveQueryClient.
*
Expand Down Expand Up @@ -119,10 +109,9 @@ let generateInterval = (k) => {
* client.on('error', (error) => {
*
* });</pre>
*
*
* @alias Parse.LiveQueryClient
*/
export default class LiveQueryClient extends EventEmitter {
class LiveQueryClient extends EventEmitter {
attempts: number;
id: number;
requestId: number;
Expand All @@ -136,6 +125,14 @@ export default class LiveQueryClient extends EventEmitter {
socket: any;
state: string;

/**
* @param {Object} options
* @param {string} options.applicationId - applicationId of your Parse app
* @param {string} options.serverURL - <b>the URL of your LiveQuery server</b>
* @param {string} options.javascriptKey (optional)
* @param {string} options.masterKey (optional) Your Parse Master Key. (Node.js only!)
* @param {string} options.sessionToken (optional)
*/
constructor({
applicationId,
serverURL,
Expand Down Expand Up @@ -177,7 +174,6 @@ export default class LiveQueryClient extends EventEmitter {
* <a href="https://github.com/ParsePlatform/parse-server/wiki/Parse-LiveQuery-Protocol-Specification">here</a> for more details. The subscription you get is the same subscription you get
* from our Standard API.
*
* @method subscribe
* @param {Object} query - the ParseQuery you want to subscribe to
* @param {string} sessionToken (optional)
* @return {Object} subscription
Expand Down Expand Up @@ -218,7 +214,6 @@ export default class LiveQueryClient extends EventEmitter {
/**
* After calling unsubscribe you'll stop receiving events from the subscription object.
*
* @method unsubscribe
* @param {Object} subscription - subscription you would like to unsubscribe from.
*/
unsubscribe(subscription: Object) {
Expand All @@ -240,7 +235,6 @@ export default class LiveQueryClient extends EventEmitter {
* After open is called, the LiveQueryClient will try to send a connect request
* to the LiveQuery server.
*
* @method open
*/
open() {
let WebSocketImplementation = this._getWebSocketImplementation();
Expand Down Expand Up @@ -303,7 +297,6 @@ export default class LiveQueryClient extends EventEmitter {
* This method will close the WebSocket connection to this LiveQueryClient,
* cancel the auto reconnect and unsubscribe all subscriptions based on it.
*
* @method close
*/
close() {
if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
Expand Down Expand Up @@ -448,3 +441,5 @@ export default class LiveQueryClient extends EventEmitter {
}).bind(this), time);
}
}

export default LiveQueryClient;
19 changes: 11 additions & 8 deletions src/LiveQuerySubscription.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
Expand All @@ -16,10 +16,6 @@ import CoreManager from './CoreManager';
* Extends events.EventEmitter
* <a href="https://nodejs.org/api/events.html#events_class_eventemitter">cloud functions</a>.
*
* @constructor
* @param {string} id - subscription id
* @param {string} query - query to subscribe to
* @param {string} sessionToken - optional session token
*
* <p>Open Event - When you call query.subscribe(), we send a subscribe request to
* the LiveQuery server, when we get the confirmation from the LiveQuery server,
Expand Down Expand Up @@ -88,9 +84,14 @@ import CoreManager from './CoreManager';
*
* });</pre></p>
*
*
* @alias Parse.LiveQuerySubscription
*/
export default class Subscription extends EventEmitter {
class Subscription extends EventEmitter {
/*
* @param {string} id - subscription id
* @param {string} query - query to subscribe to
* @param {string} sessionToken - optional session token
*/
constructor(id, query, sessionToken) {
super();
this.id = id;
Expand All @@ -99,7 +100,7 @@ export default class Subscription extends EventEmitter {
}

/**
* @method unsubscribe
* closes the subscription
*/
unsubscribe() {
let _this = this;
Expand All @@ -110,3 +111,5 @@ export default class Subscription extends EventEmitter {
});
}
}

export default Subscription;
35 changes: 32 additions & 3 deletions src/Parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ import RESTController from './RESTController';

/**
* Contains all Parse API classes and functions.
* @class Parse
* @static
* @global
* @class
* @hideconstructor
*/
var Parse = {
/**
* Call this method first to set up your authentication tokens for Parse.
* You can get your keys from the Data Browser on parse.com.
* @method initialize
* @param {String} applicationId Your Parse Application ID.
* @param {String} javaScriptKey (optional) Your Parse JavaScript Key (Not needed for parse-server)
* @param {String} masterKey (optional) Your Parse Master Key. (Node.js only!)
Expand All @@ -48,6 +49,11 @@ var Parse = {
};

/** These legacy setters may eventually be deprecated **/
/**
* @member Parse.applicationId
* @type string
* @static
*/
Object.defineProperty(Parse, 'applicationId', {
get() {
return CoreManager.get('APPLICATION_ID');
Expand All @@ -56,6 +62,12 @@ Object.defineProperty(Parse, 'applicationId', {
CoreManager.set('APPLICATION_ID', value);
}
});

/**
* @member Parse.javaScriptKey
* @type string
* @static
*/
Object.defineProperty(Parse, 'javaScriptKey', {
get() {
return CoreManager.get('JAVASCRIPT_KEY');
Expand All @@ -64,6 +76,12 @@ Object.defineProperty(Parse, 'javaScriptKey', {
CoreManager.set('JAVASCRIPT_KEY', value);
}
});

/**
* @member Parse.masterKey
* @type string
* @static
*/
Object.defineProperty(Parse, 'masterKey', {
get() {
return CoreManager.get('MASTER_KEY');
Expand All @@ -72,6 +90,12 @@ Object.defineProperty(Parse, 'masterKey', {
CoreManager.set('MASTER_KEY', value);
}
});

/**
* @member Parse.serverURL
* @type string
* @static
*/
Object.defineProperty(Parse, 'serverURL', {
get() {
return CoreManager.get('SERVER_URL');
Expand All @@ -80,6 +104,11 @@ Object.defineProperty(Parse, 'serverURL', {
CoreManager.set('SERVER_URL', value);
}
});
/**
* @member Parse.liveQueryServerURL
* @type string
* @static
*/
Object.defineProperty(Parse, 'liveQueryServerURL', {
get() {
return CoreManager.get('LIVEQUERY_SERVER_URL');
Expand All @@ -88,7 +117,7 @@ Object.defineProperty(Parse, 'liveQueryServerURL', {
CoreManager.set('LIVEQUERY_SERVER_URL', value);
}
});
/** End setters **/
/* End setters */

Parse.ACL = require('./ParseACL').default;
Parse.Analytics = require('./Analytics');
Expand Down
Loading