@oxyhq/core 3.17.1 → 3.18.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.
@@ -694,7 +694,9 @@ function OxyServicesAuthMixin(Base) {
694
694
  continue;
695
695
  }
696
696
  const userId = e.user.id ?? e.user._id;
697
- if (!userId || !e.user.username || !e.user.name?.displayName) {
697
+ // `name.displayName` is optional on the contract — do NOT drop no-name
698
+ // accounts. Only an absent userId or username makes the entry unusable.
699
+ if (!userId || !e.user.username) {
698
700
  continue;
699
701
  }
700
702
  if (typeof e.authuser !== 'number') {
@@ -708,7 +710,9 @@ function OxyServicesAuthMixin(Base) {
708
710
  user: {
709
711
  id: userId,
710
712
  username: e.user.username,
711
- name: e.user.name,
713
+ // `name.displayName` is optional; carry whatever structured name the
714
+ // server sent (possibly an empty object) and let consumers fall back.
715
+ name: e.user.name ?? {},
712
716
  avatar: e.user.avatar ?? null,
713
717
  email: e.user.email,
714
718
  color: e.user.color ?? null,
@@ -142,13 +142,16 @@ function OxyServicesSsoMixin(Base) {
142
142
  throw this.handleError(new Error('SSO exchange returned no sessionId'));
143
143
  }
144
144
  const userId = payload.user?.id ?? payload.user?._id;
145
- if (!userId || typeof payload.user?.username !== 'string' || typeof payload.user.name?.displayName !== 'string') {
145
+ if (!userId || typeof payload.user?.username !== 'string') {
146
146
  throw this.handleError(new Error('SSO exchange returned an invalid user'));
147
147
  }
148
148
  const user = {
149
149
  id: userId,
150
150
  username: payload.user.username,
151
- name: payload.user.name,
151
+ // `name.displayName` is optional on the contract. A no-name user is
152
+ // valid; carry whatever structured name the server sent (possibly an
153
+ // empty object) and let consumers fall back to a handle.
154
+ name: payload.user.name ?? {},
152
155
  avatar: payload.user.avatar,
153
156
  };
154
157
  // Plant the access token exactly like exchangeIdTokenForSession does.