Skip to content

Commit a178883

Browse files
authored
Merge branch 'alpha' into allow-pointers
2 parents 8b1d7e7 + fd6a007 commit a178883

File tree

8 files changed

+73
-39
lines changed

8 files changed

+73
-39
lines changed

changelogs/CHANGELOG_alpha.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [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)
2+
3+
4+
### Bug Fixes
5+
6+
* 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))
7+
18
# [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)
29

310

package-lock.json

+52-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "6.1.0-alpha.12",
3+
"version": "6.1.0-alpha.13",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {
@@ -25,10 +25,10 @@
2525
"@graphql-tools/utils": "8.12.0",
2626
"@graphql-yoga/node": "2.6.0",
2727
"@parse/fs-files-adapter": "1.2.2",
28-
"@parse/push-adapter": "4.1.2",
28+
"@parse/push-adapter": "4.1.3",
2929
"bcryptjs": "2.4.3",
3030
"body-parser": "1.20.1",
31-
"commander": "5.1.0",
31+
"commander": "10.0.1",
3232
"cors": "2.8.5",
3333
"deepcopy": "2.1.0",
3434
"express": "4.18.2",
@@ -49,7 +49,7 @@
4949
"mongodb": "4.10.0",
5050
"mustache": "4.2.0",
5151
"parse": "4.0.1",
52-
"path-to-regexp": "0.1.7",
52+
"path-to-regexp": "6.2.1",
5353
"pg-monitor": "2.0.0",
5454
"pg-promise": "11.3.0",
5555
"pluralize": "8.0.0",

spec/CLI.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('commander additions', () => {
7474
done();
7575
});
7676

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

9291
it('should fail in action as port is invalid', done => {

src/Auth.js

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ const renewSessionIfNeeded = async ({ config, session, sessionToken }) => {
8484
{ sessionToken },
8585
{ limit: 1 }
8686
).execute();
87-
console.log({ results });
8887
session = results[0];
8988
}
9089
const lastUpdated = new Date(session?.updatedAt);

src/cli/utils/commander.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ Command.prototype.getOptions = function () {
136136
}, {});
137137
};
138138

139-
export default new Command();
139+
export default new Command().storeOptionsAsProperties();
140140
/* eslint-enable no-console */

src/cloud-code/Parse.Cloud.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ const getRoute = parseClass => {
8282
'@File': 'files',
8383
}[parseClass] || 'classes';
8484
if (parseClass === '@File') {
85-
return `/${route}/:id?*`;
85+
return `/${route}/:id?(.*)`;
8686
}
87-
return `/${route}/${parseClass}/:id?*`;
87+
return `/${route}/${parseClass}/:id?(.*)`;
8888
};
8989
/** @namespace
9090
* @name Parse

src/middlewares.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import MongoStorageAdapter from './Adapters/Storage/Mongo/MongoStorageAdapter';
99
import PostgresStorageAdapter from './Adapters/Storage/Postgres/PostgresStorageAdapter';
1010
import rateLimit from 'express-rate-limit';
1111
import { RateLimitOptions } from './Options/Definitions';
12-
import pathToRegexp from 'path-to-regexp';
12+
import { pathToRegexp } from 'path-to-regexp';
1313
import ipRangeCheck from 'ip-range-check';
1414
import RedisStore from 'rate-limit-redis';
1515
import { createClient } from 'redis';
@@ -512,8 +512,12 @@ export const addRateLimit = (route, config, cloud) => {
512512
},
513513
});
514514
}
515+
let transformPath = route.requestPath.split('/*').join('/(.*)');
516+
if (transformPath === '*') {
517+
transformPath = '(.*)';
518+
}
515519
config.rateLimits.push({
516-
path: pathToRegexp(route.requestPath),
520+
path: pathToRegexp(transformPath),
517521
handler: rateLimit({
518522
windowMs: route.requestTimeWindow,
519523
max: route.requestCount,

0 commit comments

Comments
 (0)