@rebasepro/server-core 0.6.0 → 0.6.1
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/index.es.js +9 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +9 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/api/rest/api-generator.ts +19 -2
- package/src/storage/routes.ts +4 -0
- package/vite.config.ts +5 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/server-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"description": "Database-Agnostic Backend Core for Rebase",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"ts-morph": "28.0.0",
|
|
55
55
|
"ws": "^8.21.0",
|
|
56
56
|
"zod": "^4.4.3",
|
|
57
|
-
"@rebasepro/client": "0.6.
|
|
58
|
-
"@rebasepro/
|
|
59
|
-
"@rebasepro/utils": "0.6.
|
|
60
|
-
"@rebasepro/
|
|
57
|
+
"@rebasepro/client": "0.6.1",
|
|
58
|
+
"@rebasepro/types": "0.6.1",
|
|
59
|
+
"@rebasepro/utils": "0.6.1",
|
|
60
|
+
"@rebasepro/common": "0.6.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/jest": "^30.0.0",
|
|
@@ -294,7 +294,16 @@ values: entity.values as Record<string, unknown> },
|
|
|
294
294
|
return c.json(response, 201);
|
|
295
295
|
} catch (error) {
|
|
296
296
|
if (isRebaseApiError(error) && !error.code) {
|
|
297
|
-
|
|
297
|
+
// Only classify as BAD_REQUEST if it's an operational error
|
|
298
|
+
// (e.g. validation, DB constraints). Runtime bugs like TypeError,
|
|
299
|
+
// RangeError etc. should remain as 500 INTERNAL_ERROR.
|
|
300
|
+
const isRuntimeBug = error instanceof TypeError
|
|
301
|
+
|| error instanceof RangeError
|
|
302
|
+
|| error instanceof SyntaxError
|
|
303
|
+
|| error instanceof ReferenceError;
|
|
304
|
+
if (!isRuntimeBug) {
|
|
305
|
+
error.code = "BAD_REQUEST";
|
|
306
|
+
}
|
|
298
307
|
}
|
|
299
308
|
throw error;
|
|
300
309
|
}
|
|
@@ -343,7 +352,15 @@ values: entity.values as Record<string, unknown> },
|
|
|
343
352
|
return c.json(response);
|
|
344
353
|
} catch (error) {
|
|
345
354
|
if (isRebaseApiError(error) && !error.code) {
|
|
346
|
-
|
|
355
|
+
// Only classify as BAD_REQUEST if it's an operational error.
|
|
356
|
+
// Runtime bugs (TypeError, RangeError, etc.) stay as 500.
|
|
357
|
+
const isRuntimeBug = error instanceof TypeError
|
|
358
|
+
|| error instanceof RangeError
|
|
359
|
+
|| error instanceof SyntaxError
|
|
360
|
+
|| error instanceof ReferenceError;
|
|
361
|
+
if (!isRuntimeBug) {
|
|
362
|
+
error.code = "BAD_REQUEST";
|
|
363
|
+
}
|
|
347
364
|
}
|
|
348
365
|
throw error;
|
|
349
366
|
}
|
package/src/storage/routes.ts
CHANGED
|
@@ -145,6 +145,10 @@ export function createStorageRoutes(config: StorageRoutesConfig): Hono<HonoEnv>
|
|
|
145
145
|
* Path: /file/{bucket}/{path} or /file/{path}
|
|
146
146
|
*/
|
|
147
147
|
router.get("/file/*", readAuthMiddleware, async (c) => {
|
|
148
|
+
// Allow cross-origin loading so admin frontends on different
|
|
149
|
+
// ports (dev) or domains (CDN) can render images via <img>.
|
|
150
|
+
c.header("Cross-Origin-Resource-Policy", "cross-origin");
|
|
151
|
+
|
|
148
152
|
const rawPath = extractWildcardPath(c);
|
|
149
153
|
if (!rawPath) {
|
|
150
154
|
throw ApiError.notFound("File not found");
|
package/vite.config.ts
CHANGED
|
@@ -53,6 +53,11 @@ export default defineConfig(() => ({
|
|
|
53
53
|
sourcemap: true,
|
|
54
54
|
rollupOptions: {
|
|
55
55
|
external: isExternal,
|
|
56
|
+
onwarn(warning, warn) {
|
|
57
|
+
if (warning.code === "MISSING_GLOBAL_NAME") return;
|
|
58
|
+
if (warning.code === "INEFFECTIVE_DYNAMIC_IMPORT") return;
|
|
59
|
+
warn(warning);
|
|
60
|
+
},
|
|
56
61
|
output: {
|
|
57
62
|
banner: 'import { createRequire as __createRequire } from "module"; import process from "process"; const require = __createRequire(import.meta.url);',
|
|
58
63
|
globals: {
|