parse-community / parse-sdk-js Goto Github PK
View Code? Open in Web Editor NEWThe JavaScript SDK for Parse Platform
Home Page: https://parseplatform.org
License: Apache License 2.0
The JavaScript SDK for Parse Platform
Home Page: https://parseplatform.org
License: Apache License 2.0
I'm using Parse/react-native library.
Steps:
I do some modifications to current user:
user.set("visible", value);
return user.save();
Parse.User.current() and Parse.User.currentAsync() are correctly updated.
In Data Browser the change is also updated.
I do a force close of the app, and when I enter again and fetch Parse.User.curretAsync(), the changes I previously made are gone.
Let me know if you need more informations to reproduce. Thanks!
Hi Andrew et al, I have a similar use case as Issue #26
This is to support the Parse+Backbone distribution I'm open sourcing to continue support for Backbone. I'm distributing it in two ways:
First, I will be creating a standalone bundle by modifying the current build process w/ Browserify combining Parse browser SDK w/ my Backbone fork. This will handle the folks that just need to import one ES5 bundle with Parse+Backbone.
However, it would be really handy to have a separate Git repo that just contains the latest built browser bundle. The reasoning for this is supporting SystemJS / JSPM as it would be great to be able to pull in just the Parse browser SDK bundle from a git repo as a dependency. When installing the NPM package via JSPM it pulls in everything and the kitchen sink of course including node and react-native runtimes and really muddies up the SystemJS config.js file with all the unneeded dependencies to run the Parse browser SDK. In regard to Issue #26 even if you added the lib / dist directories and content JSPM will still pull it all in which is undesirable. Therefore having a separate Git repo with the latest built browser SDK is really handy. This will allow folks to install the official Parse browser bundle repo and my Backbone fork as raw source into SystemJS via JSPM via Git.
Either you guys do it or I do it and I'd prefer Parse does it so that things stay up to date w/ timely updates.
FYI, I have converted Backbone 1.2.3 to ES6, modularized it and have made it extendable through constructor injection. This makes it easy to provide just the modifications for Parse support in addition to any further modifications to Backbone as desired in a clean / ES6 manner. This is why it's desirable to pull in the ES6 Backbone source and link it against the Parse browser bundle.
Thanks for considering this request...
Currently the only available licensing information in these single-file releases is a notice describing that the license/patent grants are included in the root dir of the source tree, and no such source tree exists in those distributions. As an end-user, this feels like I need to also include those files in the source tree of the projects that consume the library, even when the rest of the project is not covered by these same terms. Because of this ambiguity the only legally safe option I have is to not include this vital piece of code in my source distributions. However, injecting the actual license and patent information into the single-file distributions instead of the notice that's there now would fix this.
1.6.6 resolves the problem with includes, but dotted includes such as myObject.createdUserRef does expand myObject, but doesn't expand createdUserRef pointer. extension of bug #32
Let me know, If I can get help from localStorage () function?
I am querying some data using the JS SDK. It has been working for me however today when I run it again I get no data returned but the following in console:
XMLHttpRequest cannot load https://api.parse.com/1/classes/MyClass. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.0.108:8100' is therefore not allowed access. The response had HTTP status code 502.
But I have changed nothing in my code or on the Parse core...
Hey guys,
I've a weird problem. I retrieve objects from my database (Parse.com) and need to update them later on. But if I update them, they're sometimes re-created (new objects are created with the new values). But only sometimes. Below you find the code. Am I something missing?
[...]
var codes = ... // load objects
var response = JSON.parse(response.text);
if (response[0].status == "sent" || response[0].status == "queued"){
for (var i=0; i<codes.length; i++){
codes[i].set("sent", true);
}
}
return Parse.Object.saveAll(codes);
Using this code on beforeSave and afterSave methods, saves a blank row with no data :
Parse.Cloud.beforeSave(Parse.Object.extend("Look"), function(request,response) {
// Set up to modify user data
alert("Calling before save for look");
//For Expiring a look when look marked rejected
for (var i in request.object.dirtyKeys()) {
alert("Calling before save for look 1");
var dirtyKey = request.object.dirtyKeys()[i];
alert("dirty key for look aftersave"+dirtyKey);
if(dirtyKey == "eventState" && request.object.get("eventState") == 2){
//Also expire this look
request.object.set("expired",true);
alert("Look expired");
var pushQuery = new Parse.Query(Parse.Installation);
var userIdQuery = new Parse.Query(Parse.User);
var message = "Your look has been rejected by the event administrator.";
var fromUser=request.object.get("fromUser");
userIdQuery.equalTo("objectId", fromUser);
pushQuery.matchesQuery('user', userIdQuery);
Parse.Push.send({
where: pushQuery,
data: {
alert: message,
type:"lookRejected"
}
}, {
success: function() {
alert("Push went successfully For Look Rejection!");
},
error: function(error) {
alert("Error executing: " + error.code + " " + error.message);
}
});
}
}
response.success();
});
Parse.Cloud.afterSave(Parse.Object.extend("Look"), function(request) {
alert("Calling before save for look");
var userId = request.object.get("fromUser");
var inappropriate = request.object.get("inappropriate");
var like = request.object.get("likes");
var dislike = request.object.get("dislikes");
var pushQuery = new Parse.Query(Parse.Installation);
var userIdQuery = new Parse.Query(Parse.User);
var message = "The results are in! See what people think of your latest look.";
var typeObj="like";
alert("Calling before save for look 1");
if(typeof dislike != "undefined"){
like = like + dislike;
}
userIdQuery.equalTo("objectId", userId);
userIdQuery.equalTo("lookResponse", like);
// if(typeof inappropriate != "undefined" && inappropriate != '' && inappropriate){
// message = "Your look has been marked inappropriate!!";
// typeObj="inappropriate";
// }else{
// userIdQuery.equalTo("lookResponse", like);
// message = "Hey! your looks are fetching likes!"
// typeObj="like";
// }
alert("Calling before save for look 2");
pushQuery.matchesQuery('user', userIdQuery);
Parse.Push.send({
where: pushQuery,
data: {
alert: message,
type:typeObj
}
}, {
success: function() {
alert("Push went successfully!");
},
error: function(error) {
alert("Error executing: " + error.code + " " + error.message);
}
});
});
toJSON has different implementations giving expanded include (correct) and non expanded include (not correct)
json[attr] = (0, _encode2['default'])(attrs[attr], false, true);
(https://parse.com/docs/downloads -- also the version i think is working in parse hosting)
means that pointers are not expanded, but NPM version of parse is
json[attr] = (0, _encode2['default'])(attrs[attr], false, false);
(https://github.com/ParsePlatform/Parse-SDK-JS)
above works in local debug but on cloud it breaks....
key: 'toJSON',
value: function toJSON() {
var json = {};
var attrs = this.attributes;
for (var attr in attrs) {
if ((attr === 'createdAt' || attr === 'updatedAt') && attrs[attr].toJSON) {
json[attr] = attrs[attr].toJSON();
} else {
json[attr] = (0, _encode2['default'])(attrs[attr], false, true);
}
}
var pending = this._getPendingOps();
for (var attr in pending[0]) {
json[attr] = pending[0][attr].toJSON();
}
if (this.id) {
json.objectId = this.id;
}
return json;
}
I have 2 classes named Item and Notification.
In Item's beforeSave() I check if there is a new relation added to it called "queue" if there is then I create a new Notification object with one of its fields points to that Item. This results to an infinite loop wherein Item's beforeSave() is called multiple times creating several Notification objects in the database.
Similar to #16, but in this case there IS actually a source tree, and one of the two files mentioned by the per-file licensing information is there (LICENSE), but the patent grants are missing.
Shouldn't there be a global configuration to handle failed request instead of handling it in the error of every request?
Eg: I was handle session failures and instead of handling it in every request a global interceptor like Angular JS would be great.
https://djds4rce.wordpress.com/2013/08/13/understanding-angular-http-interceptors/
For legacy reasons, the SDK currently supports handling asynchronous actions through two separate methods: Backbone-style success/error callbacks, and Promises. We would like to explore the idea of deprecating the callbacks interface in favor of only using Promises, and we would like community input on this decision.
Why deprecate this piece of the SDK?
We believe that the callbacks format is a less-than-optimal approach to structuring asynchronous code. With ES6, Promises are a feature of the JS language, and we want to discourage async formats that allow developers to fall into "callback hell."
From a code perspective, these require internal methods to have a bunch of boilerplate in order to support wrapping controller methods that use Promises. Removing these callbacks would reduce complexity and remove bytes from nearly every publicly-exposed method.
Proposed deprecation path:
In 1.7.0, using Backbone callbacks will log a warning that the format is now deprecated, and will be removed in 1.8. These warning will only be in the non-minified SDK, so they will not affect production.
In 1.8.0, we completely remove callbacks support.
This is my android code :
ParseObject parseObject = new ParseObject("likes");
ParseObject parseuser=ParseObject.createWithoutData(ParseUser.class,post.getPosAuthorObjectId());
ParseObject parsepost=ParseObject.createWithoutData("posts",post.getObjectId());
parsepost.put("postAuthor",parseuser);
parseObject.put("ownerId", ParseObject.createWithoutData(ParseUser.class, ParseUser.getCurrentUser().getObjectId()));
parseObject.put("postId",parsepost);
parseObject.saveInBackground
**I am trying to send some data regarding the user's id along with the post object so as to save the post object into the "likes" class and do changes in the post owner's attributes using masterkey without fetching the id of the post owner in a separate query as it is already stored in my android code .**In my experimental beforeSave():
Parse.Cloud.beforeSave("likes",function(request,response){
var posts = Parse.Object.extend("posts");
var post=new posts();
var post=request.object.get("postId");
var user=Parse.Object.extend(Parse.User);
var user=new Parse.User();
var id =post.object.get("postAuthor").id;
if(id!=null){
response.success();
}
else{
response.error("The id is null");
}
});
Basically I am trying to retrieve the user id saved in the postobject and sent to the request parameter .But the output of my experiment is always null.
In the following code the "query.select" will be ignored with version 1.6.4, but works in version 1.5.0.
var Objekt = Parse.Object.extend("objekt");
var query = new Parse.Query(Objekt);
query.select("title");
query.find({
success:function(results) {
for (var i = 0; i < results.length; i++) {
var object = results[i];
console.log(object.id + ' - ' + object.get('title'));
}
}
});
I am executing the following code
var TestObject = Parse.Object.extend("TestObject");
var testObject = new TestObject();
testObject.set("Name", "testName");
testObject.save(null, {
success: function(testObject) {
// Execute any logic that should take place after the object is saved.
console.log('New testObject created with objectId: ' + testObject.id);
var TestObject2 = Parse.Object.extend("TestObject2");
var testObject2 = new TestObject2();
testObject2.set("Name", "testName2");
testObject2.save(null, {
success: function(testObject2) {
// Execute any logic that should take place after the object is saved.
console.log('New testObject2 created with objectId: ' + testObject2.id);
var relation = testObject.relation("TestObjectRelation");
console.log('Make sure the relation exists ' + testObject.relation("TestObjectRelation"));
relation.add(testObject2);
testObject.save();
},
error: function(testObject2, error) {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
console.log('Failed to create new testObject2, with error code: ' + error.message);
}
});
},
error: function(venue, error) {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
console.log('Failed to create new testObject, with error code: ' + error.message);
}
});
I create an object, and then create a second object and try to save that as a relation to the first object ... though I am following the documented syntax, I always get the same error
ReferenceError: parent is not defined
at ParseRelation.add (/home/showcast/node_modules/parse/lib/node/ParseRelation.js:102:14)
Is this a bug in the node SDK ? are parse it's self?
I'm using this cloud function to upgrade a user from anonymous to real, and then request a password reset, on app https://www.parse.com/apps/invoice-maker-dev
After doing this, I then login with that user on an AndroidDevice, then call ParseAnonymousUtils.isLinked and expected the result to be false (real) but I get true (anonymous).
Looking at the ParseUser in the parse console I see that the user is still anonymous. If I follow a similar process from Android code, the user doesn't remain anonymous (the desired result).
See user bF2wHKAFDM in the screenshot, it does have the username set from the code below, but still is an anonymous user.
What do I need to do to make this user not anonymous?
Thanks! Alex
Parse.Cloud.define('requestPasswordResetInBackgroundAnonymous', function(request, response) {
var googleAccountQuery = new Parse.Query(GoogleAccount);
var email = request.params.email;
if (!email || !email.length)
response.error('Email parameter required');
Parse.Cloud.useMasterKey();
googleAccountQuery.equalTo('name', email);
googleAccountQuery.ascending('updatedAt'); // in case there are multiple
googleAccountQuery.first({
success: function(googleAccount) {
if (googleAccount) {
var account = googleAccount.get("account");
var userQuery = new Parse.Query(Parse.User);
userQuery.equalTo('account', account);
userQuery.ascending('updatedAt');
userQuery.first({
success: function(user) {
if (user) {
user.setUsername(email);
user.setPassword('Eq54mY914Tt4:2U7WIf28K+o4483xi3Y');
user.signUp(null, {
success: function() {
Parse.User.requestPasswordReset(email, {
success: function() {
response.success();
},
error: function(error) {
response.error('requestPasswordReset failed: ' + error.code + ', ' + error.message);
}
});
},
error: function(user, error) {
response.error('signup failed: ' + error.code + ', ' + error.message);
}
});
} else {
response.error('No ParseUser found for account: ' + account.id);
}
},
error: function(error) {
response.error('Error searching for ParseUser by account' + account.id + ': ' + error.code + ', ' + error.message);
}
});
} else {
response.error('No GoogleAccount found with email: ' + email);
}
},
error: function(error) {
response.error('Error searching for GoogleAccount with email' + email + ': ' + error.code + ', ' + error.message);
}
});
});
It would make life easier when working on projects not using browserify (or similar) if the browser dist files were published to npm.
EDIT: I should have mentioned that I meant when using npm 3 as a front end package manager.
since in the version 1.6.x
there were intreduce so many breaking changing it would be appropriate to bump to ver 2.0.0
.
those breaking changes can make lots of code breaks for NPM
users
edit: also using tags of release in this repository can be very helpful
I am getting the following error on IE10 and below when I attempt to retrieve a cashed user object or make any parse query
Object doesn't support property or method 'fromJSON'
the issue seems to be coming from line 832 in ParseUser.js
var current = ParseUser.fromJSON(userData);
After I changed the Parse version to 1.6.4, query.include stopped working and it is not including the data from the pointer. There was no changes to my code, only the Parse version. When I revert Parse version back to 1.6.2 query.include is works fine again, but I can't use 1.6.2 because of the Relations bug that was fixed on 1.6.4.
ref: https://developers.facebook.com/bugs/1478633002464123/
We have just upgraded from 1.5.0 to 1.6.2. ParseUser has a pointer to a Profile for that user, and the Profile has a pointer back to the ParseUser it belongs to. When the user logs out and logs back in again (i.e. you call Parse.User.logIn(...)
and then Parse.User.logout
and then Parse.User.logIn(...)
again), we get this error:
What's happening is that when Parse.User.logIn
is called, setCurrentUser
calls user.toJSON()
. The first time this happens, encode
is called on the Profile
pointer in the user object, and this encodes the Profile
object by returning value.toPointer()
. However, when I log out and log back in with the same user, this doesn't happen, because when getState
is called for the Profile
object, both the objectCache
and serverData
elements of the state object contain values. So when encode
is called on the Profile
pointer, value._getServerData()
returns some content, and so it isn't encoded using value.toPointer()
. This is where the fatal recursion kicks off.
I can work around this issue by calling Parse.Object._clearAllState()
after Parse.User.logOut
. Can you advise whether this work-around is sufficient for us to upgrade to 1.6.2, or would there be potential undesirable side-effects?
For consistency with other promise libs I'm using it would be great if Parse promises were A+ compliant.
I see this has been anticipated, per
// We may want to expose this value at a later time, so that Promises/A+ style
// can be employed instead
var isPromisesAPlusCompliant = false;
Would be great if this was the default!
Thanks!
on older versions (Parse JS SDK <= 1.5.0
), i've used this hack (in the browser):
// Detect Parse session change in another tab
const STORAGE_KEY = `Parse/${Parse.applicationId}/currentUser`;
addEventListener('storage', function({ key, storageArea }) {
if ((storageArea === localStorage) && (key === STORAGE_KEY)) {
Parse.User._currentUser = null;
Parse.User._currentUserMatchesDisk = false;
Parse.User._currentAsync()
.fail(Parse.Promise.as)
.then(function() {
// ··· dispatch changed event if needed
});
}
}, false);
i think this ability can be useful for everyone, because it's nice when an app reacts to a session change in all tabs instead of seeing outdated version in another tab.
i think it this ability need a proper API rather than workaround. i understand it's also a tricky thing to implement because of the different platforms, but i can be possible if we extend ParseUser
class and SessionController
.
the bug feature of storage
event is that it only dispatches when the change happened on another tab's / window's Storage
object. what make this feature easier to apply.
I have a problem #159, parse-community/Parse-SDK-Android#159 (comment)
Hasn't been resolved in JS SDK 1.6.7, Android 1.10.3
Android Code
ParseCloud.callFunctionInBackground("schedule", new HashMap<String, Object>(), new FunctionCallback<List<Object>>() {
public void done(List<Object> itemList, ParseException e) {
if (e == null) {
arraySchedule.addAll(itemList);
} else {
Log.d("item", "Error: " + e.getMessage());
}
}
});
and it's work well in JavaScript.
Parse.Cloud.run('schedule', {}, {
success: function(results) {
// TODO
},
error: function(error) {
}
});
Cloud Code
Parse.Cloud.define("schedule", function(request, response) {
var ScheduleToday = Parse.Object.extend("LiveScheduleToday");
var scheduleTodayQuery = new Parse.Query(ScheduleToday);
scheduleTodayQuery.include("contentId");
scheduleTodayQuery.include("contentId.VodCategory");
scheduleTodayQuery.find().then( function(result) {
response.success(result);
});
});
Here is the adb log.
could not parse date: {"iso":"2015-10-16T02:33:11.095Z","__type":"Date"}
java.text.ParseException: Unparseable date: "{"iso":"2015-10-16T02:33:11.095Z","__type":"Date"}" (at offset 0)
at java.text.DateFormat.parse(DateFormat.java:555)
at com.parse.ParseDateFormat.parse(ParseDateFormat.java:42)
at com.parse.ParseObject.mergeFromServer(ParseObject.java:990)
at com.parse.ParseObject.fromJSON(ParseObject.java:686)
at com.parse.ParseDecoder.decode(ParseDecoder.java:125)
at com.parse.ParseDecoder.convertJSONArrayToList(ParseDecoder.java:45)
at com.parse.ParseDecoder.decode(ParseDecoder.java:71)
at com.parse.ParseCloudCodeController.convertCloudResponse(ParseCloudCodeController.java:52)
at com.parse.ParseCloudCodeController$1.then(ParseCloudCodeController.java:36)
at bolts.Task$14.run(Task.java:784)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:775)
at bolts.Task.continueWith(Task.java:574)
at bolts.Task.continueWith(Task.java:585)
at bolts.Task$12.then(Task.java:679)
at bolts.Task$12.then(Task.java:667)
at bolts.Task$15.run(Task.java:825)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:816)
at bolts.Task.access$200(Task.java:32)
at bolts.Task$11.then(Task.java:621)
at bolts.Task$11.then(Task.java:618)
at bolts.Task.runContinuations(Task.java:861)
at bolts.Task.access$600(Task.java:32)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:916)
at bolts.Task$TaskCompletionSource.setResult(Task.java:950)
at bolts.Task$15$1.then(Task.java:842)
at bolts.Task$15$1.then(Task.java:829)
at bolts.Task$14.run(Task.java:784)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:775)
at bolts.Task.continueWith(Task.java:574)
at bolts.Task.continueWith(Task.java:585)
at bolts.Task$15.run(Task.java:829)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:816)
at bolts.Task.access$200(Task.java:32)
at bolts.Task$11.then(Task.java:621)
at bolts.Task$11.then(Task.java:618)
at bolts.Task.runContinuations(Task.java:861)
at bolts.Task.access$600(Task.java:32)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:916)
at bolts.Task$TaskCompletionSource.setResult(Task.java:950)
at bolts.Task$15$1.then(Task.java:842)
at bolts.Task$15$1.then(Task.java:829)
at bolts.Task$14.run(Task.java:784)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:775)
at bolts.Task.continueWith(Task.java:574)
at bolts.Task.continueWith(Task.java:585)
at bolts.Task$15.run(Task.java:829)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
I am using the Javascript API to enable users to share an object from the app. This creates a sharable link.
What is failing?
It doesn't receive the "link" column/data (which is a string). All other columns come through fine (such as files, numbers, and other strings).
Is there a trick with Parse and sharing URL's?
My HTML is fine, I"ve pasted my javascript is here http://pastebin.com/wp0n4tNm
I don't seem to be able to get my Config object when calling Parse.Config in cloud code. I understand that the .get() method is asynchronous, and so may not be retrieved at the time of an HTTP request, but I figured I should be able to make a Config object a class variable, and set it on the success callback of the get() method.
From my testing, I don't seem to ever hit my callback (success or error) when calling Parse.Config.get()
Is this intended behavior? I am able to manage my Config object in client-side Javascript with no problems.
When I add a beforeSave function to my Parse hosted CloudCode, all fields in the class I'm saving get changed to undefined. It doesn't matter what I put in the beforeSave code. A simple function like:
Parse.Cloud.beforeSave("chart", function(request, response) {
console.log("Running beforesave")
response.success()
});
changes all fields to undefined. If I switch to JSSDK 1.5.0, everything works fine. So it appears to be a bug in 1.6.x and higher.
I have the following code
for (var i = 0; i < events.length; i++) {
var event = results[i];
var relation = event.relation("Artists");
var query3 = relation.query();
query3.find({
success: function(results) {
console.log("Successfully retrieved " + results.length + " results.");
if(results.length >0)
{
}
},
error: function(error) {
console.log("Error: " + error.code + " " + error.message);
}
});
} // End For Loop
events is returned from the another query, eveything works, but the relation object that is retrieved, is always empty (length 0). I think this is a bug in the code ... I'm using the latest SDK in Node
I'm seeing this error when I run my React Native app:
My observe() function:
observe: function() {
return {
user: ParseReact.currentUser,
current: new Parse.Query('Idea')
.equalTo('User', Parse.User.current())
.equalTo('State', Config.IDEA_STATES[Config.CURRENT]),
};
},
I tried using Parse.User.currentAsync(), but that returns a Promise instead of Parse.Object. How do I filter by current user in my subscription query?
_linkWith @ parse-latest.js:7350
success @ parse-latest.js:7370
exports.default.init._ParseUser2.default._registerAuthenticationProvider.authenticate.FB.login.scope @ parse-latest.js:504
window.FB.v.__wrapper @ sdk.js:98
window.FB.ea.permissions.oauth.transform @ sdk.js:118
window.FB.ia.prepareCall @ sdk.js:118
o @ sdk.js:119
window.FB.k.provide.login @ sdk.js:120
(anonymous function) @ sdk.js:100
(anonymous function) @ sdk.js:98
authenticate @ parse-latest.js:501
_linkWith @ parse-latest.js:7360
_logInWith @ parse-latest.js:7972
logIn @ parse-latest.js:599
$scope.login @ welcome.js:15
fn @ VM27794:4
(anonymous function) @ ionic.bundle.js:57514
parent.$get.Scope.$eval @ ionic.bundle.js:24673
parent.$get.Scope.$apply @ ionic.bundle.js:24772
(anonymous function) @ ionic.bundle.js:57513
eventHandler @ ionic.bundle.js:12098
triggerMouseEvent @ ionic.bundle.js:2865
tapClick @ ionic.bundle.js:2854
tapMouseUp @ ionic.bundle.js:2927
.
The custom analytics is not working anymore since October 6th.
Everything seems to be working nicely on the client side
curl -i 'https://api.parse.com/1/events/push_clicked' -H 'Origin: https://notifiche.repubblica.it' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' -H 'Content-Type: text/plain' -H 'Accept: */*' -H 'Referer: https://notifiche.repubblica.it/nazionale/redirect?redirect=http%3A%2F%2Flarep.it%2F1NOqUCn&kwnocache=907' -H 'Connection: keep-alive' --data-binary '{"dimensions":{"browser":"Chrome Desktop"},"_ApplicationId":"Value of ApplicationId","_JavaScriptKey":"Value of JavaScriptKey","_ClientVersion":"js1.4.2","_InstallationId":"a2a264b9-0a3c-e97e-caf4-2d140e6e53ab"}' --compressed HTTP/1.1 200 OK Access-Control-Allow-Methods: * Access-Control-Allow-Origin: * Content-Type: application/json; charset=utf-8 Date: Mon, 12 Oct 2015 15:04:38 GMT Server: nginx/1.6.0 X-Parse-Platform: G1 X-Runtime: 0.153381 Content-Length: 3 Connection: keep-alive
but on the Custom Analytics breakdown doesn't appear anything
In the afterSave of my parse object subclasses, I call .existed() on the request object.
I have had this code for quite a while, but only recently do existing object return false for .existed(). I tried to change the SDK to 1.6.2 and 1.6.0 but still ran into the same issue
I'm trying to save a Parse.com Object with a custom objectId, but the object is not saved at all. I'm using the Javascript API. Here is an example:
var newsfeed = new Parse.Object("Newsfeed");
newsfeed.id = 'customid';
newsfeed.save();
But when looking at the list of Newsfeed object on Parse data it is not there.
If this is not possible there should be at least an error message.
I don't know if this is the proper place, but this is the issue I'm having:
I want to implement my own authentication method (integrating with a 3rd party service), and for that I have Cloud Function that logs the user in and returns the session token, so that on the client I can call become
and effectively log that user in.
Before I enabled revokable sessions this worked fine because I was able to get the user then call user.getSessionToken()
and return it.
But after rovocable sessions were enabled the session tokens are always undefined
.
The only solution I was able to find is to manually re-login the user in CloudCode, but in order to do that I needed to know the user's password.
So the only was I was able to do it was by changing the user's password to a new random string every login so I could do it in CloudCode and return the session token?
I don't think it is a very good solution and I'm sure there has to be a better way.
Thanks!
I perform a query and get an array of parse objects. But when I try to return them using response.success(results), they get converted into just pointers. Here is the log just before I call response.success(results):
[{
"ans1Goals": 1,
"ans2Goals": 2,
"ansSpectators": 21400,
"createdAt": "2015-10-05T11:00:38.447Z",
"position": 1,
"updatedAt": "2015-10-27T10:18:55.294Z",
"objectId": "39QCu6oTBx"
}]
and this is what I receive from calling response.success(results):
[{
"__type": "Pointer",
"className": "Answers",
"objectId": "39QCu6oTBx"
}]
Why is this happening? On the client side, iOS and Android, we need the parse objects, otherwise with the pointers we will have to make another request to fetch the data. I don't want to return JSON because we have subclassed parse objects in iOS and Android and this should happen automatically, just like when we make queries directly from the clients. Having to parse JSON into ParseObjects defeats the purpose of subclassing in the first place. Thanks for any insight!
Hello. I'm mostly Android and iOS developer. I've always created my own backend for Android or iOS, so when I had some tables with pointers and I needed the information, I used to do my query
including keys by include(String string)
or the iOS version: [PFObject includeKey:NSString* key]
and I get my pointers fetched.
Now I'm trying to do another project, which envolves the Javascript SDK on CloudCode and the pointers were not being fetched at the end... for more details, please see my question on StackOverflow: http://stackoverflow.com/questions/33059768/parse-com-javascript-sdk-using-include-but-not-working?noredirect=1#comment54030428_33059768
Changing the file /path/to/parse_project/.parse.project
(hidden), I changed the "jssdk" : "latest"
for "jssdk" : "1.4.2"
so basically I downgraded my version, and it works perfectly now.
So I think it's a bug in the Javascript SDK.
I am running my CloudCode on a node.js server, using webhooks as described in a recent blog post on parse.com, and using CloudCode-Express.
Everything seems to run smooth, however in my beforeSave triggers I need to check if certain keys are dirty and they never are?
Parse.Cloud.beforeSave("CLASSNAME", function(request, response) {
console.log(request.object.dirtyKeys()); // always outputs an empty array to the console
if(request.object.dirty("key") && request.object.get("key")) { // value is a boolean
// never executes
}
});
Is this a bug, or am I doing something wrong? Running the same triggers on CloudCode on Parse.com (non-self-hosted), works as expected.
I was trying to login a user using following code from the docs:
<script src="http://www.parsecdn.com/js/parse-latest.js"></script>
Parse.User.logIn("myname", "mypass", {
success: function(user) {
// Do stuff after successful login.
},
error: function(user, error) {
// The login failed. Check error to see why.
}
});
The server returned 404 and the response was
{"code":101,"error":"invalid login parameters"}
I also found out that the sample todo app also has this issue.
Is there anything wrong with the login service?
Angular is one of the most popular front end frameworks nowadays. I would love to be able to use Parse in my Angular web app and not have to use third-party wrappers (or in my case, have to write your own)
Hi All,
I want to execute the following scenario:-
Below is my code:
query.first().then(function(results) {
// Create a trivial resolved promise as a base case.
var promise = Parse.Promise.as();
AnsPtr = results.get("AnsPtr");
//Max 10 Answers can be stored after that the answer will be overwritten.
AnsPtr = AnsPtr % 10;
console.log("new query succcess i got ansptr--"+AnsPtr);
return promise;
}).then(function(){ //Saving the content in the database
if(request.params.Answer != null )
{
Answer = request.params.Answer;
listing.set("Answer_"+AnsPtr, Answer);
// Increment the current value of the quantity key by 1
listing.increment("AnsPtr");
console.log("save contetnt failure i got ansptr--"+AnsPtr);
}
listing.save(null).then(function(listing) {
// The save was successful.
console.log("I saving");
}, function(error) {
// The save failed. Error is an instance of Parse.Error.
});
}).then(function(){
console.log("I am final succcess");
});
My Expectation:--
"12 new query succcess i got ansptr--"+AnsPtr);
"34--save contetnt failure i got ansptr--"+AnsPtr);
"56--I saving");
"78-I am final succcess");
Actual behavior:
"12 new query succcess i got ansptr--"+AnsPtr);
"34--save contetnt failure i got ansptr--"+AnsPtr);
"78-I am final succcess");
"56--I saving");
Please point me in case i misunderstood promises or missed something..
-Rajender Jindal
I am currently building an backbone app (items added to a table for each Google form submitted for review). I am on parse 1.2.13 JS SDK.
Migrating to 1.6 will obviously mess up my working code since there is no Collection class.
I am somewhat new to web development. Could someone let me know if Backbone support is in the works or if there is a simple workaround?
Thanks!
We have added a "joinCommunity" relation to the User object and use the following query.
new Parse.Query("User").matchesQuery("joinCommunity", new Parse.Query("Community").equalTo("objectId", "acMv7RpF1l")).find()
The above gives the following error in SDK v1.6.2:
{code: 102, message: "bad type for $inQuery"}
The SAME query works in v1.5.0.
This is a public discussion around the future of Parse.Promise
. As Promises are made more widely available in browsers and Node, we need to consider evolving the currently implementation to meet developer expectations and avoid fragmentation.
This document is simply a proposal, and is by no means a guarantee. We want to get developer feedback as we move the SDK forward, and we hope these discussion issues are a viable way to collect opinions on our proposals.
Parse.Promise
was originally built off of the jQuery Deferred model years ago, which means it's almost – but not quite – Promises/A+ compliant. There are a few differences, but the only one that really affects developers involves the handling of exceptions: A+ will catch an exception, while the Deferred model will propagate it upwards.
It turns out that Parse.Promise
contains code to adapt to A+ semantics. Internally, we have a flag called isAPlusCompliant
which is disabled by default (to maintain consistency with older versions). It's currently scoped within the module and inaccessible from userspace, but we could expose it through static methods or a CoreManager value. If we wish to move Parse.Promise
forward, this would be the first step.
While this would bring Parse Promises in line with the Promises/A+ spec, they would not match the behavior of Promises found in JS. This is because the A+ spec only covers how Promises behave when resolved; it does not dictate how Promises are constructed, resolved, or rejected.
A Parse Promise can be constructed with no parameters, and can be resolved or rejected by any code, as the resolution is performed by instance methods:
let myPromise = new Parse.Promise();
// do something...
myPromise.resolve();
Native JS Promises are constructed with a callback method. It is only within this method that the resolve / reject variables are available:
let myPromise = new Promise((resolve, reject) => {
// do something...
resolve();
});
As such, code written for one format may be difficult to rewrite into the other format. We would like to add functionality to Parse.Promise, allowing it to be constructed using the native Promise API. Supporting both styles will maintain functionality with older codebases, but allow new developers to use Parse.Promise in a way that matches the native implementation.
Eventually, we would rewrite the internals of the SDK to match this new format. We would also modify Parse.Promise to be backed by native Promises where supported, and continue to use our polyfill when it is not available.
isAPlusCompliant
flag externally, either through methods or a CoreManager value.isAPlusCompliant
set to true. This behavior can be disabled for legacy purposes, but it will be the default for all future versions.new Promise(callback)
)new Promise(callback)
interface.Hi,
I'm currently developing a method to carry out Unit tests on Cloud Code (Something I will probably open source), and was utilising parse-latest.js to include Parse specific functions.
Each time the repo is updated, are you able to include pre-built "parse-latest.js" files for React/Node/Browser, therefore users will not have the trouble of building the files through gulp each time?
Thanks,
is there bower package for ionic?
I tried to use Parse.1.6.2 and 1.6.4 today but found the when calling query.find.., objects were returned with only the classname and objectId info. All other columns were absent. Eg.
var Plan = Parse.Object.extend("Plan");
var query = new Parse.Query(Plan);
query.equalTo("user", Parse.User.current());
query.find({
success: function(allPlans) {
console.log(allPlans);
...
},
error: function(err1, err2) {
console.log(err1,err2);
}
});
In the success callback the collection printed to the console only contains objectId and className keys.
Is this a bug with the newer versions of this SDK or am I missing something?
Parse.User.current()
updates on save()
in the current session - but if you do a browser refresh (F5/CMD+R) the content is lost. The only way to update it is to force a logOut()
and then logIn()
again. Parse.user.current().fetch()
is supposed to bring the localStorage
up to date - but that is not happening.
Let me know if you need any more to reproduce.
We receive frequent timeouts, ECONNRESET, and ECONNREFUSED responses to Parse queries, saves, and updates. This is with Parse JS SDK 1.5.0 running on NodeJS 0.12.7, though we have experienced this issue for a while on our databases across various previous versions.
"Received an error with invalid JSON from Parse: Error: connect ETIMEDOUT\n at exports._errnoException (util.js:746:11)\n at TCPConnectWrap.afterConnect as oncomplete"
"Received an error with invalid JSON from Parse: Error: read ECONNRESET\n at exports._errnoException (util.js:746:11)\n at TCP.onread (net.js:559:26)"
"Received an error with invalid JSON from Parse: Error: connect ECONNREFUSED\n at exports._errnoException (util.js:746:11)\n at TCPConnectWrap.afterConnect as oncomplete"
We have no timeout issues with any of our other third party API calls, including logging and various mongodb stores. We've reviewed our maxSockets and other request() calls inside our own Node.JS code. We are normally processing 156 requests per minute, with 450 Parse JS SDK queries and saves per minute. We receive roughly 1 timeout or ECONN* message every 2 minutes.
I'm worried this will just be marked as "not a bug" of the JS SDK specifically, but we are having difficulty getting any feedback or support on these frequent issues through any of the Parse channels.
At approx. at line 100 in ParseUser.js, these lines
this._linkWith(provider, opts).then(() => {
promise.resolve(this);
});
recursively call _linkWith
and only handle the smooth sailing case. However, it's still possible for this error to happen { code=208, message="Another user is already linked to this facebook id."}
. A promise.reject
call is needed to propagate the error message.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.