@getcommunity/gc-validators 0.0.74 → 0.0.76

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 CHANGED
@@ -1643,6 +1643,27 @@ var SUpdateUtmTrackingLinkDocumentRequest = v5__namespace.object({
1643
1643
  documentId: IsValidReferenceDocumentId,
1644
1644
  data: SUpdateUtmTrackingLinkDocument
1645
1645
  });
1646
+
1647
+ // src/utilities/datetime.ts
1648
+ function dateToday() {
1649
+ const date2 = /* @__PURE__ */ new Date();
1650
+ date2.setHours(0, 0, 0, 0);
1651
+ return date2;
1652
+ }
1653
+ function datePlusDays(today, days = 30) {
1654
+ const date2 = new Date(today);
1655
+ date2.setDate(date2.getDate() + days);
1656
+ date2.setHours(23, 59, 59, 999);
1657
+ return date2;
1658
+ }
1659
+
1660
+ // src/utilities/strapi-responses.ts
1661
+ function isStrapiAttributeError(result) {
1662
+ return result.error.details.errors.length > 0;
1663
+ }
1664
+ function isStrapiStandardError(result) {
1665
+ return "error" in result && "details" in result.error && typeof result.error.details === "object" && result.error.details !== null && "errors" in result.error.details && result.error.details.errors !== void 0;
1666
+ }
1646
1667
  function validateAndClean(schema, input) {
1647
1668
  var _a, _b;
1648
1669
  try {
@@ -1682,19 +1703,6 @@ function omitUndefined(obj) {
1682
1703
  return result;
1683
1704
  }
1684
1705
 
1685
- // src/utilities/utilities-datetime.ts
1686
- function dateToday() {
1687
- const date2 = /* @__PURE__ */ new Date();
1688
- date2.setHours(0, 0, 0, 0);
1689
- return date2;
1690
- }
1691
- function datePlusDays(today, days = 30) {
1692
- const date2 = new Date(today);
1693
- date2.setDate(date2.getDate() + days);
1694
- date2.setHours(23, 59, 59, 999);
1695
- return date2;
1696
- }
1697
-
1698
1706
  exports.CLIENT_ENTITY_KEYS = CLIENT_ENTITY_KEYS;
1699
1707
  exports.CLIENT_ENTITY_PERMISSIONS = CLIENT_ENTITY_PERMISSIONS;
1700
1708
  exports.CLIENT_ENTITY_SCOPES = CLIENT_ENTITY_SCOPES;
@@ -2014,6 +2022,8 @@ exports.ValidNumberOfEmployeeOptions = ValidNumberOfEmployeeOptions;
2014
2022
  exports.ValidRatingRange5 = ValidRatingRange5;
2015
2023
  exports.datePlusDays = datePlusDays;
2016
2024
  exports.dateToday = dateToday;
2025
+ exports.isStrapiAttributeError = isStrapiAttributeError;
2026
+ exports.isStrapiStandardError = isStrapiStandardError;
2017
2027
  exports.isValidationFailure = isValidationFailure;
2018
2028
  exports.isValidationSuccess = isValidationSuccess;
2019
2029
  exports.omitUndefined = omitUndefined;