edmaxlabs-core 2.5.1 → 2.5.3
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.cjs +2 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -382,20 +382,12 @@ function validateDocumentData(data, operation) {
|
|
|
382
382
|
if (typeof data !== "object" || Array.isArray(data)) {
|
|
383
383
|
throw new Error(`${operation}: data must be a plain object`);
|
|
384
384
|
}
|
|
385
|
-
const reservedFields = ["
|
|
385
|
+
const reservedFields = ["_id", "_createdAt", "_updatedAt", "_deleted", "_v", "_s"];
|
|
386
386
|
for (const field of reservedFields) {
|
|
387
387
|
if (field in data) {
|
|
388
388
|
throw new Error(`${operation}: '${field}' is a reserved field and cannot be set manually`);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
try {
|
|
392
|
-
const size = JSON.stringify(data).length;
|
|
393
|
-
if (size > 1024 * 1024) {
|
|
394
|
-
throw new Error(`${operation}: document too large (max 1MB)`);
|
|
395
|
-
}
|
|
396
|
-
} catch {
|
|
397
|
-
throw new Error(`${operation}: data contains circular references`);
|
|
398
|
-
}
|
|
399
391
|
}
|
|
400
392
|
var DocumentRef = class {
|
|
401
393
|
constructor(app, collection, id) {
|
|
@@ -2304,7 +2296,7 @@ var StorageRef = class {
|
|
|
2304
2296
|
const res = await new HttpsRequest({
|
|
2305
2297
|
method: "POST" /* POST */,
|
|
2306
2298
|
endpoint: this.app.getBaseUrl() + "/storage/file/upload",
|
|
2307
|
-
headers: { authorization: this.app.getConfig().token, project: this.app.getConfig().project },
|
|
2299
|
+
headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
|
|
2308
2300
|
file: srcFile,
|
|
2309
2301
|
isMultipart: true
|
|
2310
2302
|
}).sendRequest();
|