@attlaz/client 1.100.0 → 1.101.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.
@@ -17,6 +17,17 @@ export declare class PasswordCheck {
17
17
  * Treat it as a display hint, not a policy: the server owns the threshold, and a low score with
18
18
  * `code === null` still means accepted.
19
19
  */
20
- strength: number | null;
21
- isAcceptable(): boolean;
20
+ strength: PasswordStrength | null;
21
+ }
22
+ export type PasswordStrength = 0 | 1 | 2 | 3 | 4;
23
+ export declare namespace PasswordStrength {
24
+ /**
25
+ * Throws on anything outside 0–4, rather than degrading to null.
26
+ *
27
+ * Null does not mean "unknown" here — it means the password was refused before it could be
28
+ * scored, and a caller may rely on that: a strength of null with no code is a state the API never
29
+ * produces. Mapping an unexpected number to null would fabricate exactly that combination.
30
+ * Throwing surfaces as a failed check, which callers already handle.
31
+ */
32
+ const fromRaw: (input: unknown) => PasswordStrength | null;
22
33
  }
@@ -11,7 +11,24 @@ export class PasswordCheck {
11
11
  * `code === null` still means accepted.
12
12
  */
13
13
  strength = null;
14
- isAcceptable() {
15
- return this.code === null;
16
- }
17
14
  }
15
+ export var PasswordStrength;
16
+ (function (PasswordStrength) {
17
+ /**
18
+ * Throws on anything outside 0–4, rather than degrading to null.
19
+ *
20
+ * Null does not mean "unknown" here — it means the password was refused before it could be
21
+ * scored, and a caller may rely on that: a strength of null with no code is a state the API never
22
+ * produces. Mapping an unexpected number to null would fabricate exactly that combination.
23
+ * Throwing surfaces as a failed check, which callers already handle.
24
+ */
25
+ PasswordStrength.fromRaw = (input) => {
26
+ if (input === null || input === undefined) {
27
+ return null;
28
+ }
29
+ if (input === 0 || input === 1 || input === 2 || input === 3 || input === 4) {
30
+ return input;
31
+ }
32
+ throw new Error('Unable to parse PasswordStrength: expected 0-4 or null, got "' + String(input) + '"');
33
+ };
34
+ })(PasswordStrength || (PasswordStrength = {}));
@@ -2,7 +2,7 @@ import { path } from '../Http/Data/Path.js';
2
2
  import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
3
3
  import { User } from '../Model/User/User.js';
4
4
  import { UserSummary } from '../Model/User/UserSummary.js';
5
- import { PasswordCheck } from '../Model/User/PasswordCheck.js';
5
+ import { PasswordCheck, PasswordStrength } from '../Model/User/PasswordCheck.js';
6
6
  import { Endpoint } from './Endpoint.js';
7
7
  import { UserNotificationSession } from '../Model/User/UserNotificationSession.js';
8
8
  import { QueryString } from '../Http/Data/QueryString.js';
@@ -149,7 +149,7 @@ export class UserEndpoint extends Endpoint {
149
149
  const check = new PasswordCheck();
150
150
  check.code = (raw.code ?? null);
151
151
  check.error = (raw.error ?? null);
152
- check.strength = (raw.strength ?? null);
152
+ check.strength = PasswordStrength.fromRaw(raw.strength);
153
153
  return check;
154
154
  }
155
155
  async resetPassword(code, password) {
package/dist/index.d.ts CHANGED
@@ -210,7 +210,7 @@ export type { UserActionFilter } from './Model/User/UserActionFilter.js';
210
210
  export { UserSummary } from './Model/User/UserSummary.js';
211
211
  export type { UserSummaryType } from './Model/User/UserSummary.js';
212
212
  export { PasswordCheck } from './Model/User/PasswordCheck.js';
213
- export type { PasswordCheckCode } from './Model/User/PasswordCheck.js';
213
+ export type { PasswordCheckCode, PasswordStrength } from './Model/User/PasswordCheck.js';
214
214
  export { RunnerImage } from './Model/Runner/RunnerImage.js';
215
215
  export { Component } from './Model/Component/Component.js';
216
216
  export { ComponentKind } from './Model/Component/ComponentKind.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.99.0";
1
+ export declare const VERSION = "1.100.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.99.0";
1
+ export const VERSION = "1.100.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.100.0",
3
+ "version": "1.101.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",