@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/dist/index.es.js
CHANGED
|
@@ -3265,7 +3265,9 @@ var RestApiGenerator = class {
|
|
|
3265
3265
|
});
|
|
3266
3266
|
return c.json(response, 201);
|
|
3267
3267
|
} catch (error) {
|
|
3268
|
-
if (isRebaseApiError(error) && !error.code)
|
|
3268
|
+
if (isRebaseApiError(error) && !error.code) {
|
|
3269
|
+
if (!(error instanceof TypeError || error instanceof RangeError || error instanceof SyntaxError || error instanceof ReferenceError)) error.code = "BAD_REQUEST";
|
|
3270
|
+
}
|
|
3269
3271
|
throw error;
|
|
3270
3272
|
}
|
|
3271
3273
|
});
|
|
@@ -3295,7 +3297,9 @@ var RestApiGenerator = class {
|
|
|
3295
3297
|
});
|
|
3296
3298
|
return c.json(response);
|
|
3297
3299
|
} catch (error) {
|
|
3298
|
-
if (isRebaseApiError(error) && !error.code)
|
|
3300
|
+
if (isRebaseApiError(error) && !error.code) {
|
|
3301
|
+
if (!(error instanceof TypeError || error instanceof RangeError || error instanceof SyntaxError || error instanceof ReferenceError)) error.code = "BAD_REQUEST";
|
|
3302
|
+
}
|
|
3299
3303
|
throw error;
|
|
3300
3304
|
}
|
|
3301
3305
|
});
|
|
@@ -20500,6 +20504,7 @@ function createStorageRoutes(config) {
|
|
|
20500
20504
|
* Path: /file/{bucket}/{path} or /file/{path}
|
|
20501
20505
|
*/
|
|
20502
20506
|
router.get("/file/*", readAuthMiddleware, async (c) => {
|
|
20507
|
+
c.header("Cross-Origin-Resource-Policy", "cross-origin");
|
|
20503
20508
|
const rawPath = extractWildcardPath(c);
|
|
20504
20509
|
if (!rawPath) throw ApiError.notFound("File not found");
|
|
20505
20510
|
const filePath = decodeURIComponent(rawPath);
|
|
@@ -31537,7 +31542,7 @@ function normalizeWhereValue(value) {
|
|
|
31537
31542
|
}
|
|
31538
31543
|
function serializeLogicalCondition(cond) {
|
|
31539
31544
|
if ("type" in cond) {
|
|
31540
|
-
const sub = cond.conditions.map(serializeLogicalCondition).join(",");
|
|
31545
|
+
const sub = (cond.conditions ?? []).map(serializeLogicalCondition).join(",");
|
|
31541
31546
|
return `${cond.type}(${sub})`;
|
|
31542
31547
|
} else {
|
|
31543
31548
|
const op = OP_MAP[cond.operator] ?? cond.operator;
|
|
@@ -31558,7 +31563,7 @@ function buildQueryString(params) {
|
|
|
31558
31563
|
if (params.include && params.include.length > 0) parts.push(`include=${encodeURIComponent(params.include.join(","))}`);
|
|
31559
31564
|
if (params.logical) {
|
|
31560
31565
|
const root = params.logical;
|
|
31561
|
-
const serialized = root.conditions.map(serializeLogicalCondition).join(",");
|
|
31566
|
+
const serialized = (root.conditions ?? []).map(serializeLogicalCondition).join(",");
|
|
31562
31567
|
parts.push(`${root.type}=${encodeURIComponent(`(${serialized})`)}`);
|
|
31563
31568
|
}
|
|
31564
31569
|
if (params.where) for (const [field, value] of Object.entries(params.where)) if (Array.isArray(value) && value.length > 0 && Array.isArray(value[0])) for (const subVal of value) {
|