shiki / kaiseki Goto Github PK
View Code? Open in Web Editor NEWA Parse.com REST API Client for Node.js
License: MIT License
A Parse.com REST API Client for Node.js
License: MIT License
Does this work with parse-server?
I am running parse server and a mongodb instance on a local device and using port forwarding. Will kaiseki work with this setup?
I try to save an object like so but I get back:
Code that can't seem to save an object
`
// instantiate kaiseki
var config = {
serverUrl: 'http://42.3.160.96:1337/parse',
applicationId: 'x',
// restAPIKey: 'x'
// masterKey: 'x' // optional
// mountPath: '/parse' // optional ("/parse" by default)
};
// var kaiseki = new Kaiseki(config);
var APP_ID = 'x';
var REST_API_KEY = 'x';
var kaiseki = new Kaiseki(config, REST_API_KEY);
//new tumblr to query
var blog = new tumblr.Blog('the-streetstyle.tumblr.com', oauth);
var tumblrAccount = {};
//username - profile picture - website for parse
blog.info(function (error, response) {
if (error) {
throw new Error(error);
}
console.log('blog.INFO.RES ------------');
console.log('blog.title ------------');
console.log(response.blog.title);
tumblrAccount.title = response.blog.title;
console.log('blog.user_name ------------');
console.log(response.blog.name);
tumblrAccount.user_name = response.blog.name;
console.log('blog.url ------------');
console.log(response.blog.url);
tumblrAccount.url = response.blog.url;
console.log('tumblrAccount ------------');
console.log(tumblrAccount);
// use kaiseki
var className = 'Tumblr';
kaiseki.createObject(className, tumblrAccount, function (err, res, body, success) {
console.log('object created = ', body);
console.log('object id = ', body.objectId);
});
});
blog.avatar(512, function (error, response) {
if (error) {
throw new Error(error);
}
console.log('blog.AVATAR.RES ------------');
console.log(response.avatar_url);
tumblrAccount.avatar_url = response.avatar_url;
});
`
CLI response below:
`
object created = { error: 'unauthorized' }
object id = undefined
`
First, thank you for this library. I switched from build headers, call each request myself and parse response to couple line of code.
However, I'm in callback hell now. Explicit naming all my callback function did solve the pyramid problem but a hell is still a hell when it is flat.
Can you switch to https://www.npmjs.com/package/request-promise I wonder? And return the promise to us so I can make my code readable.
Thank you very much!
Just reading the Parse API guide, it mentions:
To reduce the amount of time spent on network round trips, you can create, update, or delete up to 50 objects in one call, using the batch endpoint.
But reading kaiseki's source just now, it doesn't seem to do anything to handle or break up the batches in createObjects
or updateObjects
into groups of 50. Is this something you've run into or considered, @shiki?
Thanks!
Hi, i try to Send Push Notification with Segment Ex.
where: {
email:'[email protected]'
}
Dont work
Thanks
Is it possible to update objects via a query return?
Hi Shiki,
If I want to logout from parse database, Which API is need to call to logout from Parse.?
Could you help me on that.
Thanks in Advance.
I just read http://blog.parse.com/2012/10/11/the-javascript-sdk-in-node-js/ and am wondering what Kaiseki's purpose is... if any!
I'll explain my case, I need to init the library and then use the same instance on another files of the same server, lets say I've an express app and each controller its on different file, so the think is share the instance between all the controllers so I don't need to instantiate it.
I can do a pull request but better to listen what would be the inconvenient or if there is a better approach to this problem.
Regards
The cURL format is different than what is implemented for createObjects
. Perhaps this can be added.
After running Kaiseki for a while polling Parse variables I get this error.
" error socket hang up code 'econnreset' "
This seems to be related to this issue
http://stackoverflow.com/questions/18692580/node-js-post-causes-error-socket-hang-up-code-econnreset
Could a fix be implemented somewhere in the code?
When installing on ubuntu it fails with these errors:
"
npm ERR! Error: EACCES, mkdir '/home/_/.npm/underscore/1.5.2'
npm ERR! { [Error: EACCES, mkdir '/home/__/.npm/underscore/1.5.2']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/_**/.npm/underscore/1.5.2',
npm ERR! parent: 'kaiseki' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /media/_/data/__/my_code/_**
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.23
npm ERR! path /home/_/.npm/underscore/1.5.2
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/__/.npm/underscore/1.5.2'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /media/__/data/__/my_code/_**/npm-debug.log
npm ERR! not ok code 0
"
Would be great to see a changelog here. Usually they go in a History.md
folder. Example
Hi! Create or Update operations support relations column type? please, can write sample for me?
Tks!
Error isn't passed as first parameter.
client.loginUser('username', 'password', function (e, _, user) {
console.log(e, user)
})
// null { code: 101, error: 'invalid login parameters' }
I noticed that in order to make it work, we need to pass it as '_User'
I haven't tried it yet, but I'm assuming it would also be the same thing for the other default classes (Role, Session, Installation)
It would be great to have it taken care of automatically.
e.g.
if(className == 'User') className = '_' + className;
if(className == 'Role') className = '_' + className;
if(className == 'Session') className = '_' + className;
if(className == 'Installation') className = '_' + className;
in the countObject method.
Let me know what you think. I will PR it if it makes sense!
_\node_modules\kaiseki\lib\kaiseki.js:315
opts.callback(err, res, body, success);
^
TypeError: Property 'callback' of object # is not a function
at Request.Kaiseki._jsonRequest [as callback](****node
moduleskaisekilibkaiseki.js:315:12)
at Request.init.self.callback (__\node_modules\kaiseki\n
ode_modules\request\main.js:122:22)
at Request.EventEmitter.emit (events.js:99:17)
at Request. (__\node_modules\kaiseki\node_mod
ules\request\main.js:655:16)
at Request.EventEmitter.emit (events.js:126:20)
at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (*_*\node_modules\kaiseki\node_modules\request\main.js:617:14)
at IncomingMessage.EventEmitter.emit (events.js:126:20)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete as onMessageComplete
at CleartextStream.socketOnData as ondata
Please fix this issu! Or is there any fault im doing?
Call looks like:
kaiseki.sessionToken = body.sessionToken;
kaiseki.updateUser(email: '[email protected]'}, function(err, res, body, success) {
console.log(err);
console.log('updated at = ', body.updatedAt);
});
seems to be simple hope this get fixed! Thx for suppoting.
The ClassName parameter is in the definition, but missing from the example. It is added below:
kaiseki.deleteObject('Dogs', '<object-id>', function(err, res, body) {
if (res.statusCode == 200)
console.log('deleted!');
else
console.log('failed!');
});
I'm thinking of using this with Backbone.js on the server side with node, and as such would require a backbone.js sync adapter that uses it. Would be done as a separate project. What would your thoughts be on such a thing? The file stuff seems it could be an issue. Here is a client-side library that integrates backbone and parse together: https://github.com/neebz/backbone-parse
I'm trying to query posts from one specific month.
Current not working version:
var params = {
where: {
userId: userId,
dated: {
$gte: startDate,
$lte: endDate
}
},
order: 'dated'
}
kaiseki.getObjects('Posts', params, function(err, response, body, success) {
// ....
});
How do I achieve this in kaiseki?
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.