@creator.co/wapi 1.9.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package-lock.json +172 -113
- package/dist/package.json +11 -8
- package/dist/src/Server/Router.d.ts +10 -9
- package/dist/src/Server/Router.js.map +1 -1
- package/dist/src/Server/lib/container/Proxy.js +24 -6
- package/dist/src/Server/lib/container/Proxy.js.map +1 -1
- package/dist/src/Validation/Validator.d.ts +3 -3
- package/dist/src/Validation/Validator.js +2 -2
- package/dist/src/Validation/Validator.js.map +1 -1
- package/package.json +11 -8
- package/src/Server/Router.ts +10 -9
- package/src/Server/lib/container/Proxy.ts +22 -7
- package/src/Validation/Validator.ts +3 -3
- package/tests/Server/lib/container/RateLimit.test.ts +137 -11
package/dist/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creator.co/wapi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@creator.co/wapi",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.10.0",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-dynamodb": "^3.730.0",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"cors": "^2.8.5",
|
|
26
26
|
"cuid": "^3.0.0",
|
|
27
27
|
"dotenv": "^16.4.1",
|
|
28
|
-
"email-templates": "^13.0.
|
|
29
|
-
"express": "^4.22.
|
|
28
|
+
"email-templates": "^13.0.1",
|
|
29
|
+
"express": "^4.22.2",
|
|
30
30
|
"express-rate-limit": "^7.5.0",
|
|
31
31
|
"json-stringify-safe": "^5.0.1",
|
|
32
32
|
"jsonwebtoken": "^9.0.2",
|
|
33
33
|
"knex": "^3.0.1",
|
|
34
34
|
"knex-stringcase": "^1.4.6",
|
|
35
|
-
"kysely": "^0.28.
|
|
35
|
+
"kysely": "^0.28.17",
|
|
36
36
|
"node-cache": "^5.1.2",
|
|
37
|
-
"nodemailer": "^8.0.
|
|
37
|
+
"nodemailer": "^8.0.5",
|
|
38
38
|
"object-hash": "^3.0.0",
|
|
39
39
|
"parse-duration": "^2.1.3",
|
|
40
40
|
"path-to-regexp": "^8.4.0",
|
|
@@ -42,8 +42,7 @@
|
|
|
42
42
|
"rate-limit-redis": "^4.2.0",
|
|
43
43
|
"redis": "^4.7.0",
|
|
44
44
|
"sha1": "^1.1.1",
|
|
45
|
-
"stack-trace": "0.0.10"
|
|
46
|
-
"zod": "^3.23.4"
|
|
45
|
+
"stack-trace": "0.0.10"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@go-task/cli": "^3.39.0",
|
|
@@ -74,7 +73,11 @@
|
|
|
74
73
|
"supertest": "^7.1.1",
|
|
75
74
|
"ts-jest": "^29.2.5",
|
|
76
75
|
"ts-node": "^10.9.1",
|
|
77
|
-
"typescript": "^5.5.0"
|
|
76
|
+
"typescript": "^5.5.0",
|
|
77
|
+
"zod": "^3.25.76"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"zod": "^3.23.4"
|
|
78
81
|
}
|
|
79
82
|
},
|
|
80
83
|
"node_modules/@ampproject/remapping": {
|
|
@@ -2633,19 +2636,6 @@
|
|
|
2633
2636
|
"go-npm": "bin/index.js"
|
|
2634
2637
|
}
|
|
2635
2638
|
},
|
|
2636
|
-
"node_modules/@hapi/boom": {
|
|
2637
|
-
"version": "10.0.1",
|
|
2638
|
-
"resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-10.0.1.tgz",
|
|
2639
|
-
"integrity": "sha512-ERcCZaEjdH3OgSJlyjVk8pHIFeus91CjKP3v+MpgBNp5IvGzP2l/bRiD78nqYcKPaZdbKkK5vDBVPd2ohHBlsA==",
|
|
2640
|
-
"dependencies": {
|
|
2641
|
-
"@hapi/hoek": "^11.0.2"
|
|
2642
|
-
}
|
|
2643
|
-
},
|
|
2644
|
-
"node_modules/@hapi/hoek": {
|
|
2645
|
-
"version": "11.0.7",
|
|
2646
|
-
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-11.0.7.tgz",
|
|
2647
|
-
"integrity": "sha512-HV5undWkKzcB4RZUusqOpcgxOaq6VOAH7zhhIr2g3G8NF/MlFO75SjOr2NfuSx0Mh40+1FqCkagKLJRykUWoFQ=="
|
|
2648
|
-
},
|
|
2649
2639
|
"node_modules/@humanwhocodes/config-array": {
|
|
2650
2640
|
"version": "0.11.14",
|
|
2651
2641
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
|
|
@@ -3256,35 +3246,36 @@
|
|
|
3256
3246
|
"version": "1.0.3",
|
|
3257
3247
|
"resolved": "https://registry.npmjs.org/@ladjs/country-language/-/country-language-1.0.3.tgz",
|
|
3258
3248
|
"integrity": "sha512-FJROu9/hh4eqVAGDyfL8vpv6Vb0qKHX1ozYLRZ+beUzD5xFf+3r0J+SVIWKviEa7W524Qvqou+ta1WrsRgzxGw==",
|
|
3249
|
+
"license": "MIT",
|
|
3259
3250
|
"engines": {
|
|
3260
3251
|
"node": ">= 14"
|
|
3261
3252
|
}
|
|
3262
3253
|
},
|
|
3263
3254
|
"node_modules/@ladjs/i18n": {
|
|
3264
|
-
"version": "
|
|
3265
|
-
"resolved": "https://registry.npmjs.org/@ladjs/i18n/-/i18n-
|
|
3266
|
-
"integrity": "sha512-
|
|
3255
|
+
"version": "10.0.0",
|
|
3256
|
+
"resolved": "https://registry.npmjs.org/@ladjs/i18n/-/i18n-10.0.0.tgz",
|
|
3257
|
+
"integrity": "sha512-t3NvAN+ClirgAxvN0Gu28x/RXNhQ9jtn+owPvap3O0DrcaDXwuQFr/DfJVQYw8FMBCzcHwkwdmlQ5DN6yH+QYA==",
|
|
3258
|
+
"license": "MIT",
|
|
3267
3259
|
"dependencies": {
|
|
3268
|
-
"@hapi/boom": "^10.0.0",
|
|
3269
3260
|
"@ladjs/country-language": "^1.0.1",
|
|
3270
|
-
"boolean": "3.2.0",
|
|
3271
3261
|
"i18n": "^0.15.0",
|
|
3272
3262
|
"i18n-locales": "^0.0.5",
|
|
3273
3263
|
"lodash": "^4.17.21",
|
|
3274
3264
|
"multimatch": "5",
|
|
3275
|
-
"punycode": "^2.
|
|
3276
|
-
"qs": "^6.
|
|
3265
|
+
"punycode": "^2.3.1",
|
|
3266
|
+
"qs": "^6.14.0",
|
|
3277
3267
|
"titleize": "2",
|
|
3278
|
-
"tlds": "^1.
|
|
3268
|
+
"tlds": "^1.261.0"
|
|
3279
3269
|
},
|
|
3280
3270
|
"engines": {
|
|
3281
|
-
"node": ">=
|
|
3271
|
+
"node": ">=18"
|
|
3282
3272
|
}
|
|
3283
3273
|
},
|
|
3284
3274
|
"node_modules/@messageformat/core": {
|
|
3285
3275
|
"version": "3.4.0",
|
|
3286
3276
|
"resolved": "https://registry.npmjs.org/@messageformat/core/-/core-3.4.0.tgz",
|
|
3287
3277
|
"integrity": "sha512-NgCFubFFIdMWJGN5WuQhHCNmzk7QgiVfrViFxcS99j7F5dDS5EP6raR54I+2ydhe4+5/XTn/YIEppFaqqVWHsw==",
|
|
3278
|
+
"license": "MIT",
|
|
3288
3279
|
"dependencies": {
|
|
3289
3280
|
"@messageformat/date-skeleton": "^1.0.0",
|
|
3290
3281
|
"@messageformat/number-skeleton": "^1.0.0",
|
|
@@ -3297,17 +3288,20 @@
|
|
|
3297
3288
|
"node_modules/@messageformat/date-skeleton": {
|
|
3298
3289
|
"version": "1.1.0",
|
|
3299
3290
|
"resolved": "https://registry.npmjs.org/@messageformat/date-skeleton/-/date-skeleton-1.1.0.tgz",
|
|
3300
|
-
"integrity": "sha512-rmGAfB1tIPER+gh3p/RgA+PVeRE/gxuQ2w4snFWPF5xtb5mbWR7Cbw7wCOftcUypbD6HVoxrVdyyghPm3WzP5A=="
|
|
3291
|
+
"integrity": "sha512-rmGAfB1tIPER+gh3p/RgA+PVeRE/gxuQ2w4snFWPF5xtb5mbWR7Cbw7wCOftcUypbD6HVoxrVdyyghPm3WzP5A==",
|
|
3292
|
+
"license": "MIT"
|
|
3301
3293
|
},
|
|
3302
3294
|
"node_modules/@messageformat/number-skeleton": {
|
|
3303
3295
|
"version": "1.2.0",
|
|
3304
3296
|
"resolved": "https://registry.npmjs.org/@messageformat/number-skeleton/-/number-skeleton-1.2.0.tgz",
|
|
3305
|
-
"integrity": "sha512-xsgwcL7J7WhlHJ3RNbaVgssaIwcEyFkBqxHdcdaiJzwTZAWEOD8BuUFxnxV9k5S0qHN3v/KzUpq0IUpjH1seRg=="
|
|
3297
|
+
"integrity": "sha512-xsgwcL7J7WhlHJ3RNbaVgssaIwcEyFkBqxHdcdaiJzwTZAWEOD8BuUFxnxV9k5S0qHN3v/KzUpq0IUpjH1seRg==",
|
|
3298
|
+
"license": "MIT"
|
|
3306
3299
|
},
|
|
3307
3300
|
"node_modules/@messageformat/parser": {
|
|
3308
3301
|
"version": "5.1.1",
|
|
3309
3302
|
"resolved": "https://registry.npmjs.org/@messageformat/parser/-/parser-5.1.1.tgz",
|
|
3310
3303
|
"integrity": "sha512-3p0YRGCcTUCYvBKLIxtDDyrJ0YijGIwrTRu1DT8gIviIDZru8H23+FkY6MJBzM1n9n20CiM4VeDYuBsrrwnLjg==",
|
|
3304
|
+
"license": "MIT",
|
|
3311
3305
|
"dependencies": {
|
|
3312
3306
|
"moo": "^0.5.1"
|
|
3313
3307
|
}
|
|
@@ -4979,7 +4973,8 @@
|
|
|
4979
4973
|
"node_modules/@types/minimatch": {
|
|
4980
4974
|
"version": "3.0.5",
|
|
4981
4975
|
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz",
|
|
4982
|
-
"integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
|
|
4976
|
+
"integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==",
|
|
4977
|
+
"license": "MIT"
|
|
4983
4978
|
},
|
|
4984
4979
|
"node_modules/@types/node": {
|
|
4985
4980
|
"version": "20.16.5",
|
|
@@ -5554,6 +5549,7 @@
|
|
|
5554
5549
|
"version": "3.0.0",
|
|
5555
5550
|
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz",
|
|
5556
5551
|
"integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==",
|
|
5552
|
+
"license": "MIT",
|
|
5557
5553
|
"engines": {
|
|
5558
5554
|
"node": ">=8"
|
|
5559
5555
|
}
|
|
@@ -5783,6 +5779,7 @@
|
|
|
5783
5779
|
"version": "2.0.1",
|
|
5784
5780
|
"resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
|
|
5785
5781
|
"integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
|
|
5782
|
+
"license": "MIT",
|
|
5786
5783
|
"engines": {
|
|
5787
5784
|
"node": ">=8"
|
|
5788
5785
|
}
|
|
@@ -6025,22 +6022,23 @@
|
|
|
6025
6022
|
]
|
|
6026
6023
|
},
|
|
6027
6024
|
"node_modules/body-parser": {
|
|
6028
|
-
"version": "1.20.
|
|
6029
|
-
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.
|
|
6030
|
-
"integrity": "sha512-
|
|
6025
|
+
"version": "1.20.5",
|
|
6026
|
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz",
|
|
6027
|
+
"integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==",
|
|
6028
|
+
"license": "MIT",
|
|
6031
6029
|
"dependencies": {
|
|
6032
|
-
"bytes": "3.1.2",
|
|
6030
|
+
"bytes": "~3.1.2",
|
|
6033
6031
|
"content-type": "~1.0.5",
|
|
6034
6032
|
"debug": "2.6.9",
|
|
6035
6033
|
"depd": "2.0.0",
|
|
6036
|
-
"destroy": "1.2.0",
|
|
6037
|
-
"http-errors": "2.0.
|
|
6038
|
-
"iconv-lite": "0.4.24",
|
|
6039
|
-
"on-finished": "2.4.1",
|
|
6040
|
-
"qs": "6.
|
|
6041
|
-
"raw-body": "2.5.
|
|
6034
|
+
"destroy": "~1.2.0",
|
|
6035
|
+
"http-errors": "~2.0.1",
|
|
6036
|
+
"iconv-lite": "~0.4.24",
|
|
6037
|
+
"on-finished": "~2.4.1",
|
|
6038
|
+
"qs": "~6.15.1",
|
|
6039
|
+
"raw-body": "~2.5.3",
|
|
6042
6040
|
"type-is": "~1.6.18",
|
|
6043
|
-
"unpipe": "1.0.0"
|
|
6041
|
+
"unpipe": "~1.0.0"
|
|
6044
6042
|
},
|
|
6045
6043
|
"engines": {
|
|
6046
6044
|
"node": ">= 0.8",
|
|
@@ -6051,14 +6049,36 @@
|
|
|
6051
6049
|
"version": "2.6.9",
|
|
6052
6050
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
|
6053
6051
|
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
|
6052
|
+
"license": "MIT",
|
|
6054
6053
|
"dependencies": {
|
|
6055
6054
|
"ms": "2.0.0"
|
|
6056
6055
|
}
|
|
6057
6056
|
},
|
|
6057
|
+
"node_modules/body-parser/node_modules/http-errors": {
|
|
6058
|
+
"version": "2.0.1",
|
|
6059
|
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
|
6060
|
+
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
|
6061
|
+
"license": "MIT",
|
|
6062
|
+
"dependencies": {
|
|
6063
|
+
"depd": "~2.0.0",
|
|
6064
|
+
"inherits": "~2.0.4",
|
|
6065
|
+
"setprototypeof": "~1.2.0",
|
|
6066
|
+
"statuses": "~2.0.2",
|
|
6067
|
+
"toidentifier": "~1.0.1"
|
|
6068
|
+
},
|
|
6069
|
+
"engines": {
|
|
6070
|
+
"node": ">= 0.8"
|
|
6071
|
+
},
|
|
6072
|
+
"funding": {
|
|
6073
|
+
"type": "opencollective",
|
|
6074
|
+
"url": "https://opencollective.com/express"
|
|
6075
|
+
}
|
|
6076
|
+
},
|
|
6058
6077
|
"node_modules/body-parser/node_modules/iconv-lite": {
|
|
6059
6078
|
"version": "0.4.24",
|
|
6060
6079
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
|
6061
6080
|
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
|
6081
|
+
"license": "MIT",
|
|
6062
6082
|
"dependencies": {
|
|
6063
6083
|
"safer-buffer": ">= 2.1.2 < 3"
|
|
6064
6084
|
},
|
|
@@ -6069,19 +6089,23 @@
|
|
|
6069
6089
|
"node_modules/body-parser/node_modules/ms": {
|
|
6070
6090
|
"version": "2.0.0",
|
|
6071
6091
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
|
6072
|
-
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
|
6092
|
+
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
|
6093
|
+
"license": "MIT"
|
|
6094
|
+
},
|
|
6095
|
+
"node_modules/body-parser/node_modules/statuses": {
|
|
6096
|
+
"version": "2.0.2",
|
|
6097
|
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
|
6098
|
+
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
|
6099
|
+
"license": "MIT",
|
|
6100
|
+
"engines": {
|
|
6101
|
+
"node": ">= 0.8"
|
|
6102
|
+
}
|
|
6073
6103
|
},
|
|
6074
6104
|
"node_modules/boolbase": {
|
|
6075
6105
|
"version": "1.0.0",
|
|
6076
6106
|
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
|
6077
6107
|
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="
|
|
6078
6108
|
},
|
|
6079
|
-
"node_modules/boolean": {
|
|
6080
|
-
"version": "3.2.0",
|
|
6081
|
-
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
|
|
6082
|
-
"integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",
|
|
6083
|
-
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."
|
|
6084
|
-
},
|
|
6085
6109
|
"node_modules/bowser": {
|
|
6086
6110
|
"version": "2.14.1",
|
|
6087
6111
|
"resolved": "https://registry.npmjs.org/bowser/-/bowser-2.14.1.tgz",
|
|
@@ -6190,6 +6214,7 @@
|
|
|
6190
6214
|
"version": "3.1.2",
|
|
6191
6215
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
|
6192
6216
|
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
|
6217
|
+
"license": "MIT",
|
|
6193
6218
|
"engines": {
|
|
6194
6219
|
"node": ">= 0.8"
|
|
6195
6220
|
}
|
|
@@ -6594,6 +6619,7 @@
|
|
|
6594
6619
|
"version": "1.0.5",
|
|
6595
6620
|
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
|
6596
6621
|
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
|
6622
|
+
"license": "MIT",
|
|
6597
6623
|
"engines": {
|
|
6598
6624
|
"node": ">= 0.6"
|
|
6599
6625
|
}
|
|
@@ -6768,9 +6794,10 @@
|
|
|
6768
6794
|
}
|
|
6769
6795
|
},
|
|
6770
6796
|
"node_modules/debug": {
|
|
6771
|
-
"version": "4.3
|
|
6772
|
-
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.
|
|
6773
|
-
"integrity": "sha512-
|
|
6797
|
+
"version": "4.4.3",
|
|
6798
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
6799
|
+
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
|
6800
|
+
"license": "MIT",
|
|
6774
6801
|
"dependencies": {
|
|
6775
6802
|
"ms": "^2.1.3"
|
|
6776
6803
|
},
|
|
@@ -7103,13 +7130,13 @@
|
|
|
7103
7130
|
"devOptional": true
|
|
7104
7131
|
},
|
|
7105
7132
|
"node_modules/email-templates": {
|
|
7106
|
-
"version": "13.0.
|
|
7107
|
-
"resolved": "https://registry.npmjs.org/email-templates/-/email-templates-13.0.
|
|
7108
|
-
"integrity": "sha512-
|
|
7133
|
+
"version": "13.0.1",
|
|
7134
|
+
"resolved": "https://registry.npmjs.org/email-templates/-/email-templates-13.0.1.tgz",
|
|
7135
|
+
"integrity": "sha512-kIH40FwhiE20Fh5DR1wrVM0HETYPoqfihUAgUwZtZgPK6VJNTCdJzTo7yxcgYmvMmKgqGJFSXE8/pEkeVmjuDg==",
|
|
7109
7136
|
"license": "MIT",
|
|
7110
7137
|
"dependencies": {
|
|
7111
7138
|
"@ladjs/consolidate": "^1.0.4",
|
|
7112
|
-
"@ladjs/i18n": "^
|
|
7139
|
+
"@ladjs/i18n": "^10.0.0",
|
|
7113
7140
|
"get-paths": "^0.0.7",
|
|
7114
7141
|
"html-to-text": "^9.0.5",
|
|
7115
7142
|
"juice": "^11.0.3",
|
|
@@ -8303,14 +8330,14 @@
|
|
|
8303
8330
|
}
|
|
8304
8331
|
},
|
|
8305
8332
|
"node_modules/express": {
|
|
8306
|
-
"version": "4.22.
|
|
8307
|
-
"resolved": "https://registry.npmjs.org/express/-/express-4.22.
|
|
8308
|
-
"integrity": "sha512-
|
|
8333
|
+
"version": "4.22.2",
|
|
8334
|
+
"resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz",
|
|
8335
|
+
"integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
|
|
8309
8336
|
"license": "MIT",
|
|
8310
8337
|
"dependencies": {
|
|
8311
8338
|
"accepts": "~1.3.8",
|
|
8312
8339
|
"array-flatten": "1.1.1",
|
|
8313
|
-
"body-parser": "~1.20.
|
|
8340
|
+
"body-parser": "~1.20.5",
|
|
8314
8341
|
"content-disposition": "~0.5.4",
|
|
8315
8342
|
"content-type": "~1.0.4",
|
|
8316
8343
|
"cookie": "~0.7.1",
|
|
@@ -8329,7 +8356,7 @@
|
|
|
8329
8356
|
"parseurl": "~1.3.3",
|
|
8330
8357
|
"path-to-regexp": "~0.1.12",
|
|
8331
8358
|
"proxy-addr": "~2.0.7",
|
|
8332
|
-
"qs": "~6.
|
|
8359
|
+
"qs": "~6.15.1",
|
|
8333
8360
|
"range-parser": "~1.2.1",
|
|
8334
8361
|
"safe-buffer": "5.2.1",
|
|
8335
8362
|
"send": "~0.19.0",
|
|
@@ -8381,21 +8408,6 @@
|
|
|
8381
8408
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
|
|
8382
8409
|
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ=="
|
|
8383
8410
|
},
|
|
8384
|
-
"node_modules/express/node_modules/qs": {
|
|
8385
|
-
"version": "6.14.0",
|
|
8386
|
-
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
|
8387
|
-
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
|
8388
|
-
"license": "BSD-3-Clause",
|
|
8389
|
-
"dependencies": {
|
|
8390
|
-
"side-channel": "^1.1.0"
|
|
8391
|
-
},
|
|
8392
|
-
"engines": {
|
|
8393
|
-
"node": ">=0.6"
|
|
8394
|
-
},
|
|
8395
|
-
"funding": {
|
|
8396
|
-
"url": "https://github.com/sponsors/ljharb"
|
|
8397
|
-
}
|
|
8398
|
-
},
|
|
8399
8411
|
"node_modules/extend-object": {
|
|
8400
8412
|
"version": "1.0.0",
|
|
8401
8413
|
"resolved": "https://registry.npmjs.org/extend-object/-/extend-object-1.0.0.tgz",
|
|
@@ -8446,6 +8458,7 @@
|
|
|
8446
8458
|
"version": "1.6.10",
|
|
8447
8459
|
"resolved": "https://registry.npmjs.org/fast-printf/-/fast-printf-1.6.10.tgz",
|
|
8448
8460
|
"integrity": "sha512-GwTgG9O4FVIdShhbVF3JxOgSBY2+ePGsu2V/UONgoCPzF9VY6ZdBMKsHKCYQHZwNk3qNouUolRDsgVxcVA5G1w==",
|
|
8461
|
+
"license": "BSD-3-Clause",
|
|
8449
8462
|
"engines": {
|
|
8450
8463
|
"node": ">=10.0"
|
|
8451
8464
|
}
|
|
@@ -9311,14 +9324,15 @@
|
|
|
9311
9324
|
}
|
|
9312
9325
|
},
|
|
9313
9326
|
"node_modules/i18n": {
|
|
9314
|
-
"version": "0.15.
|
|
9315
|
-
"resolved": "https://registry.npmjs.org/i18n/-/i18n-0.15.
|
|
9316
|
-
"integrity": "sha512-
|
|
9327
|
+
"version": "0.15.3",
|
|
9328
|
+
"resolved": "https://registry.npmjs.org/i18n/-/i18n-0.15.3.tgz",
|
|
9329
|
+
"integrity": "sha512-tW/AA5R4lJZLnd60Agcd0PfXB1C2G7UqTrdNewuv/SIYdxcHkCE8w4Zx1SgCjJ+2BLuAAGIG/KXb/xNYF1lO5Q==",
|
|
9330
|
+
"license": "MIT",
|
|
9317
9331
|
"dependencies": {
|
|
9318
|
-
"@messageformat/core": "^3.
|
|
9319
|
-
"debug": "^4.
|
|
9320
|
-
"fast-printf": "^1.6.
|
|
9321
|
-
"make-plural": "^7.
|
|
9332
|
+
"@messageformat/core": "^3.4.0",
|
|
9333
|
+
"debug": "^4.4.3",
|
|
9334
|
+
"fast-printf": "^1.6.10",
|
|
9335
|
+
"make-plural": "^7.4.0",
|
|
9322
9336
|
"math-interval-parser": "^2.0.1",
|
|
9323
9337
|
"mustache": "^4.2.0"
|
|
9324
9338
|
},
|
|
@@ -9333,6 +9347,7 @@
|
|
|
9333
9347
|
"version": "0.0.5",
|
|
9334
9348
|
"resolved": "https://registry.npmjs.org/i18n-locales/-/i18n-locales-0.0.5.tgz",
|
|
9335
9349
|
"integrity": "sha512-Kve1AHy6rqyfJHPy8MIvaKBKhHhHPXV+a/TgMkjp3UBhO3gfWR40ZQn8Xy7LI6g3FhmbvkFtv+GCZy6yvuyeHQ==",
|
|
9350
|
+
"license": "MIT",
|
|
9336
9351
|
"dependencies": {
|
|
9337
9352
|
"@ladjs/country-language": "^0.2.1"
|
|
9338
9353
|
}
|
|
@@ -9341,6 +9356,7 @@
|
|
|
9341
9356
|
"version": "0.2.1",
|
|
9342
9357
|
"resolved": "https://registry.npmjs.org/@ladjs/country-language/-/country-language-0.2.1.tgz",
|
|
9343
9358
|
"integrity": "sha512-e3AmT7jUnfNE6e2mx2+cPYiWdFW3McySDGRhQEYE6SksjZTMj0PTp+R9x1xG89tHRTsyMNJFl9J4HtZPWZzi1Q==",
|
|
9359
|
+
"license": "MIT",
|
|
9344
9360
|
"dependencies": {
|
|
9345
9361
|
"underscore": "~1.13.1",
|
|
9346
9362
|
"underscore.deep": "~0.5.1"
|
|
@@ -11169,9 +11185,9 @@
|
|
|
11169
11185
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
|
11170
11186
|
},
|
|
11171
11187
|
"node_modules/kysely": {
|
|
11172
|
-
"version": "0.28.
|
|
11173
|
-
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.28.
|
|
11174
|
-
"integrity": "sha512-
|
|
11188
|
+
"version": "0.28.17",
|
|
11189
|
+
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.28.17.tgz",
|
|
11190
|
+
"integrity": "sha512-nbD8lB9EB3wNdMhOCdx5Li8DxnLbvKByylRLcJ1h+4SkrowVeECAyZlyiKMThF7xFdRz0jSQ2MoJr+wXux2y0Q==",
|
|
11175
11191
|
"license": "MIT",
|
|
11176
11192
|
"engines": {
|
|
11177
11193
|
"node": ">=20.0.0"
|
|
@@ -11402,9 +11418,10 @@
|
|
|
11402
11418
|
"dev": true
|
|
11403
11419
|
},
|
|
11404
11420
|
"node_modules/make-plural": {
|
|
11405
|
-
"version": "7.
|
|
11406
|
-
"resolved": "https://registry.npmjs.org/make-plural/-/make-plural-7.
|
|
11407
|
-
"integrity": "sha512-
|
|
11421
|
+
"version": "7.5.0",
|
|
11422
|
+
"resolved": "https://registry.npmjs.org/make-plural/-/make-plural-7.5.0.tgz",
|
|
11423
|
+
"integrity": "sha512-0booA+aVYyVFoR67JBHdfVk0U08HmrBH2FrtmBqBa+NldlqXv/G2Z9VQuQq6Wgp2jDWdybEWGfBkk1cq5264WA==",
|
|
11424
|
+
"license": "Unicode-DFS-2016"
|
|
11408
11425
|
},
|
|
11409
11426
|
"node_modules/makeerror": {
|
|
11410
11427
|
"version": "1.0.12",
|
|
@@ -11419,6 +11436,7 @@
|
|
|
11419
11436
|
"version": "2.0.1",
|
|
11420
11437
|
"resolved": "https://registry.npmjs.org/math-interval-parser/-/math-interval-parser-2.0.1.tgz",
|
|
11421
11438
|
"integrity": "sha512-VmlAmb0UJwlvMyx8iPhXUDnVW1F9IrGEd9CIOmv+XL8AErCUUuozoDMrgImvnYt2A+53qVX/tPW6YJurMKYsvA==",
|
|
11439
|
+
"license": "MIT",
|
|
11422
11440
|
"engines": {
|
|
11423
11441
|
"node": ">=0.10.0"
|
|
11424
11442
|
}
|
|
@@ -11435,6 +11453,7 @@
|
|
|
11435
11453
|
"version": "0.3.0",
|
|
11436
11454
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
|
11437
11455
|
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
|
11456
|
+
"license": "MIT",
|
|
11438
11457
|
"engines": {
|
|
11439
11458
|
"node": ">= 0.6"
|
|
11440
11459
|
}
|
|
@@ -11569,9 +11588,10 @@
|
|
|
11569
11588
|
}
|
|
11570
11589
|
},
|
|
11571
11590
|
"node_modules/moo": {
|
|
11572
|
-
"version": "0.5.
|
|
11573
|
-
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.
|
|
11574
|
-
"integrity": "sha512-
|
|
11591
|
+
"version": "0.5.3",
|
|
11592
|
+
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.3.tgz",
|
|
11593
|
+
"integrity": "sha512-m2fmM2dDm7GZQsY7KK2cme8agi+AAljILjQnof7p1ZMDe6dQ4bdnSMx0cPppudoeNv5hEFQirN6u+O4fDE0IWA==",
|
|
11594
|
+
"license": "BSD-3-Clause"
|
|
11575
11595
|
},
|
|
11576
11596
|
"node_modules/ms": {
|
|
11577
11597
|
"version": "2.1.3",
|
|
@@ -11582,6 +11602,7 @@
|
|
|
11582
11602
|
"version": "5.0.0",
|
|
11583
11603
|
"resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz",
|
|
11584
11604
|
"integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==",
|
|
11605
|
+
"license": "MIT",
|
|
11585
11606
|
"dependencies": {
|
|
11586
11607
|
"@types/minimatch": "^3.0.3",
|
|
11587
11608
|
"array-differ": "^3.0.0",
|
|
@@ -11695,9 +11716,9 @@
|
|
|
11695
11716
|
"devOptional": true
|
|
11696
11717
|
},
|
|
11697
11718
|
"node_modules/nodemailer": {
|
|
11698
|
-
"version": "8.0.
|
|
11699
|
-
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-8.0.
|
|
11700
|
-
"integrity": "sha512-
|
|
11719
|
+
"version": "8.0.5",
|
|
11720
|
+
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-8.0.5.tgz",
|
|
11721
|
+
"integrity": "sha512-0PF8Yb1yZuQfQbq+5/pZJrtF6WQcjTd5/S4JOHs9PGFxuTqoB/icwuB44pOdURHJbRKX1PPoJZtY7R4VUoCC8w==",
|
|
11701
11722
|
"license": "MIT-0",
|
|
11702
11723
|
"engines": {
|
|
11703
11724
|
"node": ">=6.0.0"
|
|
@@ -12853,11 +12874,12 @@
|
|
|
12853
12874
|
]
|
|
12854
12875
|
},
|
|
12855
12876
|
"node_modules/qs": {
|
|
12856
|
-
"version": "6.
|
|
12857
|
-
"resolved": "https://registry.npmjs.org/qs/-/qs-6.
|
|
12858
|
-
"integrity": "sha512
|
|
12877
|
+
"version": "6.15.2",
|
|
12878
|
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz",
|
|
12879
|
+
"integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==",
|
|
12880
|
+
"license": "BSD-3-Clause",
|
|
12859
12881
|
"dependencies": {
|
|
12860
|
-
"side-channel": "^1.0
|
|
12882
|
+
"side-channel": "^1.1.0"
|
|
12861
12883
|
},
|
|
12862
12884
|
"engines": {
|
|
12863
12885
|
"node": ">=0.6"
|
|
@@ -12917,23 +12939,45 @@
|
|
|
12917
12939
|
}
|
|
12918
12940
|
},
|
|
12919
12941
|
"node_modules/raw-body": {
|
|
12920
|
-
"version": "2.5.
|
|
12921
|
-
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.
|
|
12922
|
-
"integrity": "sha512-
|
|
12942
|
+
"version": "2.5.3",
|
|
12943
|
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
|
|
12944
|
+
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
|
|
12945
|
+
"license": "MIT",
|
|
12923
12946
|
"dependencies": {
|
|
12924
|
-
"bytes": "3.1.2",
|
|
12925
|
-
"http-errors": "2.0.
|
|
12926
|
-
"iconv-lite": "0.4.24",
|
|
12927
|
-
"unpipe": "1.0.0"
|
|
12947
|
+
"bytes": "~3.1.2",
|
|
12948
|
+
"http-errors": "~2.0.1",
|
|
12949
|
+
"iconv-lite": "~0.4.24",
|
|
12950
|
+
"unpipe": "~1.0.0"
|
|
12928
12951
|
},
|
|
12929
12952
|
"engines": {
|
|
12930
12953
|
"node": ">= 0.8"
|
|
12931
12954
|
}
|
|
12932
12955
|
},
|
|
12956
|
+
"node_modules/raw-body/node_modules/http-errors": {
|
|
12957
|
+
"version": "2.0.1",
|
|
12958
|
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
|
12959
|
+
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
|
12960
|
+
"license": "MIT",
|
|
12961
|
+
"dependencies": {
|
|
12962
|
+
"depd": "~2.0.0",
|
|
12963
|
+
"inherits": "~2.0.4",
|
|
12964
|
+
"setprototypeof": "~1.2.0",
|
|
12965
|
+
"statuses": "~2.0.2",
|
|
12966
|
+
"toidentifier": "~1.0.1"
|
|
12967
|
+
},
|
|
12968
|
+
"engines": {
|
|
12969
|
+
"node": ">= 0.8"
|
|
12970
|
+
},
|
|
12971
|
+
"funding": {
|
|
12972
|
+
"type": "opencollective",
|
|
12973
|
+
"url": "https://opencollective.com/express"
|
|
12974
|
+
}
|
|
12975
|
+
},
|
|
12933
12976
|
"node_modules/raw-body/node_modules/iconv-lite": {
|
|
12934
12977
|
"version": "0.4.24",
|
|
12935
12978
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
|
12936
12979
|
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
|
12980
|
+
"license": "MIT",
|
|
12937
12981
|
"dependencies": {
|
|
12938
12982
|
"safer-buffer": ">= 2.1.2 < 3"
|
|
12939
12983
|
},
|
|
@@ -12941,6 +12985,15 @@
|
|
|
12941
12985
|
"node": ">=0.10.0"
|
|
12942
12986
|
}
|
|
12943
12987
|
},
|
|
12988
|
+
"node_modules/raw-body/node_modules/statuses": {
|
|
12989
|
+
"version": "2.0.2",
|
|
12990
|
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
|
12991
|
+
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
|
12992
|
+
"license": "MIT",
|
|
12993
|
+
"engines": {
|
|
12994
|
+
"node": ">= 0.8"
|
|
12995
|
+
}
|
|
12996
|
+
},
|
|
12944
12997
|
"node_modules/rc": {
|
|
12945
12998
|
"version": "1.2.8",
|
|
12946
12999
|
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
|
@@ -13462,7 +13515,8 @@
|
|
|
13462
13515
|
"node_modules/safe-identifier": {
|
|
13463
13516
|
"version": "0.4.2",
|
|
13464
13517
|
"resolved": "https://registry.npmjs.org/safe-identifier/-/safe-identifier-0.4.2.tgz",
|
|
13465
|
-
"integrity": "sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w=="
|
|
13518
|
+
"integrity": "sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w==",
|
|
13519
|
+
"license": "ISC"
|
|
13466
13520
|
},
|
|
13467
13521
|
"node_modules/safe-push-apply": {
|
|
13468
13522
|
"version": "1.0.0",
|
|
@@ -14305,6 +14359,7 @@
|
|
|
14305
14359
|
"version": "2.1.0",
|
|
14306
14360
|
"resolved": "https://registry.npmjs.org/titleize/-/titleize-2.1.0.tgz",
|
|
14307
14361
|
"integrity": "sha512-m+apkYlfiQTKLW+sI4vqUkwMEzfgEUEYSqljx1voUE3Wz/z1ZsxyzSxvH2X8uKVrOp7QkByWt0rA6+gvhCKy6g==",
|
|
14362
|
+
"license": "MIT",
|
|
14308
14363
|
"engines": {
|
|
14309
14364
|
"node": ">=6"
|
|
14310
14365
|
}
|
|
@@ -14533,6 +14588,7 @@
|
|
|
14533
14588
|
"version": "1.6.18",
|
|
14534
14589
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
14535
14590
|
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
|
14591
|
+
"license": "MIT",
|
|
14536
14592
|
"dependencies": {
|
|
14537
14593
|
"media-typer": "0.3.0",
|
|
14538
14594
|
"mime-types": "~2.1.24"
|
|
@@ -14763,6 +14819,7 @@
|
|
|
14763
14819
|
"version": "0.5.3",
|
|
14764
14820
|
"resolved": "https://registry.npmjs.org/underscore.deep/-/underscore.deep-0.5.3.tgz",
|
|
14765
14821
|
"integrity": "sha512-4OuSOlFNkiVFVc3khkeG112Pdu1gbitMj7t9B9ENb61uFmN70Jq7Iluhi3oflcSgexkKfDdJ5XAJET2gEq6ikA==",
|
|
14822
|
+
"license": "BSD",
|
|
14766
14823
|
"engines": {
|
|
14767
14824
|
"node": ">=0.10.x"
|
|
14768
14825
|
},
|
|
@@ -15365,9 +15422,11 @@
|
|
|
15365
15422
|
}
|
|
15366
15423
|
},
|
|
15367
15424
|
"node_modules/zod": {
|
|
15368
|
-
"version": "3.
|
|
15369
|
-
"resolved": "https://registry.npmjs.org/zod/-/zod-3.
|
|
15370
|
-
"integrity": "sha512-
|
|
15425
|
+
"version": "3.25.76",
|
|
15426
|
+
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
|
15427
|
+
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
|
15428
|
+
"dev": true,
|
|
15429
|
+
"license": "MIT",
|
|
15371
15430
|
"funding": {
|
|
15372
15431
|
"url": "https://github.com/sponsors/colinhacks"
|
|
15373
15432
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creator.co/wapi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"cors": "^2.8.5",
|
|
40
40
|
"cuid": "^3.0.0",
|
|
41
41
|
"dotenv": "^16.4.1",
|
|
42
|
-
"email-templates": "^13.0.
|
|
43
|
-
"express": "^4.22.
|
|
42
|
+
"email-templates": "^13.0.1",
|
|
43
|
+
"express": "^4.22.2",
|
|
44
44
|
"express-rate-limit": "^7.5.0",
|
|
45
45
|
"json-stringify-safe": "^5.0.1",
|
|
46
46
|
"jsonwebtoken": "^9.0.2",
|
|
47
47
|
"knex": "^3.0.1",
|
|
48
48
|
"knex-stringcase": "^1.4.6",
|
|
49
|
-
"kysely": "^0.28.
|
|
49
|
+
"kysely": "^0.28.17",
|
|
50
50
|
"node-cache": "^5.1.2",
|
|
51
|
-
"nodemailer": "^8.0.
|
|
51
|
+
"nodemailer": "^8.0.5",
|
|
52
52
|
"object-hash": "^3.0.0",
|
|
53
53
|
"parse-duration": "^2.1.3",
|
|
54
54
|
"path-to-regexp": "^8.4.0",
|
|
@@ -56,8 +56,7 @@
|
|
|
56
56
|
"rate-limit-redis": "^4.2.0",
|
|
57
57
|
"redis": "^4.7.0",
|
|
58
58
|
"sha1": "^1.1.1",
|
|
59
|
-
"stack-trace": "0.0.10"
|
|
60
|
-
"zod": "^3.23.4"
|
|
59
|
+
"stack-trace": "0.0.10"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@go-task/cli": "^3.39.0",
|
|
@@ -88,6 +87,10 @@
|
|
|
88
87
|
"supertest": "^7.1.1",
|
|
89
88
|
"ts-jest": "^29.2.5",
|
|
90
89
|
"ts-node": "^10.9.1",
|
|
91
|
-
"typescript": "^5.5.0"
|
|
90
|
+
"typescript": "^5.5.0",
|
|
91
|
+
"zod": "^3.25.76"
|
|
92
|
+
},
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"zod": "^3.23.4"
|
|
92
95
|
}
|
|
93
96
|
}
|
|
@@ -50,9 +50,9 @@ export interface GlobalRateLimitConfig {
|
|
|
50
50
|
* @property {string} path - The path of the route.
|
|
51
51
|
* @property {string} method - The HTTP method of the route.
|
|
52
52
|
* @property {TransactionExecution<Transaction<InputType, OutputType | ResponseErrorType>, OutputType | ResponseErrorType>} handler - The handler function for the route.
|
|
53
|
-
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[inputSchema] - The input schema for validating the input data.
|
|
54
|
-
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[pathSchema] - The path schema for validating the path data.
|
|
55
|
-
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[querySchema] - The query schema for validating the query data.
|
|
53
|
+
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}[inputSchema] - The input schema for validating the input data. ZodEffects is supported so schemas using .refine/.superRefine/.transform can be passed directly.
|
|
54
|
+
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}[pathSchema] - The path schema for validating the path data.
|
|
55
|
+
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}[querySchema] - The query schema for validating the query data.
|
|
56
56
|
*/
|
|
57
57
|
export interface Route<InputType = never, OutputType = never, PathParamsType = StringMap, QueryParamsType = StringMap> {
|
|
58
58
|
/**
|
|
@@ -74,22 +74,23 @@ export interface Route<InputType = never, OutputType = never, PathParamsType = S
|
|
|
74
74
|
handler: TransactionExecution<Transaction<InputType, OutputType | ResponseErrorType, never, PathParamsType, QueryParamsType>, OutputType | ResponseErrorType>;
|
|
75
75
|
/**
|
|
76
76
|
* An optional input schema for validating the structure of the input data.
|
|
77
|
+
* ZodEffects is supported so schemas wrapped with .refine/.superRefine/.transform can be used directly.
|
|
77
78
|
*
|
|
78
|
-
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}
|
|
79
|
+
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}
|
|
79
80
|
*/
|
|
80
|
-
inputSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>;
|
|
81
|
+
inputSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>;
|
|
81
82
|
/**
|
|
82
83
|
* An optional input schema for validating the structure of the path params.
|
|
83
84
|
*
|
|
84
|
-
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}
|
|
85
|
+
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}
|
|
85
86
|
*/
|
|
86
|
-
pathSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>;
|
|
87
|
+
pathSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>;
|
|
87
88
|
/**
|
|
88
89
|
* An optional input schema for validating the structure of the query params.
|
|
89
90
|
*
|
|
90
|
-
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}
|
|
91
|
+
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}
|
|
91
92
|
*/
|
|
92
|
-
querySchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>;
|
|
93
|
+
querySchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>;
|
|
93
94
|
/**
|
|
94
95
|
* An optional openApi object with extra metadata for docs generation.
|
|
95
96
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../../src/Server/Router.ts"],"names":[],"mappings":"AAMA,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,MAAM,MAAM,iBAAiB,CAAA;AAQpC,OAAO,KAAK,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../../src/Server/Router.ts"],"names":[],"mappings":"AAMA,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,MAAM,MAAM,iBAAiB,CAAA;AAQpC,OAAO,KAAK,MAAM,kBAAkB,CAAA;AAsMpC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IAUzB;;;;OAIG;IACH,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAA;IACrF,CAAC;IAED;;;OAGG;IACI,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAA;IAChC,CAAC;IAED;;;OAGG;IACK,WAAW;QACjB,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAA;IACtC,CAAC;CACF"}
|
|
@@ -36,6 +36,9 @@ export default class Proxy {
|
|
|
36
36
|
this.serverlessHandler = serverlessHandler;
|
|
37
37
|
this.logger = new Logger({ logLevel: 'INFO' }, 'proxy-container');
|
|
38
38
|
this.app = express();
|
|
39
|
+
// Trust the first proxy hop so req.ip resolves to the real client IP
|
|
40
|
+
// (not the load balancer's IP) when running behind ALB or similar.
|
|
41
|
+
this.app.set('trust proxy', 1);
|
|
39
42
|
/* Opinionated Express configs */
|
|
40
43
|
this.app.use(express.json({
|
|
41
44
|
verify(req, res, buf) {
|
|
@@ -169,12 +172,27 @@ export default class Proxy {
|
|
|
169
172
|
// Key generator - how to identify unique clients
|
|
170
173
|
keyGenerator: config.keyGenerator ||
|
|
171
174
|
((req) => {
|
|
172
|
-
|
|
173
|
-
//
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
'
|
|
175
|
+
// For authenticated requests, use the stable user ID from the JWT
|
|
176
|
+
// payload so that multiple users behind the same IP are bucketed
|
|
177
|
+
// independently and token rotation doesn't change a user's bucket.
|
|
178
|
+
const authHeader = req.headers['authorization'];
|
|
179
|
+
if (authHeader === null || authHeader === void 0 ? void 0 : authHeader.startsWith('Bearer ')) {
|
|
180
|
+
const parts = authHeader.slice(7).split('.');
|
|
181
|
+
if (parts.length === 3) {
|
|
182
|
+
try {
|
|
183
|
+
const payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8'));
|
|
184
|
+
const userId = payload.sub || payload.id || payload.userId;
|
|
185
|
+
if (userId)
|
|
186
|
+
return String(userId);
|
|
187
|
+
}
|
|
188
|
+
catch (_a) {
|
|
189
|
+
// malformed token — fall through to IP
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// Unauthenticated: fall back to real client IP.
|
|
194
|
+
// trust proxy is set so req.ip reflects x-forwarded-for correctly.
|
|
195
|
+
return req.ip || req.socket.remoteAddress || 'unknown';
|
|
178
196
|
}),
|
|
179
197
|
// Custom handler when rate limit is exceeded
|
|
180
198
|
handler: config.handler ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Proxy.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AAiD;IACpE,CAAC;CACF"}
|
|
@@ -3,15 +3,15 @@ import Response, { ResponseErrorType } from '../API/Response.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Validates the given data against the provided schema.
|
|
5
5
|
* @param {any} data - The data to be validated.
|
|
6
|
-
* @param {z.ZodObject<any>} schema - The schema to validate against.
|
|
6
|
+
* @param {z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>} schema - The schema to validate against.
|
|
7
7
|
* @returns {boolean | Response<ResponseErrorType>} - Returns true if the data is valid, otherwise returns a response object with an error message.
|
|
8
8
|
*/
|
|
9
9
|
export default class Validator {
|
|
10
10
|
/**
|
|
11
11
|
* Validates the given data against the provided schema.
|
|
12
12
|
* @param {any} data - The data to be validated.
|
|
13
|
-
* @param {z.ZodObject<any> | z.ZodUnion<any>} schema - The schema to validate against.
|
|
13
|
+
* @param {z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>} schema - The schema to validate against.
|
|
14
14
|
* @returns {boolean | Response<ResponseErrorType>} - Returns either true if the data is valid or a Response object with an error message if validation fails.
|
|
15
15
|
*/
|
|
16
|
-
static validateSchema(data: any, schema: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>): boolean | Response<ResponseErrorType>;
|
|
16
|
+
static validateSchema(data: any, schema: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>): boolean | Response<ResponseErrorType>;
|
|
17
17
|
}
|
|
@@ -4,14 +4,14 @@ import Globals from '../Globals.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Validates the given data against the provided schema.
|
|
6
6
|
* @param {any} data - The data to be validated.
|
|
7
|
-
* @param {z.ZodObject<any>} schema - The schema to validate against.
|
|
7
|
+
* @param {z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>} schema - The schema to validate against.
|
|
8
8
|
* @returns {boolean | Response<ResponseErrorType>} - Returns true if the data is valid, otherwise returns a response object with an error message.
|
|
9
9
|
*/
|
|
10
10
|
export default class Validator {
|
|
11
11
|
/**
|
|
12
12
|
* Validates the given data against the provided schema.
|
|
13
13
|
* @param {any} data - The data to be validated.
|
|
14
|
-
* @param {z.ZodObject<any> | z.ZodUnion<any>} schema - The schema to validate against.
|
|
14
|
+
* @param {z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>} schema - The schema to validate against.
|
|
15
15
|
* @returns {boolean | Response<ResponseErrorType>} - Returns either true if the data is valid or a Response object with an error message if validation fails.
|
|
16
16
|
*/
|
|
17
17
|
static validateSchema(data, schema) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../../src/Validation/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,QAA+B,MAAM,oBAAoB,CAAA;AAChE,OAAO,OAAO,MAAM,eAAe,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAC1B,IAAS,EACT,
|
|
1
|
+
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../../src/Validation/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,QAA+B,MAAM,oBAAoB,CAAA;AAChE,OAAO,OAAO,MAAM,eAAe,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAC1B,IAAS,EACT,MAA4F;QAE5F,IAAI,KAAK,EAAE,cAAc,CAAA;QAEzB,yCAAyC;QACzC,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAClB,cAAc,GAAG,IAAI,CAAA;QACvB,CAAC;QAAC,OAAO,GAAqB,EAAE,CAAC;YAC/B,IAAI,GAAG,YAAY,CAAC,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;;gBACzD,KAAK,GAAG,2BAA2B,CAAA,CAAC,8BAA8B;QACzE,CAAC;QAED,mBAAmB;QACnB,IAAI,CAAC,cAAc,IAAI,KAAK,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC,kBAAkB,CAChC,OAAO,CAAC,2BAA2B,EACnC,OAAO,CAAC,sBAAsB,EAC9B,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAA;QACH,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creator.co/wapi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"cors": "^2.8.5",
|
|
40
40
|
"cuid": "^3.0.0",
|
|
41
41
|
"dotenv": "^16.4.1",
|
|
42
|
-
"email-templates": "^13.0.
|
|
43
|
-
"express": "^4.22.
|
|
42
|
+
"email-templates": "^13.0.1",
|
|
43
|
+
"express": "^4.22.2",
|
|
44
44
|
"express-rate-limit": "^7.5.0",
|
|
45
45
|
"json-stringify-safe": "^5.0.1",
|
|
46
46
|
"jsonwebtoken": "^9.0.2",
|
|
47
47
|
"knex": "^3.0.1",
|
|
48
48
|
"knex-stringcase": "^1.4.6",
|
|
49
|
-
"kysely": "^0.28.
|
|
49
|
+
"kysely": "^0.28.17",
|
|
50
50
|
"node-cache": "^5.1.2",
|
|
51
|
-
"nodemailer": "^8.0.
|
|
51
|
+
"nodemailer": "^8.0.5",
|
|
52
52
|
"object-hash": "^3.0.0",
|
|
53
53
|
"parse-duration": "^2.1.3",
|
|
54
54
|
"path-to-regexp": "^8.4.0",
|
|
@@ -56,8 +56,7 @@
|
|
|
56
56
|
"rate-limit-redis": "^4.2.0",
|
|
57
57
|
"redis": "^4.7.0",
|
|
58
58
|
"sha1": "^1.1.1",
|
|
59
|
-
"stack-trace": "0.0.10"
|
|
60
|
-
"zod": "^3.23.4"
|
|
59
|
+
"stack-trace": "0.0.10"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@go-task/cli": "^3.39.0",
|
|
@@ -88,6 +87,10 @@
|
|
|
88
87
|
"supertest": "^7.1.1",
|
|
89
88
|
"ts-jest": "^29.2.5",
|
|
90
89
|
"ts-node": "^10.9.1",
|
|
91
|
-
"typescript": "^5.5.0"
|
|
90
|
+
"typescript": "^5.5.0",
|
|
91
|
+
"zod": "^3.25.76"
|
|
92
|
+
},
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"zod": "^3.23.4"
|
|
92
95
|
}
|
|
93
96
|
}
|
package/src/Server/Router.ts
CHANGED
|
@@ -62,9 +62,9 @@ export interface GlobalRateLimitConfig {
|
|
|
62
62
|
* @property {string} path - The path of the route.
|
|
63
63
|
* @property {string} method - The HTTP method of the route.
|
|
64
64
|
* @property {TransactionExecution<Transaction<InputType, OutputType | ResponseErrorType>, OutputType | ResponseErrorType>} handler - The handler function for the route.
|
|
65
|
-
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[inputSchema] - The input schema for validating the input data.
|
|
66
|
-
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[pathSchema] - The path schema for validating the path data.
|
|
67
|
-
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[querySchema] - The query schema for validating the query data.
|
|
65
|
+
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}[inputSchema] - The input schema for validating the input data. ZodEffects is supported so schemas using .refine/.superRefine/.transform can be passed directly.
|
|
66
|
+
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}[pathSchema] - The path schema for validating the path data.
|
|
67
|
+
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}[querySchema] - The query schema for validating the query data.
|
|
68
68
|
*/
|
|
69
69
|
export interface Route<
|
|
70
70
|
InputType = never,
|
|
@@ -100,24 +100,25 @@ export interface Route<
|
|
|
100
100
|
>
|
|
101
101
|
/**
|
|
102
102
|
* An optional input schema for validating the structure of the input data.
|
|
103
|
+
* ZodEffects is supported so schemas wrapped with .refine/.superRefine/.transform can be used directly.
|
|
103
104
|
*
|
|
104
|
-
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}
|
|
105
|
+
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}
|
|
105
106
|
*/
|
|
106
|
-
inputSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>
|
|
107
|
+
inputSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>
|
|
107
108
|
|
|
108
109
|
/**
|
|
109
110
|
* An optional input schema for validating the structure of the path params.
|
|
110
111
|
*
|
|
111
|
-
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}
|
|
112
|
+
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}
|
|
112
113
|
*/
|
|
113
|
-
pathSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>
|
|
114
|
+
pathSchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>
|
|
114
115
|
|
|
115
116
|
/**
|
|
116
117
|
* An optional input schema for validating the structure of the query params.
|
|
117
118
|
*
|
|
118
|
-
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}
|
|
119
|
+
* @type {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>}
|
|
119
120
|
*/
|
|
120
|
-
querySchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>
|
|
121
|
+
querySchema?: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>
|
|
121
122
|
|
|
122
123
|
/**
|
|
123
124
|
* An optional openApi object with extra metadata for docs generation.
|
|
@@ -66,6 +66,9 @@ export default class Proxy {
|
|
|
66
66
|
this.serverlessHandler = serverlessHandler
|
|
67
67
|
this.logger = new Logger({ logLevel: 'INFO' }, 'proxy-container')
|
|
68
68
|
this.app = express()
|
|
69
|
+
// Trust the first proxy hop so req.ip resolves to the real client IP
|
|
70
|
+
// (not the load balancer's IP) when running behind ALB or similar.
|
|
71
|
+
this.app.set('trust proxy', 1)
|
|
69
72
|
/* Opinionated Express configs */
|
|
70
73
|
this.app.use(
|
|
71
74
|
express.json({
|
|
@@ -211,13 +214,25 @@ export default class Proxy {
|
|
|
211
214
|
keyGenerator:
|
|
212
215
|
config.keyGenerator ||
|
|
213
216
|
((req: express.Request) => {
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
'
|
|
220
|
-
|
|
217
|
+
// For authenticated requests, use the stable user ID from the JWT
|
|
218
|
+
// payload so that multiple users behind the same IP are bucketed
|
|
219
|
+
// independently and token rotation doesn't change a user's bucket.
|
|
220
|
+
const authHeader = req.headers['authorization']
|
|
221
|
+
if (authHeader?.startsWith('Bearer ')) {
|
|
222
|
+
const parts = authHeader.slice(7).split('.')
|
|
223
|
+
if (parts.length === 3) {
|
|
224
|
+
try {
|
|
225
|
+
const payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8'))
|
|
226
|
+
const userId = payload.sub || payload.id || payload.userId
|
|
227
|
+
if (userId) return String(userId)
|
|
228
|
+
} catch {
|
|
229
|
+
// malformed token — fall through to IP
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Unauthenticated: fall back to real client IP.
|
|
234
|
+
// trust proxy is set so req.ip reflects x-forwarded-for correctly.
|
|
235
|
+
return req.ip || req.socket.remoteAddress || 'unknown'
|
|
221
236
|
}),
|
|
222
237
|
|
|
223
238
|
// Custom handler when rate limit is exceeded
|
|
@@ -6,19 +6,19 @@ import Globals from '../Globals.js'
|
|
|
6
6
|
/**
|
|
7
7
|
* Validates the given data against the provided schema.
|
|
8
8
|
* @param {any} data - The data to be validated.
|
|
9
|
-
* @param {z.ZodObject<any>} schema - The schema to validate against.
|
|
9
|
+
* @param {z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>} schema - The schema to validate against.
|
|
10
10
|
* @returns {boolean | Response<ResponseErrorType>} - Returns true if the data is valid, otherwise returns a response object with an error message.
|
|
11
11
|
*/
|
|
12
12
|
export default class Validator {
|
|
13
13
|
/**
|
|
14
14
|
* Validates the given data against the provided schema.
|
|
15
15
|
* @param {any} data - The data to be validated.
|
|
16
|
-
* @param {z.ZodObject<any> | z.ZodUnion<any>} schema - The schema to validate against.
|
|
16
|
+
* @param {z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>} schema - The schema to validate against.
|
|
17
17
|
* @returns {boolean | Response<ResponseErrorType>} - Returns either true if the data is valid or a Response object with an error message if validation fails.
|
|
18
18
|
*/
|
|
19
19
|
public static validateSchema(
|
|
20
20
|
data: any,
|
|
21
|
-
schema: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>
|
|
21
|
+
schema: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any> | z.ZodEffects<any>
|
|
22
22
|
): boolean | Response<ResponseErrorType> {
|
|
23
23
|
let error, validatedInput
|
|
24
24
|
|
|
@@ -548,24 +548,19 @@ describe('Rate Limiting', () => {
|
|
|
548
548
|
|
|
549
549
|
await proxy.load()
|
|
550
550
|
|
|
551
|
-
//
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
.set('x-forwarded-for', '10.0.0.1, 10.0.0.2')
|
|
555
|
-
.expect(200)
|
|
551
|
+
// With trust proxy=1, req.ip is the rightmost entry of x-forwarded-for.
|
|
552
|
+
// Two requests with the same rightmost IP share a bucket.
|
|
553
|
+
const res1 = await request(url).get('/test').set('x-forwarded-for', '10.0.0.1').expect(200)
|
|
556
554
|
c_expect(res1.body).to.deep.equal({ success: true })
|
|
557
555
|
|
|
558
|
-
// Second request from same IP should be rate limited
|
|
559
|
-
const res2 = await request(url)
|
|
560
|
-
.get('/test')
|
|
561
|
-
.set('x-forwarded-for', '10.0.0.1, 10.0.0.3')
|
|
562
|
-
.expect(429)
|
|
556
|
+
// Second request from same IP (same rightmost x-forwarded-for) should be rate limited
|
|
557
|
+
const res2 = await request(url).get('/test').set('x-forwarded-for', '10.0.0.1').expect(429)
|
|
563
558
|
c_expect(res2.body).to.have.property('error', 'rate_limit_exceeded')
|
|
564
559
|
|
|
565
560
|
// Wait for window to reset
|
|
566
561
|
await new Promise(resolve => setTimeout(resolve, 1100))
|
|
567
562
|
|
|
568
|
-
// Different IP should
|
|
563
|
+
// Different IP should have its own clean bucket
|
|
569
564
|
const res3 = await request(url).get('/test').set('x-forwarded-for', '10.0.0.99').expect(200)
|
|
570
565
|
c_expect(res3.body).to.deep.equal({ success: true })
|
|
571
566
|
}, 10000)
|
|
@@ -701,6 +696,137 @@ describe('Rate Limiting', () => {
|
|
|
701
696
|
// Verify proxy is running
|
|
702
697
|
c_expect(proxy).to.exist
|
|
703
698
|
})
|
|
699
|
+
|
|
700
|
+
test('Rate limit default keyGenerator - same bearer token shares a bucket', async () => {
|
|
701
|
+
const port = 57017
|
|
702
|
+
const url = defaultUrl.replace(String(Globals.Listener_HTTP_DefaultPort), String(port))
|
|
703
|
+
|
|
704
|
+
// Build a fake but structurally-valid JWT for user1
|
|
705
|
+
const makeJwt = (sub: string) => {
|
|
706
|
+
const header = Buffer.from(JSON.stringify({ alg: 'HS256', typ: 'JWT' })).toString('base64url')
|
|
707
|
+
const payload = Buffer.from(JSON.stringify({ sub })).toString('base64url')
|
|
708
|
+
return `${header}.${payload}.fakesignature`
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const rateLimitConfig: GlobalRateLimitConfig = {
|
|
712
|
+
enabled: true,
|
|
713
|
+
windowMs: 1000,
|
|
714
|
+
limit: 2,
|
|
715
|
+
// NO custom keyGenerator - should default to bearer token extraction
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
proxy = new Proxy(
|
|
719
|
+
{
|
|
720
|
+
routes: [],
|
|
721
|
+
port,
|
|
722
|
+
rateLimit: rateLimitConfig,
|
|
723
|
+
},
|
|
724
|
+
async (event: APIGatewayProxyEvent, context: Context) => {
|
|
725
|
+
context.succeed({
|
|
726
|
+
body: JSON.stringify({ success: true }),
|
|
727
|
+
statusCode: 200,
|
|
728
|
+
})
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
await proxy.load()
|
|
733
|
+
|
|
734
|
+
const token = makeJwt('user1')
|
|
735
|
+
|
|
736
|
+
// First 2 requests with same token should succeed
|
|
737
|
+
await request(url).get('/test').set('Authorization', `Bearer ${token}`).expect(200)
|
|
738
|
+
await request(url).get('/test').set('Authorization', `Bearer ${token}`).expect(200)
|
|
739
|
+
|
|
740
|
+
// 3rd request from same user (same token sub) should be rate limited
|
|
741
|
+
const rateLimitedRes = await request(url)
|
|
742
|
+
.get('/test')
|
|
743
|
+
.set('Authorization', `Bearer ${token}`)
|
|
744
|
+
.expect(429)
|
|
745
|
+
c_expect(rateLimitedRes.body).to.have.property('error', 'rate_limit_exceeded')
|
|
746
|
+
}, 10000)
|
|
747
|
+
|
|
748
|
+
test('Rate limit default keyGenerator - different users have separate buckets', async () => {
|
|
749
|
+
const port = 57018
|
|
750
|
+
const url = defaultUrl.replace(String(Globals.Listener_HTTP_DefaultPort), String(port))
|
|
751
|
+
|
|
752
|
+
const makeJwt = (sub: string) => {
|
|
753
|
+
const header = Buffer.from(JSON.stringify({ alg: 'HS256', typ: 'JWT' })).toString('base64url')
|
|
754
|
+
const payload = Buffer.from(JSON.stringify({ sub })).toString('base64url')
|
|
755
|
+
return `${header}.${payload}.fakesignature`
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
const rateLimitConfig: GlobalRateLimitConfig = {
|
|
759
|
+
enabled: true,
|
|
760
|
+
windowMs: 1000,
|
|
761
|
+
limit: 2,
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
proxy = new Proxy(
|
|
765
|
+
{
|
|
766
|
+
routes: [],
|
|
767
|
+
port,
|
|
768
|
+
rateLimit: rateLimitConfig,
|
|
769
|
+
},
|
|
770
|
+
async (event: APIGatewayProxyEvent, context: Context) => {
|
|
771
|
+
context.succeed({
|
|
772
|
+
body: JSON.stringify({ success: true }),
|
|
773
|
+
statusCode: 200,
|
|
774
|
+
})
|
|
775
|
+
}
|
|
776
|
+
)
|
|
777
|
+
|
|
778
|
+
await proxy.load()
|
|
779
|
+
|
|
780
|
+
const user1Token = makeJwt('user1')
|
|
781
|
+
const user2Token = makeJwt('user2')
|
|
782
|
+
|
|
783
|
+
// User 1 exhausts their bucket
|
|
784
|
+
await request(url).get('/test').set('Authorization', `Bearer ${user1Token}`).expect(200)
|
|
785
|
+
await request(url).get('/test').set('Authorization', `Bearer ${user1Token}`).expect(200)
|
|
786
|
+
await request(url).get('/test').set('Authorization', `Bearer ${user1Token}`).expect(429)
|
|
787
|
+
|
|
788
|
+
// User 2 has their own independent bucket — should still be allowed
|
|
789
|
+
const user2Res = await request(url)
|
|
790
|
+
.get('/test')
|
|
791
|
+
.set('Authorization', `Bearer ${user2Token}`)
|
|
792
|
+
.expect(200)
|
|
793
|
+
c_expect(user2Res.body).to.deep.equal({ success: true })
|
|
794
|
+
}, 10000)
|
|
795
|
+
|
|
796
|
+
test('Rate limit default keyGenerator - unauthenticated requests fall back to IP', async () => {
|
|
797
|
+
const port = 57019
|
|
798
|
+
const url = defaultUrl.replace(String(Globals.Listener_HTTP_DefaultPort), String(port))
|
|
799
|
+
|
|
800
|
+
const rateLimitConfig: GlobalRateLimitConfig = {
|
|
801
|
+
enabled: true,
|
|
802
|
+
windowMs: 1000,
|
|
803
|
+
limit: 2,
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
proxy = new Proxy(
|
|
807
|
+
{
|
|
808
|
+
routes: [],
|
|
809
|
+
port,
|
|
810
|
+
rateLimit: rateLimitConfig,
|
|
811
|
+
},
|
|
812
|
+
async (event: APIGatewayProxyEvent, context: Context) => {
|
|
813
|
+
context.succeed({
|
|
814
|
+
body: JSON.stringify({ success: true }),
|
|
815
|
+
statusCode: 200,
|
|
816
|
+
})
|
|
817
|
+
}
|
|
818
|
+
)
|
|
819
|
+
|
|
820
|
+
await proxy.load()
|
|
821
|
+
|
|
822
|
+
// Requests with no Authorization header are bucketed by IP (all from ::1 in tests)
|
|
823
|
+
await request(url).get('/test').expect(200)
|
|
824
|
+
await request(url).get('/test').expect(200)
|
|
825
|
+
|
|
826
|
+
// Same IP, 3rd request exceeds the limit
|
|
827
|
+
const rateLimitedRes = await request(url).get('/test').expect(429)
|
|
828
|
+
c_expect(rateLimitedRes.body).to.have.property('error', 'rate_limit_exceeded')
|
|
829
|
+
}, 10000)
|
|
704
830
|
})
|
|
705
831
|
|
|
706
832
|
export {}
|