@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.mjs CHANGED
@@ -1699,6 +1699,10 @@ var AuthPlugin = class {
1699
1699
  const trimmed = value.trim();
1700
1700
  return trimmed ? trimmed : void 0;
1701
1701
  };
1702
+ const asPositiveInt = (value) => {
1703
+ const n = Math.floor(Number(value));
1704
+ return Number.isFinite(n) && n > 0 ? n : void 0;
1705
+ };
1702
1706
  const patch = {};
1703
1707
  const emailAndPassword = {};
1704
1708
  if (isExplicit("email_password_enabled")) {
@@ -1713,9 +1717,29 @@ var AuthPlugin = class {
1713
1717
  false
1714
1718
  );
1715
1719
  }
1720
+ if (isExplicit("password_min_length")) {
1721
+ const n = asPositiveInt(values.password_min_length);
1722
+ if (n !== void 0) emailAndPassword.minPasswordLength = n;
1723
+ }
1724
+ if (isExplicit("password_max_length")) {
1725
+ const n = asPositiveInt(values.password_max_length);
1726
+ if (n !== void 0) emailAndPassword.maxPasswordLength = n;
1727
+ }
1716
1728
  if (Object.keys(emailAndPassword).length > 0) {
1717
1729
  patch.emailAndPassword = emailAndPassword;
1718
1730
  }
1731
+ const session = {};
1732
+ if (isExplicit("session_expiry_days")) {
1733
+ const d = asPositiveInt(values.session_expiry_days);
1734
+ if (d !== void 0) session.expiresIn = d * 86400;
1735
+ }
1736
+ if (isExplicit("session_refresh_days")) {
1737
+ const d = asPositiveInt(values.session_refresh_days);
1738
+ if (d !== void 0) session.updateAge = d * 86400;
1739
+ }
1740
+ if (Object.keys(session).length > 0) {
1741
+ patch.session = session;
1742
+ }
1719
1743
  if (isExplicit("google_enabled") || isExplicit("google_client_id") || isExplicit("google_client_secret")) {
1720
1744
  const socialProviders = {
1721
1745
  ...this.configuredSocialProviders ?? {}