Comparing version
@@ -19,3 +19,3 @@ /** | ||
SERVER_URL: 'https://api.parse.com', | ||
VERSION: '1.6.8', | ||
VERSION: '1.6.9', | ||
APPLICATION_ID: null, | ||
@@ -22,0 +22,0 @@ JAVASCRIPT_KEY: null, |
@@ -133,6 +133,7 @@ /** | ||
* @param {Object} attributes The initial set of data to store in the object. | ||
* @param {Object} options The options for this object instance. | ||
*/ | ||
var ParseObject = (function () { | ||
function ParseObject(className, attributes) { | ||
function ParseObject(className, attributes, options) { | ||
_classCallCheck(this, ParseObject); | ||
@@ -155,4 +156,7 @@ | ||
} | ||
if (attributes && typeof attributes === 'object') { | ||
options = attributes; | ||
} | ||
} | ||
if (toSet && !this.set(toSet)) { | ||
if (toSet && !this.set(toSet, options)) { | ||
throw new Error('Can\'t create an invalid Parse Object'); | ||
@@ -380,6 +384,3 @@ } | ||
var pending = this._getPendingOps(); | ||
if (pending.length > 2) { | ||
// There are more saves on the queue | ||
ObjectState.mergeFirstPendingState(this.className, this._getStateIdentifier()); | ||
} | ||
ObjectState.mergeFirstPendingState(this.className, this._getStateIdentifier()); | ||
} | ||
@@ -668,8 +669,10 @@ | ||
// Validate changes | ||
var validation = this.validate(newValues); | ||
if (validation) { | ||
if (typeof options.error === 'function') { | ||
options.error(this, validation); | ||
if (!options.ignoreValidation) { | ||
var validation = this.validate(newValues); | ||
if (validation) { | ||
if (typeof options.error === 'function') { | ||
options.error(this, validation); | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
@@ -1454,7 +1457,7 @@ | ||
} | ||
var ParseObjectSubclass = function ParseObjectSubclass(attributes) { | ||
var ParseObjectSubclass = function ParseObjectSubclass(attributes, options) { | ||
this.className = adjustedClassName; | ||
this._objCount = objectCount++; | ||
if (attributes && typeof attributes === 'object') { | ||
if (!this.set(attributes || {})) { | ||
if (!this.set(attributes || {}, options)) { | ||
throw new Error('Can\'t create an invalid Parse Object'); | ||
@@ -1461,0 +1464,0 @@ } |
@@ -370,4 +370,5 @@ /** | ||
* are resolved. If any promise in the list fails, then the returned promise | ||
* will fail with the last error. If they all succeed, then the returned | ||
* promise will succeed, with the results being the results of all the input | ||
* will be rejected with an array containing the error from each promise. | ||
* If they all succeed, then the returned promise will succeed, with the | ||
* results being the results of all the input | ||
* promises. For example: <pre> | ||
@@ -374,0 +375,0 @@ * var p1 = Parse.Promise.as(1); |
@@ -475,2 +475,44 @@ /** | ||
} | ||
/** | ||
* Wrap the default save behavior with functionality to save to local | ||
* storage if this is current user. | ||
*/ | ||
}, { | ||
key: 'save', | ||
value: function save() { | ||
var _this3 = this; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _get(Object.getPrototypeOf(ParseUser.prototype), 'save', this).apply(this, args).then(function () { | ||
if (_this3.isCurrent()) { | ||
return _CoreManager2['default'].getUserController().updateUserOnDisk(_this3); | ||
} | ||
return _this3; | ||
}); | ||
} | ||
/** | ||
* Wrap the default fetch behavior with functionality to save to local | ||
* storage if this is current user. | ||
*/ | ||
}, { | ||
key: 'fetch', | ||
value: function fetch() { | ||
var _this4 = this; | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return _get(Object.getPrototypeOf(ParseUser.prototype), 'fetch', this).apply(this, args).then(function () { | ||
if (_this4.isCurrent()) { | ||
return _CoreManager2['default'].getUserController().updateUserOnDisk(_this4); | ||
} | ||
return _this4; | ||
}); | ||
} | ||
}], [{ | ||
@@ -797,6 +839,3 @@ key: 'readOnlyAttributes', | ||
var DefaultController = { | ||
setCurrentUser: function setCurrentUser(user) { | ||
currentUserCache = user; | ||
user._cleanupAuthData(); | ||
user._synchronizeAllAuthData(); | ||
updateUserOnDisk: function updateUserOnDisk(user) { | ||
var path = _Storage2['default'].generatePath(CURRENT_USER_KEY); | ||
@@ -810,2 +849,9 @@ var json = user.toJSON(); | ||
setCurrentUser: function setCurrentUser(user) { | ||
currentUserCache = user; | ||
user._cleanupAuthData(); | ||
user._synchronizeAllAuthData(); | ||
return DefaultController.updateUserOnDisk(user); | ||
}, | ||
currentUser: function currentUser() { | ||
@@ -944,3 +990,3 @@ if (currentUserCache) { | ||
if (currentSession && (0, _isRevocableSession2['default'])(currentSession)) { | ||
promise.then(function () { | ||
promise = promise.then(function () { | ||
return RESTController.request('POST', 'logout', {}, { sessionToken: currentSession }); | ||
@@ -947,0 +993,0 @@ }); |
@@ -19,3 +19,3 @@ /** | ||
SERVER_URL: 'https://api.parse.com', | ||
VERSION: '1.6.8', | ||
VERSION: '1.6.9', | ||
APPLICATION_ID: null, | ||
@@ -22,0 +22,0 @@ JAVASCRIPT_KEY: null, |
@@ -133,6 +133,7 @@ /** | ||
* @param {Object} attributes The initial set of data to store in the object. | ||
* @param {Object} options The options for this object instance. | ||
*/ | ||
var ParseObject = (function () { | ||
function ParseObject(className, attributes) { | ||
function ParseObject(className, attributes, options) { | ||
_classCallCheck(this, ParseObject); | ||
@@ -155,4 +156,7 @@ | ||
} | ||
if (attributes && typeof attributes === 'object') { | ||
options = attributes; | ||
} | ||
} | ||
if (toSet && !this.set(toSet)) { | ||
if (toSet && !this.set(toSet, options)) { | ||
throw new Error('Can\'t create an invalid Parse Object'); | ||
@@ -380,6 +384,3 @@ } | ||
var pending = this._getPendingOps(); | ||
if (pending.length > 2) { | ||
// There are more saves on the queue | ||
ObjectState.mergeFirstPendingState(this.className, this._getStateIdentifier()); | ||
} | ||
ObjectState.mergeFirstPendingState(this.className, this._getStateIdentifier()); | ||
} | ||
@@ -668,8 +669,10 @@ | ||
// Validate changes | ||
var validation = this.validate(newValues); | ||
if (validation) { | ||
if (typeof options.error === 'function') { | ||
options.error(this, validation); | ||
if (!options.ignoreValidation) { | ||
var validation = this.validate(newValues); | ||
if (validation) { | ||
if (typeof options.error === 'function') { | ||
options.error(this, validation); | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
@@ -1454,7 +1457,7 @@ | ||
} | ||
var ParseObjectSubclass = function ParseObjectSubclass(attributes) { | ||
var ParseObjectSubclass = function ParseObjectSubclass(attributes, options) { | ||
this.className = adjustedClassName; | ||
this._objCount = objectCount++; | ||
if (attributes && typeof attributes === 'object') { | ||
if (!this.set(attributes || {})) { | ||
if (!this.set(attributes || {}, options)) { | ||
throw new Error('Can\'t create an invalid Parse Object'); | ||
@@ -1461,0 +1464,0 @@ } |
@@ -370,4 +370,5 @@ /** | ||
* are resolved. If any promise in the list fails, then the returned promise | ||
* will fail with the last error. If they all succeed, then the returned | ||
* promise will succeed, with the results being the results of all the input | ||
* will be rejected with an array containing the error from each promise. | ||
* If they all succeed, then the returned promise will succeed, with the | ||
* results being the results of all the input | ||
* promises. For example: <pre> | ||
@@ -374,0 +375,0 @@ * var p1 = Parse.Promise.as(1); |
@@ -475,2 +475,44 @@ /** | ||
} | ||
/** | ||
* Wrap the default save behavior with functionality to save to local | ||
* storage if this is current user. | ||
*/ | ||
}, { | ||
key: 'save', | ||
value: function save() { | ||
var _this3 = this; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _get(Object.getPrototypeOf(ParseUser.prototype), 'save', this).apply(this, args).then(function () { | ||
if (_this3.isCurrent()) { | ||
return _CoreManager2['default'].getUserController().updateUserOnDisk(_this3); | ||
} | ||
return _this3; | ||
}); | ||
} | ||
/** | ||
* Wrap the default fetch behavior with functionality to save to local | ||
* storage if this is current user. | ||
*/ | ||
}, { | ||
key: 'fetch', | ||
value: function fetch() { | ||
var _this4 = this; | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return _get(Object.getPrototypeOf(ParseUser.prototype), 'fetch', this).apply(this, args).then(function () { | ||
if (_this4.isCurrent()) { | ||
return _CoreManager2['default'].getUserController().updateUserOnDisk(_this4); | ||
} | ||
return _this4; | ||
}); | ||
} | ||
}], [{ | ||
@@ -797,6 +839,3 @@ key: 'readOnlyAttributes', | ||
var DefaultController = { | ||
setCurrentUser: function setCurrentUser(user) { | ||
currentUserCache = user; | ||
user._cleanupAuthData(); | ||
user._synchronizeAllAuthData(); | ||
updateUserOnDisk: function updateUserOnDisk(user) { | ||
var path = _Storage2['default'].generatePath(CURRENT_USER_KEY); | ||
@@ -810,2 +849,9 @@ var json = user.toJSON(); | ||
setCurrentUser: function setCurrentUser(user) { | ||
currentUserCache = user; | ||
user._cleanupAuthData(); | ||
user._synchronizeAllAuthData(); | ||
return DefaultController.updateUserOnDisk(user); | ||
}, | ||
currentUser: function currentUser() { | ||
@@ -944,3 +990,3 @@ if (currentUserCache) { | ||
if (currentSession && (0, _isRevocableSession2['default'])(currentSession)) { | ||
promise.then(function () { | ||
promise = promise.then(function () { | ||
return RESTController.request('POST', 'logout', {}, { sessionToken: currentSession }); | ||
@@ -947,0 +993,0 @@ }); |
@@ -19,3 +19,3 @@ /** | ||
SERVER_URL: 'https://api.parse.com', | ||
VERSION: '1.6.8', | ||
VERSION: '1.6.9', | ||
APPLICATION_ID: null, | ||
@@ -22,0 +22,0 @@ JAVASCRIPT_KEY: null, |
@@ -133,6 +133,7 @@ /** | ||
* @param {Object} attributes The initial set of data to store in the object. | ||
* @param {Object} options The options for this object instance. | ||
*/ | ||
var ParseObject = (function () { | ||
function ParseObject(className, attributes) { | ||
function ParseObject(className, attributes, options) { | ||
_classCallCheck(this, ParseObject); | ||
@@ -155,4 +156,7 @@ | ||
} | ||
if (attributes && typeof attributes === 'object') { | ||
options = attributes; | ||
} | ||
} | ||
if (toSet && !this.set(toSet)) { | ||
if (toSet && !this.set(toSet, options)) { | ||
throw new Error('Can\'t create an invalid Parse Object'); | ||
@@ -380,6 +384,3 @@ } | ||
var pending = this._getPendingOps(); | ||
if (pending.length > 2) { | ||
// There are more saves on the queue | ||
ObjectState.mergeFirstPendingState(this.className, this._getStateIdentifier()); | ||
} | ||
ObjectState.mergeFirstPendingState(this.className, this._getStateIdentifier()); | ||
} | ||
@@ -668,8 +669,10 @@ | ||
// Validate changes | ||
var validation = this.validate(newValues); | ||
if (validation) { | ||
if (typeof options.error === 'function') { | ||
options.error(this, validation); | ||
if (!options.ignoreValidation) { | ||
var validation = this.validate(newValues); | ||
if (validation) { | ||
if (typeof options.error === 'function') { | ||
options.error(this, validation); | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
@@ -1454,7 +1457,7 @@ | ||
} | ||
var ParseObjectSubclass = function ParseObjectSubclass(attributes) { | ||
var ParseObjectSubclass = function ParseObjectSubclass(attributes, options) { | ||
this.className = adjustedClassName; | ||
this._objCount = objectCount++; | ||
if (attributes && typeof attributes === 'object') { | ||
if (!this.set(attributes || {})) { | ||
if (!this.set(attributes || {}, options)) { | ||
throw new Error('Can\'t create an invalid Parse Object'); | ||
@@ -1461,0 +1464,0 @@ } |
@@ -370,4 +370,5 @@ /** | ||
* are resolved. If any promise in the list fails, then the returned promise | ||
* will fail with the last error. If they all succeed, then the returned | ||
* promise will succeed, with the results being the results of all the input | ||
* will be rejected with an array containing the error from each promise. | ||
* If they all succeed, then the returned promise will succeed, with the | ||
* results being the results of all the input | ||
* promises. For example: <pre> | ||
@@ -374,0 +375,0 @@ * var p1 = Parse.Promise.as(1); |
@@ -475,2 +475,44 @@ /** | ||
} | ||
/** | ||
* Wrap the default save behavior with functionality to save to local | ||
* storage if this is current user. | ||
*/ | ||
}, { | ||
key: 'save', | ||
value: function save() { | ||
var _this3 = this; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _get(Object.getPrototypeOf(ParseUser.prototype), 'save', this).apply(this, args).then(function () { | ||
if (_this3.isCurrent()) { | ||
return _CoreManager2['default'].getUserController().updateUserOnDisk(_this3); | ||
} | ||
return _this3; | ||
}); | ||
} | ||
/** | ||
* Wrap the default fetch behavior with functionality to save to local | ||
* storage if this is current user. | ||
*/ | ||
}, { | ||
key: 'fetch', | ||
value: function fetch() { | ||
var _this4 = this; | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return _get(Object.getPrototypeOf(ParseUser.prototype), 'fetch', this).apply(this, args).then(function () { | ||
if (_this4.isCurrent()) { | ||
return _CoreManager2['default'].getUserController().updateUserOnDisk(_this4); | ||
} | ||
return _this4; | ||
}); | ||
} | ||
}], [{ | ||
@@ -797,6 +839,3 @@ key: 'readOnlyAttributes', | ||
var DefaultController = { | ||
setCurrentUser: function setCurrentUser(user) { | ||
currentUserCache = user; | ||
user._cleanupAuthData(); | ||
user._synchronizeAllAuthData(); | ||
updateUserOnDisk: function updateUserOnDisk(user) { | ||
var path = _Storage2['default'].generatePath(CURRENT_USER_KEY); | ||
@@ -810,2 +849,9 @@ var json = user.toJSON(); | ||
setCurrentUser: function setCurrentUser(user) { | ||
currentUserCache = user; | ||
user._cleanupAuthData(); | ||
user._synchronizeAllAuthData(); | ||
return DefaultController.updateUserOnDisk(user); | ||
}, | ||
currentUser: function currentUser() { | ||
@@ -944,3 +990,3 @@ if (currentUserCache) { | ||
if (currentSession && (0, _isRevocableSession2['default'])(currentSession)) { | ||
promise.then(function () { | ||
promise = promise.then(function () { | ||
return RESTController.request('POST', 'logout', {}, { sessionToken: currentSession }); | ||
@@ -947,0 +993,0 @@ }); |
{ | ||
"name": "parse", | ||
"version": "1.6.8", | ||
"version": "1.6.9", | ||
"description": "The Parse JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "homepage": "https://www.parse.com", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1307936
0.55%34223
0.51%