@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.
@@ -98,8 +98,10 @@ export interface User {
98
98
  privacySettings?: PrivacySettings;
99
99
  /**
100
100
  * Structured human name. `name.displayName` is the canonical display string
101
- * resolved by the API; consumers render it directly instead of recomposing
102
- * names from `first` / `last` / `full` / `username`.
101
+ * resolved by the API when present; consumers render it directly instead of
102
+ * recomposing names from `first` / `last` / `full` / `username`. It is now
103
+ * OPTIONAL (see `UserNameResponse`) — when absent, fall back to a handle
104
+ * (e.g. `getNormalizedUserHandle`) rather than recomposing a name locally.
103
105
  */
104
106
  name: UserNameResponse;
105
107
  bio?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/core",
3
- "version": "3.17.1",
3
+ "version": "3.18.0",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1026,7 +1026,9 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
1026
1026
  continue;
1027
1027
  }
1028
1028
  const userId = e.user.id ?? e.user._id;
1029
- if (!userId || !e.user.username || !e.user.name?.displayName) {
1029
+ // `name.displayName` is optional on the contract — do NOT drop no-name
1030
+ // accounts. Only an absent userId or username makes the entry unusable.
1031
+ if (!userId || !e.user.username) {
1030
1032
  continue;
1031
1033
  }
1032
1034
  if (typeof e.authuser !== 'number') {
@@ -1040,7 +1042,9 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
1040
1042
  user: {
1041
1043
  id: userId,
1042
1044
  username: e.user.username,
1043
- name: e.user.name,
1045
+ // `name.displayName` is optional; carry whatever structured name the
1046
+ // server sent (possibly an empty object) and let consumers fall back.
1047
+ name: e.user.name ?? {},
1044
1048
  avatar: e.user.avatar ?? null,
1045
1049
  email: e.user.email,
1046
1050
  color: e.user.color ?? null,
@@ -171,14 +171,17 @@ export function OxyServicesSsoMixin<T extends typeof OxyServicesBase>(Base: T) {
171
171
  }
172
172
 
173
173
  const userId = payload.user?.id ?? payload.user?._id;
174
- if (!userId || typeof payload.user?.username !== 'string' || typeof payload.user.name?.displayName !== 'string') {
174
+ if (!userId || typeof payload.user?.username !== 'string') {
175
175
  throw this.handleError(new Error('SSO exchange returned an invalid user'));
176
176
  }
177
177
 
178
178
  const user: MinimalUserData = {
179
179
  id: userId,
180
180
  username: payload.user.username,
181
- name: payload.user.name,
181
+ // `name.displayName` is optional on the contract. A no-name user is
182
+ // valid; carry whatever structured name the server sent (possibly an
183
+ // empty object) and let consumers fall back to a handle.
184
+ name: payload.user.name ?? {},
182
185
  avatar: payload.user.avatar,
183
186
  };
184
187
 
@@ -108,8 +108,10 @@ export interface User {
108
108
  privacySettings?: PrivacySettings;
109
109
  /**
110
110
  * Structured human name. `name.displayName` is the canonical display string
111
- * resolved by the API; consumers render it directly instead of recomposing
112
- * names from `first` / `last` / `full` / `username`.
111
+ * resolved by the API when present; consumers render it directly instead of
112
+ * recomposing names from `first` / `last` / `full` / `username`. It is now
113
+ * OPTIONAL (see `UserNameResponse`) — when absent, fall back to a handle
114
+ * (e.g. `getNormalizedUserHandle`) rather than recomposing a name locally.
113
115
  */
114
116
  name: UserNameResponse;
115
117
  bio?: string;