Skip to content

Commit ea7bf51

Browse files
authored
Merge branch 'alpha' into upgrade-lru
2 parents afbed03 + b0b99e7 commit ea7bf51

File tree

6 files changed

+60
-32
lines changed

6 files changed

+60
-32
lines changed

package-lock.json

Lines changed: 47 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 2 deletions
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/cli/utils/commander.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 6 additions & 2 deletions
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.replaceAll('/*', '/(.*)');
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)