Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
node-parse-api
Advanced tools
Readme
npm install node-parse-api
var Parse = require('node-parse-api').Parse;
var APP_ID = ...;
var MASTER_KEY = ...;
var app = new Parse(APP_ID, MASTER_KEY);
// add a Foo object, { foo: 'bar' }
app.insert('Foo', { foo: 'bar' }, function (err, response) {
console.log(response);
});
app.insertCustom('users', { foo: 'bar' }, function (err, response) {
console.log(response);
});
app.insertCustom('users', { foo: 'bar', location: {__type: 'GeoPoint', latitude: <int>, longitude: <int>} }, function (err, response) {
console.log(response);
});
app.insertFile(fileName, data, fileType, function (err, response) {
fileLink = response.url;
parseName = response.name;
app.insert('Foo', { "foo" : fileLink, "bar" : parseName }, function(erro, res){
})
});
// the Foo with id = 'someId'
app.find('Foo', 'someId', function (err, response) {
console.log(response);
});
// all Foo objects with foo = 'bar'
app.findMany('Foo', { foo: 'bar' }, function (err, response) {
console.log(response);
});
// all Foo objects
app.findMany('Foo', '', function (err, response) {
console.log(response);
}):
// just use findMany, and call results.length on the response
app.findMany('Foo', { user: '<objectId>' }, function (err, response) {
console.log(response.results.length);
});
app.update('Foo', 'someId', { foo: 'fubar' }, function (err, response) {
console.log(response);
});
app.delete('Foo', 'someId', function (err) {
// nothing to see here
});
app.deleteAll('Foo', function (err) {
// nothing to see here
});
//email is built into Parse's special User class
app.passwordReset(email, function(err, response){
console.log(response);
});
//email is built into Parse's special User class
app.updateUserEmail(objectId, email, function(err, response){
if (err) {
console.log(err);
} else {
console.log(response);
}
});
//first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId.
app.insertInstallationData("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", function(err, response){
if (err) {
console.log(err);
} else {
console.log(response);
}
});
//first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId. Third arg is the timezone string.
app.insertInstallationDataWithTimeZone("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "EST", function(err, response){
if (err) {
console.log(err);
} else {
console.log(response);
}
});
//first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId. Third arg is the channels array.
arr = ["news", "sports"];
app.insertInstallationDataWithChannels("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", arr, function(err, response){
if (err) {
console.log(err);
} else {
console.log(response);
}
});
//first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId. Third arg is the timezone string. 4th is the channels array.
arr = ["news", "sports"];
app.insertInstallationDataWithTimeZoneAndChannels("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "EST", arr, function(err, response){
if (err) {
console.log(err);
} else {
console.log(response);
}
});
//create a data object that links the user object's objectId to the role
var data = {
name: 'Administrator',
ACL: {
"*": {
"read": true
}
},
roles: {
"__op": "AddRelation",
"objects": [
{
"__type": "Pointer",
"className": "_Role",
"objectId": "<objectId>"
}
]
},
users: {
"__op": "AddRelation",
"objects": [
{
"__type": "Pointer",
"className": "_User",
"objectId": "<objectId>"
}
]
}
};
app.insertRole(data, function(err, resp){
console.log(resp);
});
//pass the role object's objectId
app.getRole("<objectId>", function(err, resp){
console.log(resp);
});
//pass the objectId of the role, data contains the user's objectId
var data = {
users: {
"__op": "RemoveRelation",
"objects": [
{
"__type": "Pointer",
"className": "_User",
"objectId": "<objectId>"
}
]
}
};
app.updateRole("<objectId>", data, function(err, resp){
console.log(resp);
});
//pass the objectId of the role
app.deleteRole("<objectId>", function(err, resp){});
app.getRoles(function(err, resp){});
var params = {
where: { name: "Administrator" }
};
app.getRoles(params, function(err, resp){
console.log(resp);
});
//The data param has to follow the data structure as described in the [Parse REST API](https://www.parse.com/docs/rest#push)
var notification = {
channels: [''],
data: {
alert: "sending too many push notifications is obnoxious"
}
};
app.sendPush(notification, function(err, resp){
console.log(resp);
});
//when inserting a data, you must use the Parse date object structure, i.e.:
{
"__type": "Date",
"iso": new Date("<year>", "<month>", "<day>").toJSON()
}
FAQs
A Parse.com REST API client for Node.js
The npm package node-parse-api receives a total of 2,933 weekly downloads. As such, node-parse-api popularity was classified as popular.
We found that node-parse-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.