@nauth-toolkit/client 0.7.0 → 0.7.2

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
@@ -995,8 +995,8 @@ var AdminOperations = class {
995
995
  * Get user by sub (UUID)
996
996
  *
997
997
  * @param sub - User UUID
998
- * @returns User object
999
- * @throws {NAuthClientError} If user not found
998
+ * @returns The user, or null when no account has that sub
999
+ * @throws {NAuthClientError} If the request fails
1000
1000
  *
1001
1001
  * @example
1002
1002
  * ```typescript
@@ -1082,21 +1082,33 @@ var AdminOperations = class {
1082
1082
  // Password Management
1083
1083
  // ============================================================================
1084
1084
  /**
1085
- * Set password for any user (admin operation)
1085
+ * Set a user's password outright, without their involvement.
1086
1086
  *
1087
- * @param identifier - User email, username, or phone
1087
+ * Both options default to `true` server-side, so the plain two-argument call issues a
1088
+ * temporary password and signs the user out everywhere. Pass `false` to keep the
1089
+ * password permanent or to leave existing sessions alive.
1090
+ *
1091
+ * @param sub - Target user's external identifier (UUID v4)
1088
1092
  * @param newPassword - New password
1089
- * @returns Success confirmation
1093
+ * @param options - Whether to force a change at next login, and whether to revoke sessions
1094
+ * @returns Success, the resulting must-change flag, and the number of sessions revoked
1090
1095
  * @throws {NAuthClientError} If operation fails
1091
1096
  *
1092
1097
  * @example
1093
1098
  * ```typescript
1094
- * await client.admin.setPassword('user@example.com', 'NewSecurePass123!');
1099
+ * // Temporary password, all sessions revoked
1100
+ * await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!');
1101
+ *
1102
+ * // Permanent password, sessions left alone
1103
+ * await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!', {
1104
+ * mustChangePassword: false,
1105
+ * revokeSessions: false,
1106
+ * });
1095
1107
  * ```
1096
1108
  */
1097
- async setPassword(identifier, newPassword) {
1109
+ async setPassword(sub, newPassword, options) {
1098
1110
  const path = this.buildAdminUrl(this.adminEndpoints.setPassword);
1099
- return this.post(path, { identifier, newPassword });
1111
+ return this.post(path, { sub, newPassword, ...options });
1100
1112
  }
1101
1113
  /**
1102
1114
  * Initiate password reset workflow (sends code/link to user)
@@ -1238,7 +1250,7 @@ var AdminOperations = class {
1238
1250
  * @param sub - User UUID
1239
1251
  * @param exempt - True to exempt from MFA, false to require
1240
1252
  * @param reason - Optional reason for exemption
1241
- * @returns Success message
1253
+ * @returns The user's resulting exemption state
1242
1254
  * @throws {NAuthClientError} If operation fails
1243
1255
  *
1244
1256
  * @example
@@ -1283,7 +1295,7 @@ var AdminOperations = class {
1283
1295
  * `sub` wherever the caller already holds one.
1284
1296
  *
1285
1297
  * @param params - Email to look up, and whether to require a verified address
1286
- * @returns The matching user
1298
+ * @returns The matching user, or null when no account matches
1287
1299
  */
1288
1300
  async getUserByEmail(params) {
1289
1301
  const path = this.buildAdminUrl(this.adminEndpoints.getUserByEmail);
@@ -1324,7 +1336,7 @@ var AdminOperations = class {
1324
1336
  *
1325
1337
  * @param sub - Target user's external identifier
1326
1338
  * @param sessionId - Session to revoke
1327
- * @returns Whether the session was revoked
1339
+ * @returns Whether the session was revoked, and whether it was the caller's own
1328
1340
  */
1329
1341
  async revokeUserSession(sub, sessionId) {
1330
1342
  const path = this.buildAdminUrl(this.adminEndpoints.revokeUserSession, { sub, sessionId });