@budibase/shared-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.
@@ -1,5 +1,6 @@
1
- import { BBReferenceFieldSubType, FieldSchema, FieldType } from "@budibase/types";
1
+ import { BBReferenceFieldSubType, FieldConstraints, FieldSchema, FieldType } from "@budibase/types";
2
2
  export declare function isDeprecatedSingleUserColumn(schema: Pick<FieldSchema, "type" | "subtype" | "constraints">): schema is {
3
3
  type: FieldType.BB_REFERENCE;
4
4
  subtype: BBReferenceFieldSubType.USER;
5
5
  };
6
+ export declare function isRequired(constraints: FieldConstraints | undefined): boolean;
package/dist/index.js CHANGED
@@ -5019,12 +5019,17 @@ function validate(cronExpression) {
5019
5019
  // src/helpers/schema.ts
5020
5020
  var schema_exports = {};
5021
5021
  __export(schema_exports, {
5022
- isDeprecatedSingleUserColumn: () => isDeprecatedSingleUserColumn
5022
+ isDeprecatedSingleUserColumn: () => isDeprecatedSingleUserColumn,
5023
+ isRequired: () => isRequired
5023
5024
  });
5024
5025
  function isDeprecatedSingleUserColumn(schema) {
5025
5026
  const result = schema.type === "bb_reference" /* BB_REFERENCE */ && schema.subtype === "user" /* USER */ && schema.constraints?.type !== "array";
5026
5027
  return result;
5027
5028
  }
5029
+ function isRequired(constraints) {
5030
+ const isRequired2 = !!constraints && (typeof constraints.presence !== "boolean" && constraints.presence?.allowEmpty === false || constraints.presence === true);
5031
+ return isRequired2;
5032
+ }
5028
5033
 
5029
5034
  // src/filters.ts
5030
5035
  var HBS_REGEX = /{{([^{].*?)}}/g;