Skip to content

Commit

Permalink
Merge branch 'alpha' into allow-pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza authored May 25, 2023
2 parents 8b1d7e7 + fd6a007 commit a178883
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 39 deletions.
7 changes: 7 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [6.1.0-alpha.13](https://github.com/parse-community/parse-server/compare/6.1.0-alpha.12...6.1.0-alpha.13) (2023-05-25)


### Bug Fixes

* Rate limit feature is incompatible with Node 14 ([#8578](https://github.com/parse-community/parse-server/issues/8578)) ([f911f2c](https://github.com/parse-community/parse-server/commit/f911f2cd3a8c45cd326272dcd681532764a3761e))

# [6.1.0-alpha.12](https://github.com/parse-community/parse-server/compare/6.1.0-alpha.11...6.1.0-alpha.12) (2023-05-19)


Expand Down
79 changes: 52 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parse-server",
"version": "6.1.0-alpha.12",
"version": "6.1.0-alpha.13",
"description": "An express module providing a Parse-compatible API server",
"main": "lib/index.js",
"repository": {
Expand All @@ -25,10 +25,10 @@
"@graphql-tools/utils": "8.12.0",
"@graphql-yoga/node": "2.6.0",
"@parse/fs-files-adapter": "1.2.2",
"@parse/push-adapter": "4.1.2",
"@parse/push-adapter": "4.1.3",
"bcryptjs": "2.4.3",
"body-parser": "1.20.1",
"commander": "5.1.0",
"commander": "10.0.1",
"cors": "2.8.5",
"deepcopy": "2.1.0",
"express": "4.18.2",
Expand All @@ -49,7 +49,7 @@
"mongodb": "4.10.0",
"mustache": "4.2.0",
"parse": "4.0.1",
"path-to-regexp": "0.1.7",
"path-to-regexp": "6.2.1",
"pg-monitor": "2.0.0",
"pg-promise": "11.3.0",
"pluralize": "8.0.0",
Expand Down
3 changes: 1 addition & 2 deletions spec/CLI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('commander additions', () => {
done();
});

it('should load properly use args over env', done => {
it('should load properly use args over env', () => {
commander.loadDefinitions(testDefinitions);
commander.parse(['node', './CLI.spec.js', '--arg0', 'arg0Value', '--arg4', ''], {
PROGRAM_ARG_0: 'arg0ENVValue',
Expand All @@ -86,7 +86,6 @@ describe('commander additions', () => {
expect(commander.arg1).toEqual('arg1ENVValue');
expect(commander.arg2).toEqual(4);
expect(commander.arg4).toEqual('');
done();
});

it('should fail in action as port is invalid', done => {
Expand Down
1 change: 0 additions & 1 deletion src/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ const renewSessionIfNeeded = async ({ config, session, sessionToken }) => {
{ sessionToken },
{ limit: 1 }
).execute();
console.log({ results });
session = results[0];
}
const lastUpdated = new Date(session?.updatedAt);
Expand Down
2 changes: 1 addition & 1 deletion src/cli/utils/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@ Command.prototype.getOptions = function () {
}, {});
};

export default new Command();
export default new Command().storeOptionsAsProperties();
/* eslint-enable no-console */
4 changes: 2 additions & 2 deletions src/cloud-code/Parse.Cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ const getRoute = parseClass => {
'@File': 'files',
}[parseClass] || 'classes';
if (parseClass === '@File') {
return `/${route}/:id?*`;
return `/${route}/:id?(.*)`;
}
return `/${route}/${parseClass}/:id?*`;
return `/${route}/${parseClass}/:id?(.*)`;
};
/** @namespace
* @name Parse
Expand Down
8 changes: 6 additions & 2 deletions src/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import MongoStorageAdapter from './Adapters/Storage/Mongo/MongoStorageAdapter';
import PostgresStorageAdapter from './Adapters/Storage/Postgres/PostgresStorageAdapter';
import rateLimit from 'express-rate-limit';
import { RateLimitOptions } from './Options/Definitions';
import pathToRegexp from 'path-to-regexp';
import { pathToRegexp } from 'path-to-regexp';
import ipRangeCheck from 'ip-range-check';
import RedisStore from 'rate-limit-redis';
import { createClient } from 'redis';
Expand Down Expand Up @@ -512,8 +512,12 @@ export const addRateLimit = (route, config, cloud) => {
},
});
}
let transformPath = route.requestPath.split('/*').join('/(.*)');
if (transformPath === '*') {
transformPath = '(.*)';
}
config.rateLimits.push({
path: pathToRegexp(route.requestPath),
path: pathToRegexp(transformPath),
handler: rateLimit({
windowMs: route.requestTimeWindow,
max: route.requestCount,
Expand Down

0 comments on commit a178883

Please sign in to comment.