@budibase/backend-core 2.27.5 → 2.28.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/index.js +31 -10
- package/dist/index.js.map +3 -3
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.map +1 -1
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/middleware/joi-validator.d.ts +6 -2
- package/dist/src/middleware/joi-validator.js +10 -6
- package/dist/src/middleware/joi-validator.js.map +1 -1
- package/dist/src/objectStore/objectStore.d.ts +10 -2
- package/dist/src/objectStore/objectStore.js +13 -2
- package/dist/src/objectStore/objectStore.js.map +1 -1
- package/package.json +4 -4
- package/src/middleware/joi-validator.ts +17 -6
- package/src/objectStore/objectStore.ts +21 -7
package/dist/index.js
CHANGED
|
@@ -55021,12 +55021,17 @@ function validate(cronExpression) {
|
|
|
55021
55021
|
// ../shared-core/src/helpers/schema.ts
|
|
55022
55022
|
var schema_exports = {};
|
|
55023
55023
|
__export(schema_exports, {
|
|
55024
|
-
isDeprecatedSingleUserColumn: () => isDeprecatedSingleUserColumn
|
|
55024
|
+
isDeprecatedSingleUserColumn: () => isDeprecatedSingleUserColumn,
|
|
55025
|
+
isRequired: () => isRequired
|
|
55025
55026
|
});
|
|
55026
55027
|
function isDeprecatedSingleUserColumn(schema) {
|
|
55027
55028
|
const result = schema.type === "bb_reference" /* BB_REFERENCE */ && schema.subtype === "user" /* USER */ && schema.constraints?.type !== "array";
|
|
55028
55029
|
return result;
|
|
55029
55030
|
}
|
|
55031
|
+
function isRequired(constraints) {
|
|
55032
|
+
const isRequired2 = !!constraints && (typeof constraints.presence !== "boolean" && constraints.presence?.allowEmpty === false || constraints.presence === true);
|
|
55033
|
+
return isRequired2;
|
|
55034
|
+
}
|
|
55030
55035
|
|
|
55031
55036
|
// ../shared-core/src/filters.ts
|
|
55032
55037
|
var HBS_REGEX = /{{([^{].*?)}}/g;
|
|
@@ -58686,6 +58691,9 @@ async function streamUpload({
|
|
|
58686
58691
|
extra,
|
|
58687
58692
|
ttl
|
|
58688
58693
|
}) {
|
|
58694
|
+
if (!stream3) {
|
|
58695
|
+
throw new Error("Stream to upload is invalid/undefined");
|
|
58696
|
+
}
|
|
58689
58697
|
const extension = filename.split(".").pop();
|
|
58690
58698
|
const objectStore = ObjectStore(bucketName);
|
|
58691
58699
|
const bucketCreated = await createBucketIfNotExists(objectStore, bucketName);
|
|
@@ -58708,14 +58716,23 @@ async function streamUpload({
|
|
|
58708
58716
|
if (!contentType) {
|
|
58709
58717
|
contentType = extension ? CONTENT_TYPE_MAP[extension.toLowerCase()] : CONTENT_TYPE_MAP.txt;
|
|
58710
58718
|
}
|
|
58719
|
+
const bucket = sanitizeBucket(bucketName), objKey = sanitizeKey(filename);
|
|
58711
58720
|
const params2 = {
|
|
58712
|
-
Bucket:
|
|
58713
|
-
Key:
|
|
58721
|
+
Bucket: bucket,
|
|
58722
|
+
Key: objKey,
|
|
58714
58723
|
Body: stream3,
|
|
58715
58724
|
ContentType: contentType,
|
|
58716
58725
|
...extra
|
|
58717
58726
|
};
|
|
58718
|
-
|
|
58727
|
+
const details = await objectStore.upload(params2).promise();
|
|
58728
|
+
const headDetails = await objectStore.headObject({
|
|
58729
|
+
Bucket: bucket,
|
|
58730
|
+
Key: objKey
|
|
58731
|
+
}).promise();
|
|
58732
|
+
return {
|
|
58733
|
+
...details,
|
|
58734
|
+
ContentLength: headDetails.ContentLength
|
|
58735
|
+
};
|
|
58719
58736
|
}
|
|
58720
58737
|
async function retrieve(bucketName, filepath) {
|
|
58721
58738
|
const objectStore = ObjectStore(bucketName);
|
|
@@ -66454,7 +66471,7 @@ __export(joi_validator_exports, {
|
|
|
66454
66471
|
params: () => params
|
|
66455
66472
|
});
|
|
66456
66473
|
var import_joi = __toESM(require("joi"));
|
|
66457
|
-
function validate2(schema, property) {
|
|
66474
|
+
function validate2(schema, property, opts = { errorPrefix: `Invalid ${property}` }) {
|
|
66458
66475
|
return (ctx, next) => {
|
|
66459
66476
|
if (!schema) {
|
|
66460
66477
|
return next();
|
|
@@ -66474,16 +66491,20 @@ function validate2(schema, property) {
|
|
|
66474
66491
|
}
|
|
66475
66492
|
const { error } = schema.validate(params2);
|
|
66476
66493
|
if (error) {
|
|
66477
|
-
|
|
66494
|
+
let message = error.message;
|
|
66495
|
+
if (opts.errorPrefix) {
|
|
66496
|
+
message = `Invalid ${property} - ${message}`;
|
|
66497
|
+
}
|
|
66498
|
+
ctx.throw(400, message);
|
|
66478
66499
|
}
|
|
66479
66500
|
return next();
|
|
66480
66501
|
};
|
|
66481
66502
|
}
|
|
66482
|
-
function body(schema) {
|
|
66483
|
-
return validate2(schema, "body");
|
|
66503
|
+
function body(schema, opts) {
|
|
66504
|
+
return validate2(schema, "body", opts);
|
|
66484
66505
|
}
|
|
66485
|
-
function params(schema) {
|
|
66486
|
-
return validate2(schema, "params");
|
|
66506
|
+
function params(schema, opts) {
|
|
66507
|
+
return validate2(schema, "params", opts);
|
|
66487
66508
|
}
|
|
66488
66509
|
|
|
66489
66510
|
// src/middleware/index.ts
|