Skip to content

Commit 559562a

Browse files
committed
fix: bump deps, fixed middleware order
1 parent 849d0b1 commit 559562a

File tree

3 files changed

+64
-64
lines changed

3 files changed

+64
-64
lines changed

index.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,16 @@ class API {
7878
// specify that this is our api (used by error handler)
7979
app.context.api = true;
8080

81-
// allow before hooks to get setup
82-
if (_.isFunction(this.config.hookBeforeSetup))
83-
this.config.hookBeforeSetup(app);
84-
85-
// rate limiting
86-
if (this.config.rateLimit)
87-
app.use(
88-
ratelimit({
89-
...this.config.rateLimit,
90-
db: client
91-
})
92-
);
93-
94-
// basic auth
95-
if (this.config.auth) app.use(auth(this.config.auth));
81+
// adds request received hrtime and date symbols to request object
82+
// (which is used by Cabin internally to add `request.timestamp` to logs
83+
app.use(requestReceived);
9684

9785
// configure timeout
9886
if (this.config.timeout) {
9987
const timeout = new Timeout(this.config.timeout);
10088
app.use(timeout.middleware);
10189
}
10290

103-
// adds request received hrtime and date symbols to request object
104-
// (which is used by Cabin internally to add `request.timestamp` to logs
105-
app.use(requestReceived);
106-
10791
// adds `X-Response-Time` header to responses
10892
app.use(koaConnect(responseTime()));
10993

@@ -113,7 +97,26 @@ class API {
11397
// use the cabin middleware (adds request-based logging and helpers)
11498
app.use(cabin.middleware);
11599

116-
// setup localization
100+
// allow before hooks to get setup
101+
if (_.isFunction(this.config.hookBeforeSetup))
102+
this.config.hookBeforeSetup(app);
103+
104+
// basic auth
105+
if (this.config.auth) app.use(auth(this.config.auth));
106+
107+
// rate limiting
108+
if (this.config.rateLimit)
109+
app.use(
110+
ratelimit({
111+
...this.config.rateLimit,
112+
db: client
113+
})
114+
);
115+
116+
// remove trailing slashes
117+
app.use(removeTrailingSlashes());
118+
119+
// i18n
117120
if (this.config.i18n) {
118121
const i18n = this.config.i18n.config
119122
? this.config.i18n
@@ -130,9 +133,6 @@ class API {
130133
// cors
131134
if (this.config.cors) app.use(cors(this.config.cors));
132135

133-
// remove trailing slashes
134-
app.use(removeTrailingSlashes());
135-
136136
// body parser
137137
app.use(bodyParser());
138138

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
],
2222
"dependencies": {
2323
"@koa/router": "^9.4.0",
24-
"@ladjs/i18n": "^5.0.0",
24+
"@ladjs/i18n": "^6.0.0",
2525
"@ladjs/redis": "^1.0.7",
2626
"@ladjs/shared-config": "^3.0.9",
2727
"@ladjs/store-ip-address": "^0.0.7",

yarn.lock

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -370,23 +370,23 @@
370370
resolved "https://registry.yarnpkg.com/@ladjs/format-util/-/format-util-1.0.4.tgz#dd16ecee7b9d1deb56e1a4968dc5e9ac54499df3"
371371
integrity sha512-hZere0rUga8kTzSTFbHREXpD9E/jwi94+B5RyLAmMIzl/w/EK1z7rFEnMHzPkU4AZkL42JWSsGXoV8LXMihybg==
372372

373-
"@ladjs/i18n@^5.0.0":
374-
version "5.0.0"
375-
resolved "https://registry.yarnpkg.com/@ladjs/i18n/-/i18n-5.0.0.tgz#e64c71988d7b554befbcf36eb0c9a0dc0184b1d4"
376-
integrity sha512-O1K7vRjr3mp+VImM6ObHrFVBAC1QLFFFD+mYyLF1YI4ZvBlnB6f0rttk7BQSlndzpX6qKLrYe41Ac7J07qyp/w==
373+
"@ladjs/i18n@^6.0.0":
374+
version "6.0.0"
375+
resolved "https://registry.yarnpkg.com/@ladjs/i18n/-/i18n-6.0.0.tgz#a7128d273b4ff1799f8946f99f7521b70a35dace"
376+
integrity sha512-iFtWnxks7k7SmWRnmF9x/8y3QWwC3baw/JEutHN4ql9PVWVHjq3+JhWKVNbMCAjmbT1f08Hy8SMg1wAhEdlyCA==
377377
dependencies:
378378
"@hapi/boom" "^9.1.0"
379379
boolean "3.0.1"
380380
country-language "^0.1.7"
381381
debug "^4.1.1"
382-
i18n "^0.9.1"
382+
i18n "^0.13.2"
383383
i18n-locales "^0.0.4"
384-
lodash "^4.17.15"
384+
lodash "^4.17.20"
385385
multimatch "^4.0.0"
386386
punycode "^2.1.1"
387387
qs "^6.9.4"
388388
titleize "^2.1.0"
389-
tlds "^1.207.0"
389+
tlds "^1.209.0"
390390

391391
"@ladjs/redis@^1.0.7":
392392
version "1.0.7"
@@ -1911,20 +1911,20 @@ date-time@^3.1.0:
19111911
dependencies:
19121912
time-zone "^1.0.0"
19131913

1914-
debug@*, debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
1915-
version "4.1.1"
1916-
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
1917-
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
1918-
dependencies:
1919-
ms "^2.1.1"
1920-
19211914
[email protected], debug@~3.1.0:
19221915
version "3.1.0"
19231916
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
19241917
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
19251918
dependencies:
19261919
ms "2.0.0"
19271920

1921+
debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
1922+
version "4.1.1"
1923+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
1924+
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
1925+
dependencies:
1926+
ms "^2.1.1"
1927+
19281928
debug@^2.2.0, debug@^2.3.3, debug@^2.6.9:
19291929
version "2.6.9"
19301930
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@@ -2536,9 +2536,9 @@ eslint-plugin-unicorn@^21.0.0:
25362536
semver "^7.3.2"
25372537

25382538
eslint-rule-docs@^1.1.5:
2539-
version "1.1.206"
2540-
resolved "https://registry.yarnpkg.com/eslint-rule-docs/-/eslint-rule-docs-1.1.206.tgz#bdbe29583467f3a39362dd3f8c9c166bdbce6741"
2541-
integrity sha512-xEHu3DuY/3rAhyp6Hg3zrMWvpNYE7ez3DaV7ywlLBmqaybnjbYtZnU7b+xY5V3sjPwhqrj27sqjM0vxkFIBEWg==
2539+
version "1.1.207"
2540+
resolved "https://registry.yarnpkg.com/eslint-rule-docs/-/eslint-rule-docs-1.1.207.tgz#10335f70ccf4c79b0ba9ed615a7c7885afd50b8e"
2541+
integrity sha512-A+rSYw8plVDCvGVBaml6c3zIeuMMh7Cg1wu+haJc8ZLlTVdza813r0gKkZxTmNntZ6a1xlpZN7OQZCWpjrQ5yw==
25422542

25432543
eslint-scope@^5.0.0, eslint-scope@^5.1.0:
25442544
version "5.1.0"
@@ -3472,13 +3472,13 @@ i18n-locales@^0.0.4:
34723472
dependencies:
34733473
country-language "^0.1.7"
34743474

3475-
i18n@^0.9.1:
3476-
version "0.9.1"
3477-
resolved "https://registry.yarnpkg.com/i18n/-/i18n-0.9.1.tgz#a9dda09e582286c81a584374ac9f2aaef7ec37fb"
3478-
integrity sha512-ERo9WloOP2inRsJzAlzn4JDm3jvX7FW1+KB/JGXTzUVzi9Bsf4LNLXUQTMgM/aze4LNW/kvmxQX6bzg5UzqMJw==
3475+
i18n@^0.13.2:
3476+
version "0.13.2"
3477+
resolved "https://registry.yarnpkg.com/i18n/-/i18n-0.13.2.tgz#3886678fe7cbbed45bac2ce53b8144c788a1c1b5"
3478+
integrity sha512-PB65bHhQESMBIl/xVNChEAzoxZ5W6FrZ1H9Ma/YcPeSfE7VS9b0sqwBPusa0CfzSKUPSl+uMhRIgyv3jkE7XNw==
34793479
dependencies:
3480-
debug "*"
3481-
make-plural "^6.2.1"
3480+
debug "^4.1.1"
3481+
make-plural "^6.2.2"
34823482
math-interval-parser "^2.0.1"
34833483
messageformat "^2.3.0"
34843484
mustache "^4.0.1"
@@ -4470,9 +4470,9 @@ [email protected]:
44704470
stringify-object "^3.3.0"
44714471

44724472
listr2@^2.6.0:
4473-
version "2.6.1"
4474-
resolved "https://registry.yarnpkg.com/listr2/-/listr2-2.6.1.tgz#fbbabd8eea723924df7530042c1990b346e81706"
4475-
integrity sha512-1aPX9GkS+W0aHfPUDedJqeqj0DOe1605NaNoqdwEYw/UF2UbZgCIIMpXXZALeG/8xzwMBztguzQEubU5Xw1Qbw==
4473+
version "2.6.2"
4474+
resolved "https://registry.yarnpkg.com/listr2/-/listr2-2.6.2.tgz#4912eb01e1e2dd72ec37f3895a56bf2622d6f36a"
4475+
integrity sha512-6x6pKEMs8DSIpA/tixiYY2m/GcbgMplMVmhQAaLFxEtNSKLeWTGjtmU57xvv6QCm2XcqzyNXL/cTSVf4IChCRA==
44764476
dependencies:
44774477
chalk "^4.1.0"
44784478
cli-truncate "^2.1.0"
@@ -4676,7 +4676,7 @@ make-plural@^4.3.0:
46764676
optionalDependencies:
46774677
minimist "^1.2.0"
46784678

4679-
make-plural@^6.2.1:
4679+
make-plural@^6.2.2:
46804680
version "6.2.2"
46814681
resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-6.2.2.tgz#beb5fd751355e72660eeb2218bb98eec92853c6c"
46824682
integrity sha512-8iTuFioatnTTmb/YJjywkVIHLjcwkFD9Ms0JpxjEm9Mo8eQYkh1z+55dwv4yc1jQ8ftVBxWQbihvZL1DfzGGWA==
@@ -4818,9 +4818,9 @@ [email protected]:
48184818
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
48194819

48204820
mem@^6.1.0:
4821-
version "6.1.0"
4822-
resolved "https://registry.yarnpkg.com/mem/-/mem-6.1.0.tgz#846eca0bd4708a8f04b9c3f3cd769e194ae63c5c"
4823-
integrity sha512-RlbnLQgRHk5lwqTtpEkBTQ2ll/CG/iB+J4Hy2Wh97PjgZgXgWJWrFF+XXujh3UUVLvR4OOTgZzcWMMwnehlEUg==
4821+
version "6.1.1"
4822+
resolved "https://registry.yarnpkg.com/mem/-/mem-6.1.1.tgz#ea110c2ebc079eca3022e6b08c85a795e77f6318"
4823+
integrity sha512-Ci6bIfq/UgcxPTYa8dQQ5FY3BzKkT894bwXWXxC/zqs0XgMO2cT20CGkOqda7gZNkmK5VP4x89IGZ6K7hfbn3Q==
48244824
dependencies:
48254825
map-age-cleaner "^0.1.3"
48264826
mimic-fn "^3.0.0"
@@ -4836,9 +4836,9 @@ memory-pager@^1.0.2:
48364836
integrity sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==
48374837

48384838
meow@^7.0.0, meow@^7.0.1:
4839-
version "7.1.0"
4840-
resolved "https://registry.yarnpkg.com/meow/-/meow-7.1.0.tgz#50ecbcdafa16f8b58fb7eb9675b933f6473b3a59"
4841-
integrity sha512-kq5F0KVteskZ3JdfyQFivJEj2RaA8NFsS4+r9DaMKLcUHpk5OcHS3Q0XkCXONB1mZRPsu/Y/qImKri0nwSEZog==
4839+
version "7.1.1"
4840+
resolved "https://registry.yarnpkg.com/meow/-/meow-7.1.1.tgz#7c01595e3d337fcb0ec4e8eed1666ea95903d306"
4841+
integrity sha512-GWHvA5QOcS412WCo8vwKDlTelGLsCGBVevQB5Kva961rmNfun0PCbv5+xta2kUMFJyR8/oWnn7ddeKdosbAPbA==
48424842
dependencies:
48434843
"@types/minimist" "^1.2.0"
48444844
camelcase-keys "^6.2.2"
@@ -7568,9 +7568,9 @@ superagent@^3.8.3:
75687568
readable-stream "^2.3.5"
75697569

75707570
superagent@^6.0.0:
7571-
version "6.0.0"
7572-
resolved "https://registry.yarnpkg.com/superagent/-/superagent-6.0.0.tgz#882a73dcdf4ce2b9f5abaea01e9064585d5c7072"
7573-
integrity sha512-gBiyDSUR3zbYO8za+MudSNxMFSOhKcZfQ1Anya1DWzk9R32zl++cYUFHXzP3VnyvQO8h/1/uPPA9FUDDtE+qdA==
7571+
version "6.1.0"
7572+
resolved "https://registry.yarnpkg.com/superagent/-/superagent-6.1.0.tgz#09f08807bc41108ef164cfb4be293cebd480f4a6"
7573+
integrity sha512-OUDHEssirmplo3F+1HWKUrUjvnQuA+nZI6i/JJBdXb5eq9IyEQwPyPpqND+SSsxf6TygpBEkUjISVRN4/VOpeg==
75747574
dependencies:
75757575
component-emitter "^1.3.0"
75767576
cookiejar "^2.1.2"
@@ -7739,7 +7739,7 @@ titleize@^2.1.0:
77397739
resolved "https://registry.yarnpkg.com/titleize/-/titleize-2.1.0.tgz#5530de07c22147a0488887172b5bd94f5b30a48f"
77407740
integrity sha512-m+apkYlfiQTKLW+sI4vqUkwMEzfgEUEYSqljx1voUE3Wz/z1ZsxyzSxvH2X8uKVrOp7QkByWt0rA6+gvhCKy6g==
77417741

7742-
tlds@^1.207.0:
7742+
tlds@^1.209.0:
77437743
version "1.209.0"
77447744
resolved "https://registry.yarnpkg.com/tlds/-/tlds-1.209.0.tgz#13cfdc039331d49730ca7bfa9526fc9b319e2cec"
77457745
integrity sha512-KVsZ1NSpBodpo42/JIwTyau7SqUxV/qQMp2epSDPa99885LpHWLaVCCt8CWzGe4X5YIVNr+b6bUys9e9eEb5OA==
@@ -8176,9 +8176,9 @@ update-notifier@^4.1.0, update-notifier@^4.1.1:
81768176
xdg-basedir "^4.0.0"
81778177

81788178
uri-js@^4.2.2:
8179-
version "4.2.2"
8180-
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
8181-
integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==
8179+
version "4.4.0"
8180+
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602"
8181+
integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==
81828182
dependencies:
81838183
punycode "^2.1.0"
81848184

0 commit comments

Comments
 (0)