@selvajs/server 1.3.3 → 1.4.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.
|
@@ -19,12 +19,14 @@ export interface RouteClassifierConfig {
|
|
|
19
19
|
*/
|
|
20
20
|
publicApis?: Iterable<string>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* proxy classifying per asset path
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* deny-by-default.
|
|
22
|
+
* Prefixes whose routes authorize each request themselves (e.g. a blob
|
|
23
|
+
* proxy classifying per asset path, or a callback authenticated by a
|
|
24
|
+
* per-request bearer). These classify as public so the hook attaches a
|
|
25
|
+
* session best-effort and does not deny up front; the route makes the real
|
|
26
|
+
* decision. Keep the list short — every other API route stays deny-by-default.
|
|
27
27
|
*/
|
|
28
|
+
selfGatingPrefixes?: readonly string[];
|
|
29
|
+
/** Single-prefix form of `selfGatingPrefixes`. */
|
|
28
30
|
selfGatingPrefix?: string;
|
|
29
31
|
/** Static-asset prefixes the adapter serves directly (e.g. `/_app/`). */
|
|
30
32
|
staticPrefixes?: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-classifier.d.ts","sourceRoot":"","sources":["../../src/http/route-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,qBAAqB;IACrC,iEAAiE;IACjE,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,2FAA2F;IAC3F,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yEAAyE;IACzE,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,qEAAqE;IACrE,WAAW,CAAC,EAAE,QA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AAG,eAAe,CA4BpF"}
|
|
@@ -11,7 +11,10 @@ export function createRouteClassifier(config) {
|
|
|
11
11
|
const publicPages = new Set(config.publicPages ?? []);
|
|
12
12
|
const publicPrefixes = config.publicPrefixes ?? [];
|
|
13
13
|
const publicApis = new Set(config.publicApis ?? []);
|
|
14
|
-
const
|
|
14
|
+
const selfGatingPrefixes = [
|
|
15
|
+
...(config.selfGatingPrefixes ?? []),
|
|
16
|
+
...(config.selfGatingPrefix !== undefined ? [config.selfGatingPrefix] : [])
|
|
17
|
+
];
|
|
15
18
|
const staticPrefixes = config.staticPrefixes ?? [];
|
|
16
19
|
const staticPaths = new Set(config.staticPaths ?? []);
|
|
17
20
|
function isStaticAsset(pathname) {
|
|
@@ -20,7 +23,7 @@ export function createRouteClassifier(config) {
|
|
|
20
23
|
return staticPrefixes.some((p) => pathname.startsWith(p));
|
|
21
24
|
}
|
|
22
25
|
function isSelfGatingApiRoute(pathname) {
|
|
23
|
-
return
|
|
26
|
+
return selfGatingPrefixes.some((p) => pathname.startsWith(p));
|
|
24
27
|
}
|
|
25
28
|
function isPublicRoute(pathname) {
|
|
26
29
|
if (publicPages.has(pathname))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-classifier.js","sourceRoot":"","sources":["../../src/http/route-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"route-classifier.js","sourceRoot":"","sources":["../../src/http/route-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsCH,MAAM,UAAU,qBAAqB,CAAC,MAA6B;IAClE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,kBA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6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selvajs/server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Transport-agnostic server building blocks for apps built on the Selva engine (limits, rate limiting, SSRF guard, remote-definition fetch, definition service + render loader); the solve core lives in @selvajs/solve/server",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VektorNode",
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
"!**/*.spec.*"
|
|
110
110
|
],
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"zod": "^4.6.
|
|
113
|
-
"@selvajs/
|
|
114
|
-
"@selvajs/
|
|
115
|
-
"@selvajs/schemas": "^5.0
|
|
116
|
-
"@selvajs/
|
|
112
|
+
"zod": "^4.6.5",
|
|
113
|
+
"@selvajs/platform": "^0.20.1",
|
|
114
|
+
"@selvajs/compute": "^4.2.0",
|
|
115
|
+
"@selvajs/schemas": "^5.1.0",
|
|
116
|
+
"@selvajs/notifications": "^0.2.1"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"@sentry/node": ">=8",
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
"devDependencies": {
|
|
135
|
-
"@types/node": "^26.
|
|
136
|
-
"@types/nodemailer": "^8.0.
|
|
137
|
-
"nodemailer": "^
|
|
135
|
+
"@types/node": "^26.6.2",
|
|
136
|
+
"@types/nodemailer": "^8.0.2",
|
|
137
|
+
"nodemailer": "^10.0.10",
|
|
138
138
|
"typescript": "~6.0.3",
|
|
139
|
-
"vitest": "^
|
|
140
|
-
"@selvajs/
|
|
141
|
-
"@selvajs/
|
|
139
|
+
"vitest": "^5.0.2",
|
|
140
|
+
"@selvajs/config": "0.0.4",
|
|
141
|
+
"@selvajs/local-provider": "0.15.3"
|
|
142
142
|
},
|
|
143
143
|
"scripts": {
|
|
144
144
|
"build": "tsc",
|