Compare commits

...
25 Commits
Author SHA1 Message Date
Fosco Marotto 522abdf606 Updated to 2.0.3 2016-01-30 17:01:13 -08:00
Fosco Marotto 740332bc81 Fixed facebook login issue. 2016-01-30 17:00:51 -08:00
Fosco Marotto 82e183cbc9 Merge pull request #89 from ParsePlatform/fosco.schema
Added another map/object fix
2016-01-30 16:23:26 -08:00
Fosco Marotto 44ee117327 Added another map/object fix 2016-01-30 16:22:35 -08:00
Fosco Marotto a58c0dcd01 Updated to 2.0.2 2016-01-30 15:53:46 -08:00
Fosco Marotto 523fa3149e Merge pull request #86 from ParsePlatform/fosco.fb
Updated Facebook login method
2016-01-30 15:51:50 -08:00
Fosco Marotto 4b48e01f4b Merge pull request #87 from ParsePlatform/fosco.map
Added map to schema object types, fixed expiresAt
2016-01-30 15:51:40 -08:00
Fosco Marotto 78b20d3b43 Updates for session usage 2016-01-30 15:50:54 -08:00
Fosco Marotto 859333b311 Added map to schema object types 2016-01-30 15:42:11 -08:00
Fosco Marotto f05fb7d9fd Updated Facebook login method 2016-01-30 15:20:44 -08:00
Fosco Marotto 774de7b4c6 Merge pull request #57 from skinp/spdx-licence
Make license SPDX compatible in package.json
2016-01-29 15:01:20 -08:00
Fosco Marotto dc1909cbf5 Merge pull request #54 from CWalig/patch-1
Change the file size limit to 20mb
2016-01-29 14:56:14 -08:00
Patrick Pelletier 585770ddc4 Make license SPDX compatible in package.json 2016-01-29 14:23:58 -08:00
CWalig c34b6b9bf4 Update file size limit to 20mb
Update file size limit to 20mb
2016-01-30 10:53:09 +13:00
Fosco Marotto 7c88d16ef0 Updated to 2.0.1 2016-01-29 12:51:11 -08:00
Fosco Marotto d2fbb7c4f6 Merge pull request #23 from allevo/allevo-patch-1
Use test instead of match
2016-01-29 12:48:27 -08:00
Fosco Marotto 82309f7b66 Merge pull request #46 from ParsePlatform/fosco.dev
Added engines tag to package.json
2016-01-29 11:52:15 -08:00
Fosco Marotto 66184ed645 Added engines tag to package.json 2016-01-29 11:51:34 -08:00
Fosco Marotto 67340f1353 Merge pull request #44 from ParsePlatform/fosco.dev
Added _email_verify_token to ignored fields in transform.js
2016-01-29 10:51:46 -08:00
Fosco Marotto dfe68237a2 Added _email_verify_token to ignored fields in transform.js 2016-01-29 10:51:13 -08:00
Tommaso Allevi 49acd65520 Use test instead of match
For spead reason
2016-01-29 10:46:29 +01:00
Fosco Marotto a9aed0cacd Update README.md 2016-01-28 22:33:37 -08:00
Fosco Marotto ec8ce3c479 Merge pull request #2 from TylerBrock/patch-2
Add JS Syntax Highlighting to README.md code block
2016-01-28 15:26:42 -08:00
Tyler Brock 2f2a8062ce Add JS Syntax Highlighting to README.md code block 2016-01-28 15:23:30 -08:00
Fosco Marotto 0bad16d34c Updated README 2016-01-28 15:04:21 -08:00
11 changed files with 54 additions and 14 deletions
+1
View File
@@ -20,6 +20,7 @@ function Config(applicationId, mount) {
this.dotNetKey = cacheInfo.dotNetKey;
this.restAPIKey = cacheInfo.restAPIKey;
this.fileKey = cacheInfo.fileKey;
this.facebookAppIds = cacheInfo.facebookAppIds;
this.mount = mount;
}
+4 -2
View File
@@ -44,14 +44,16 @@ ExportAdapter.prototype.connect = function() {
// Returns a promise for a Mongo collection.
// Generally just for internal use.
var joinRegex = /^_Join:[A-Za-z0-9_]+:[A-Za-z0-9_]+/;
var otherRegex = /^[A-Za-z][A-Za-z0-9_]*$/;
ExportAdapter.prototype.collection = function(className) {
if (className !== '_User' &&
className !== '_Installation' &&
className !== '_Session' &&
className !== '_SCHEMA' &&
className !== '_Role' &&
!className.match(/^_Join:[A-Za-z0-9_]+:[A-Za-z0-9_]+/) &&
!className.match(/^[A-Za-z][A-Za-z0-9_]*$/)) {
!joinRegex.test(className) &&
!otherRegex.test(className)) {
throw new Parse.Error(Parse.Error.INVALID_CLASS_NAME,
'invalid className: ' + className);
}
+9 -2
View File
@@ -2,6 +2,12 @@
A Parse.com API compatible router package for Express
Read the announcement blog post here: http://blog.parse.com/announcements/introducing-parse-server-and-the-database-migration-tool/
Read the migration guide here: https://parse.com/docs/server/guide#migrating
There is a development wiki here on GitHub: https://github.com/ParsePlatform/parse-server/wiki
---
#### Basic options:
@@ -11,6 +17,7 @@ A Parse.com API compatible router package for Express
* masterKey (required) - The master key to use for overriding ACL security
* cloud - The absolute path to your cloud code main.js file
* fileKey - For migrated apps, this is necessary to provide access to files already hosted on Parse.
* facebookAppIds - An array of valid Facebook application IDs.
#### Client key options:
@@ -32,7 +39,7 @@ The client keys used with Parse are no longer necessary with parse-server. If y
You can create an instance of ParseServer, and mount it on a new or existing Express website:
```
```js
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
@@ -81,4 +88,4 @@ You can also set up an app on Parse, providing the connection string for your mo
### Not supported
* Push - We did not rebuild a new push delivery system for parse-server, but we are open to working on one together with the community.
* Push - We did not rebuild a new push delivery system for parse-server, but we are open to working on one together with the community.
+2 -3
View File
@@ -219,7 +219,7 @@ RestWrite.prototype.handleFacebookAuthData = function() {
return facebook.validateUserId(facebookData.id,
facebookData.access_token)
.then(() => {
return facebook.validateAppId(process.env.FACEBOOK_APP_ID,
return facebook.validateAppId(this.config.facebookAppIds,
facebookData.access_token);
}).then(() => {
// Check if this user already exists
@@ -283,8 +283,7 @@ RestWrite.prototype.transformUser = function() {
'action': 'login',
'authProvider': 'password'
},
restricted: false,
expiresAt: 0
restricted: false
};
var create = new RestWrite(this.config, Auth.master(this.config),
'_Session', null, sessionData);
+2
View File
@@ -138,6 +138,7 @@ Schema.prototype.validateField = function(className, key, type, freeze) {
var expected = this.data[className][key];
if (expected) {
expected = (expected === 'map' ? 'object' : expected);
if (expected === type) {
return Promise.resolve(this);
} else {
@@ -282,6 +283,7 @@ function getType(obj) {
case 'string':
case 'number':
return type;
case 'map':
case 'object':
if (!obj) {
return undefined;
+7 -2
View File
@@ -16,10 +16,15 @@ function validateUserId(userId, access_token) {
}
// Returns a promise that fulfills iff this app id is valid.
function validateAppId(appId, access_token) {
function validateAppId(appIds, access_token) {
if (!appIds.length) {
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
'Facebook auth is not configured.');
}
return graphRequest('app?access_token=' + access_token)
.then((data) => {
if (data && data.id == appId) {
if (data && appIds.indexOf(data.id) != -1) {
return;
}
throw new Parse.Error(
+1 -1
View File
@@ -80,7 +80,7 @@ router.post('/files', function(req, res, next) {
// TODO: do we need to allow crossdomain and method override?
router.post('/files/:filename',
bodyParser.raw({type: '*/*'}),
bodyParser.raw({type: '*/*', limit: '20mb'}),
middlewares.handleParseHeaders,
processCreate);
+9 -1
View File
@@ -26,6 +26,8 @@ addParseCloud();
// "cloud": relative location to cloud code to require
// "appId": the application id to host
// "masterKey": the master key for requests to this app
// "facebookAppIds": an array of valid Facebook Application IDs, required
// if using Facebook login
// "collectionPrefix": optional prefix for database collection names
// "fileKey": optional key from Parse dashboard for supporting older files
// hosted by Parse
@@ -59,9 +61,15 @@ function ParseServer(args) {
javascriptKey: args.javascriptKey || '',
dotNetKey: args.dotNetKey || '',
restAPIKey: args.restAPIKey || '',
fileKey: args.fileKey || 'invalid-file-key'
fileKey: args.fileKey || 'invalid-file-key',
facebookAppIds: args.facebookAppIds || []
};
// To maintain compatibility. TODO: Remove in v2.1
if (process.env.FACEBOOK_APP_ID) {
cache.apps[args.appId]['facebookAppIds'].push(process.env.FACEBOOK_APP_ID);
}
// Initialize the node client SDK automatically
Parse.initialize(args.appId, args.javascriptKey || '', args.masterKey);
+5 -2
View File
@@ -1,13 +1,13 @@
{
"name": "parse-server",
"version": "2.0.0",
"version": "2.0.3",
"description": "An express module providing a Parse-compatible API server",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server"
},
"license": "BSD",
"license": "BSD-3-Clause",
"dependencies": {
"bcrypt": "~0.8",
"body-parser": "~1.12.4",
@@ -25,5 +25,8 @@
},
"scripts": {
"test": "TESTING=1 jasmine"
},
"engines": {
"node": ">=4.1"
}
}
+10
View File
@@ -46,6 +46,11 @@ function transformKeyValue(schema, className, restKey, restValue, options) {
case '_session_token':
key = '_session_token';
break;
case 'expiresAt':
case '_expiresAt':
key = '_expiresAt';
timeField = true;
break;
case '_rperm':
case '_wperm':
return {key: key, value: restValue};
@@ -628,6 +633,7 @@ function untransformObject(schema, className, mongoObject) {
restObject['password'] = mongoObject[key];
break;
case '_acl':
case '_email_verify_token':
case '_perishable_token':
break;
case '_session_token':
@@ -641,6 +647,10 @@ function untransformObject(schema, className, mongoObject) {
case '_created_at':
restObject['createdAt'] = Parse._encode(new Date(mongoObject[key])).iso;
break;
case 'expiresAt':
case '_expiresAt':
restObject['expiresAt'] = Parse._encode(new Date(mongoObject[key])).iso;
break;
case '_auth_data_anonymous':
restObject['authData'] = restObject['authData'] || {};
restObject['authData']['anonymous'] = mongoObject[key];
+4 -1
View File
@@ -55,6 +55,9 @@ function handleLogIn(req) {
user.sessionToken = token;
delete user.password;
var expiresAt = new Date();
expiresAt.setFullYear(expiresAt.getFullYear() + 1);
var sessionData = {
sessionToken: token,
user: {
@@ -67,7 +70,7 @@ function handleLogIn(req) {
'authProvider': 'password'
},
restricted: false,
expiresAt: 0,
expiresAt: Parse._encode(expiresAt).iso,
installationId: req.info.installationId
};
var create = new RestWrite(req.config, Auth.master(req.config),