@objectstack/plugin-auth 9.8.0 → 9.9.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 CHANGED
@@ -1747,6 +1747,10 @@ var AuthPlugin = class {
1747
1747
  const trimmed = value.trim();
1748
1748
  return trimmed ? trimmed : void 0;
1749
1749
  };
1750
+ const asPositiveInt = (value) => {
1751
+ const n = Math.floor(Number(value));
1752
+ return Number.isFinite(n) && n > 0 ? n : void 0;
1753
+ };
1750
1754
  const patch = {};
1751
1755
  const emailAndPassword = {};
1752
1756
  if (isExplicit("email_password_enabled")) {
@@ -1761,9 +1765,29 @@ var AuthPlugin = class {
1761
1765
  false
1762
1766
  );
1763
1767
  }
1768
+ if (isExplicit("password_min_length")) {
1769
+ const n = asPositiveInt(values.password_min_length);
1770
+ if (n !== void 0) emailAndPassword.minPasswordLength = n;
1771
+ }
1772
+ if (isExplicit("password_max_length")) {
1773
+ const n = asPositiveInt(values.password_max_length);
1774
+ if (n !== void 0) emailAndPassword.maxPasswordLength = n;
1775
+ }
1764
1776
  if (Object.keys(emailAndPassword).length > 0) {
1765
1777
  patch.emailAndPassword = emailAndPassword;
1766
1778
  }
1779
+ const session = {};
1780
+ if (isExplicit("session_expiry_days")) {
1781
+ const d = asPositiveInt(values.session_expiry_days);
1782
+ if (d !== void 0) session.expiresIn = d * 86400;
1783
+ }
1784
+ if (isExplicit("session_refresh_days")) {
1785
+ const d = asPositiveInt(values.session_refresh_days);
1786
+ if (d !== void 0) session.updateAge = d * 86400;
1787
+ }
1788
+ if (Object.keys(session).length > 0) {
1789
+ patch.session = session;
1790
+ }
1767
1791
  if (isExplicit("google_enabled") || isExplicit("google_client_id") || isExplicit("google_client_secret")) {
1768
1792
  const socialProviders = {
1769
1793
  ...this.configuredSocialProviders ?? {}