@authup/errors 1.0.0-beta.64 → 1.0.0-beta.66

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.
@@ -2,6 +2,7 @@ import { type AuthHeaderError } from './auth-header.ts';
2
2
  import { type BadRequestError } from './bad-request.ts';
3
3
  import { type ValidationError } from './validation.ts';
4
4
  import { type BearerTokenMalformedError } from './bearer-token.ts';
5
+ import { type DeviceVerificationThrottledError } from './device-verification-throttled.ts';
5
6
  import { type EntityConflictError } from './entity-conflict.ts';
6
7
  import { type EntityCredentialsInvalidError } from './entity-credentials-invalid.ts';
7
8
  import { type EntityInactiveError } from './entity-inactive.ts';
@@ -22,4 +23,5 @@ export declare function isEntityCredentialsInvalidError(input: unknown): input i
22
23
  export declare function isInternalError(input: unknown): input is InternalError;
23
24
  export declare function isLoginThrottledError(input: unknown): input is LoginThrottledError;
24
25
  export declare function isMfaThrottledError(input: unknown): input is MfaThrottledError;
26
+ export declare function isDeviceVerificationThrottledError(input: unknown): input is DeviceVerificationThrottledError;
25
27
  //# sourceMappingURL=check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/built-in/check.ts"],"names":[],"mappings":"AAUA,OAAO,EAA8B,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAA8B,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAyC,KAAK,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,EAAkC,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAA6C,KAAK,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChI,OAAO,EAAkC,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAmC,KAAK,mBAAmB,EAAE,MAAM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,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAIlF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAIlF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAIlF;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,6BAA6B,CAItG;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAItE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAIlF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAI9E;AAED,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gCAAgC,CAI5G"}
@@ -0,0 +1,13 @@
1
+ import { AuthupError } from '../module.ts';
2
+ import type { AuthupErrorOptions } from '../types.ts';
3
+ export declare const DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE: unique symbol;
4
+ export type DeviceVerificationThrottledErrorOptions = AuthupErrorOptions & {
5
+ /**
6
+ * Seconds until the per-actor lookup window releases the account.
7
+ */
8
+ retryAfter?: number;
9
+ };
10
+ export declare class DeviceVerificationThrottledError extends AuthupError {
11
+ constructor(input?: DeviceVerificationThrottledErrorOptions);
12
+ }
13
+ //# sourceMappingURL=device-verification-throttled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-verification-throttled.d.ts","sourceRoot":"","sources":["../../src/built-in/device-verification-throttled.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,eAAO,MAAM,4CAA4C,eAAgE,CAAC;AAE1H,MAAM,MAAM,uCAAuC,GAAG,kBAAkB,GAAG;IACvE;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,qBAAa,gCAAiC,SAAQ,WAAW;gBACjD,KAAK,CAAC,EAAE,uCAAuC;CAa9D"}
@@ -2,6 +2,7 @@ export * from './auth-header';
2
2
  export * from './bad-request';
3
3
  export * from './bearer-token';
4
4
  export * from './check';
5
+ export * from './device-verification-throttled';
5
6
  export * from './entity-conflict';
6
7
  export * from './entity-credentials-invalid';
7
8
  export * from './entity-inactive';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/built-in/index.ts"],"names":[],"mappings":"AAOA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/built-in/index.ts"],"names":[],"mappings":"AAOA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
@@ -47,6 +47,10 @@ export declare enum ErrorCode {
47
47
  OAUTH_RESPONSE_TYPE_UNSUPPORTED = "unsupported_response_type",
48
48
  OAUTH_SCOPE_INVALID = "invalid_scope",
49
49
  OAUTH_SCOPE_INSUFFICIENT = "insufficient_scope",
50
+ OAUTH_AUTHORIZATION_PENDING = "authorization_pending",
51
+ OAUTH_SLOW_DOWN = "slow_down",
52
+ OAUTH_DEVICE_CODE_EXPIRED = "device_code_expired",
53
+ OAUTH_DEVICE_VERIFICATION_THROTTLED = "device_verification_throttled",
50
54
  PERMISSION_NOT_FOUND = "permission_not_found",
51
55
  PERMISSION_DENIED = "permission_denied",
52
56
  PERMISSION_EVALUATION_FAILED = "permission_evaluation_failed",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,SAAS;IAEjB,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IAEjC;;;;;;OAMG;IACH,cAAc,mBAAmB;IAGjC,iCAAiC,iCAAiC;IAClE,2BAA2B,2BAA2B;IAGtD,qBAAqB,0BAA0B;IAG/C,0BAA0B,wBAAwB;IAClD,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,uBAAuB,4BAA4B;IAGnD,qBAAqB,0BAA0B;IAC/C,0BAA0B,+BAA+B;IACzD,2BAA2B,gCAAgC;IAC3D,mBAAmB,wBAAwB;IAC3C,uBAAuB,4BAA4B;IACnD,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,wCAAwC,6CAA6C;IACrF,wCAAwC,6CAA6C;IAGrF,oBAAoB,yBAAyB;IAG7C,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAG/B,WAAW,kBAAkB;IAC7B,YAAY,mBAAmB;IAC/B,WAAW,kBAAkB;IAG7B,2BAA2B,0BAA0B;IACrD,oBAAoB,mBAAmB;IACvC,yBAAyB,wBAAwB;IACjD,mBAAmB,kBAAkB;IACrC,4B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IACzC,oBAAoB,mBAAmB;IACvC,kBAAkB,iBAAiB;IACnC,mBAAmB,kBAAkB;IACrC,0BAA0B,yBAAyB;IACnD,gCAAgC,+BAA+B;IAC/D,sBAAsB,qBAAqB;IAC3C,+BAA+B,8BAA8B;IAC7D,mBAAmB,kBAAkB;IACrC,wBAAwB,uBAAuB;IAC/C,2BAA2B,0BAA0B;IACrD,eAAe,cAAc;IAC7B,yBAAyB,wBAAwB;IACjD,mCAAmC,kCAAkC;IAGrE,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,4BAA4B,iCAAiC;IAG7D,0BAA0B,+BAA+B;IACzD,gCAAgC,qCAAqC;IACrE,gCAAgC,qCAAqC;CACxE"}
package/dist/index.d.mts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { BASE_ERROR_INSTANCE, BaseError, ErrorOptions, INSTANCEOF_PROPERTY, hasInstanceof, markInstanceof, matchesInstanceof, serializeInstanceofChain } from "@ebec/core";
2
2
  //#region src/types.d.ts
3
- type AuthupErrorOptions = ErrorOptions & {
3
+ export type AuthupErrorOptions = ErrorOptions & {
4
4
  data?: Record<string, any>;
5
5
  };
6
- type AuthupErrorInput = string | AuthupErrorOptions;
7
- type AuthupEntityErrorOptions = AuthupErrorOptions & {
6
+ export type AuthupErrorInput = string | AuthupErrorOptions;
7
+ export type AuthupEntityErrorOptions = AuthupErrorOptions & {
8
8
  entity?: string;
9
9
  };
10
- type AuthupEntityErrorInput = string | AuthupEntityErrorOptions;
10
+ export type AuthupEntityErrorInput = string | AuthupEntityErrorOptions;
11
11
  //#endregion
12
12
  //#region src/module.d.ts
13
- declare const AUTHUP_ERROR_INSTANCE: unique symbol;
14
- declare class AuthupError extends BaseError {
13
+ export declare const AUTHUP_ERROR_INSTANCE: unique symbol;
14
+ export declare class AuthupError extends BaseError {
15
15
  readonly data?: Record<string, any>;
16
16
  constructor(input?: AuthupErrorInput);
17
17
  /**
@@ -31,109 +31,122 @@ declare class AuthupError extends BaseError {
31
31
  }
32
32
  //#endregion
33
33
  //#region src/built-in/unauthorized.d.ts
34
- declare const UNAUTHORIZED_ERROR_INSTANCE: unique symbol;
35
- declare class UnauthorizedError extends AuthupError {
34
+ export declare const UNAUTHORIZED_ERROR_INSTANCE: unique symbol;
35
+ export declare class UnauthorizedError extends AuthupError {
36
36
  constructor(input?: string | AuthupErrorOptions);
37
37
  }
38
38
  //#endregion
39
39
  //#region src/built-in/auth-header.d.ts
40
- declare const AUTH_HEADER_ERROR_INSTANCE: unique symbol;
41
- declare class AuthHeaderError extends UnauthorizedError {
40
+ export declare const AUTH_HEADER_ERROR_INSTANCE: unique symbol;
41
+ export declare class AuthHeaderError extends UnauthorizedError {
42
42
  constructor(message: string);
43
43
  static unsupportedType(type: string): AuthHeaderError;
44
44
  }
45
45
  //#endregion
46
46
  //#region src/built-in/bad-request.d.ts
47
- declare const BAD_REQUEST_ERROR_INSTANCE: unique symbol;
48
- declare class BadRequestError extends AuthupError {
47
+ export declare const BAD_REQUEST_ERROR_INSTANCE: unique symbol;
48
+ export declare class BadRequestError extends AuthupError {
49
49
  constructor(input?: string | AuthupErrorOptions);
50
50
  }
51
51
  //#endregion
52
52
  //#region src/built-in/bearer-token.d.ts
53
- declare const BEARER_TOKEN_MALFORMED_ERROR_INSTANCE: unique symbol;
54
- declare class BearerTokenMalformedError extends UnauthorizedError {
53
+ export declare const BEARER_TOKEN_MALFORMED_ERROR_INSTANCE: unique symbol;
54
+ export declare class BearerTokenMalformedError extends UnauthorizedError {
55
55
  constructor(message?: string);
56
56
  }
57
57
  //#endregion
58
58
  //#region src/built-in/validation.d.ts
59
- declare const VALIDATION_ERROR_INSTANCE: unique symbol;
59
+ export declare const VALIDATION_ERROR_INSTANCE: unique symbol;
60
60
  /**
61
61
  * A domain/business-rule violation raised by core logic. Deliberately NOT
62
62
  * named after an HTTP status: core code stays transport-agnostic, and the HTTP
63
63
  * adapter maps its `ErrorCode.BAD_REQUEST` to a 400 response
64
64
  * (`httpStatusFromCode`). Prefer this over `BadRequestError` in `core/**`.
65
65
  */
66
- declare class ValidationError extends AuthupError {
66
+ export declare class ValidationError extends AuthupError {
67
67
  constructor(input?: string | AuthupErrorOptions);
68
68
  }
69
69
  //#endregion
70
+ //#region src/built-in/device-verification-throttled.d.ts
71
+ export declare const DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE: unique symbol;
72
+ export type DeviceVerificationThrottledErrorOptions = AuthupErrorOptions & {
73
+ /**
74
+ * Seconds until the per-actor lookup window releases the account.
75
+ */
76
+ retryAfter?: number;
77
+ };
78
+ export declare class DeviceVerificationThrottledError extends AuthupError {
79
+ constructor(input?: DeviceVerificationThrottledErrorOptions);
80
+ }
81
+ //#endregion
70
82
  //#region src/built-in/entity-conflict.d.ts
71
- declare const ENTITY_CONFLICT_ERROR_INSTANCE: unique symbol;
72
- declare class EntityConflictError extends AuthupError {
83
+ export declare const ENTITY_CONFLICT_ERROR_INSTANCE: unique symbol;
84
+ export declare class EntityConflictError extends AuthupError {
73
85
  constructor(input?: string | AuthupEntityErrorOptions);
74
86
  }
75
87
  //#endregion
76
88
  //#region src/built-in/entity-credentials-invalid.d.ts
77
- declare const ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE: unique symbol;
78
- declare class EntityCredentialsInvalidError extends AuthupError {
89
+ export declare const ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE: unique symbol;
90
+ export declare class EntityCredentialsInvalidError extends AuthupError {
79
91
  constructor(input?: string | AuthupEntityErrorOptions);
80
92
  }
81
93
  //#endregion
82
94
  //#region src/built-in/entity-inactive.d.ts
83
- declare const ENTITY_INACTIVE_ERROR_INSTANCE: unique symbol;
84
- declare class EntityInactiveError extends AuthupError {
95
+ export declare const ENTITY_INACTIVE_ERROR_INSTANCE: unique symbol;
96
+ export declare class EntityInactiveError extends AuthupError {
85
97
  constructor(input?: string | AuthupEntityErrorOptions);
86
98
  }
87
99
  //#endregion
88
100
  //#region src/built-in/entity-not-found.d.ts
89
- declare const ENTITY_NOT_FOUND_ERROR_INSTANCE: unique symbol;
90
- declare class EntityNotFoundError extends AuthupError {
101
+ export declare const ENTITY_NOT_FOUND_ERROR_INSTANCE: unique symbol;
102
+ export declare class EntityNotFoundError extends AuthupError {
91
103
  constructor(input?: string | AuthupEntityErrorOptions);
92
104
  }
93
105
  //#endregion
94
106
  //#region src/built-in/internal.d.ts
95
- declare const INTERNAL_ERROR_INSTANCE: unique symbol;
96
- declare class InternalError extends AuthupError {
107
+ export declare const INTERNAL_ERROR_INSTANCE: unique symbol;
108
+ export declare class InternalError extends AuthupError {
97
109
  constructor(input?: string | AuthupErrorOptions);
98
110
  }
99
111
  //#endregion
100
112
  //#region src/built-in/login-throttled.d.ts
101
- declare const LOGIN_THROTTLED_ERROR_INSTANCE: unique symbol;
102
- type LoginThrottledErrorOptions = AuthupErrorOptions & {
113
+ export declare const LOGIN_THROTTLED_ERROR_INSTANCE: unique symbol;
114
+ export type LoginThrottledErrorOptions = AuthupErrorOptions & {
103
115
  /**
104
116
  * Seconds until the sliding throttle window can release the pair.
105
117
  */
106
118
  retryAfter?: number;
107
119
  };
108
- declare class LoginThrottledError extends AuthupError {
120
+ export declare class LoginThrottledError extends AuthupError {
109
121
  constructor(input?: LoginThrottledErrorOptions);
110
122
  }
111
123
  //#endregion
112
124
  //#region src/built-in/mfa-throttled.d.ts
113
- declare const MFA_THROTTLED_ERROR_INSTANCE: unique symbol;
114
- type MfaThrottledErrorOptions = AuthupErrorOptions & {
125
+ export declare const MFA_THROTTLED_ERROR_INSTANCE: unique symbol;
126
+ export type MfaThrottledErrorOptions = AuthupErrorOptions & {
115
127
  /**
116
128
  * Seconds until the exponential backoff releases the account.
117
129
  */
118
130
  retryAfter?: number;
119
131
  };
120
- declare class MfaThrottledError extends AuthupError {
132
+ export declare class MfaThrottledError extends AuthupError {
121
133
  constructor(input?: MfaThrottledErrorOptions);
122
134
  }
123
135
  //#endregion
124
136
  //#region src/built-in/check.d.ts
125
- declare function isAuthHeaderError(input: unknown): input is AuthHeaderError;
126
- declare function isBearerTokenMalformedError(input: unknown): input is BearerTokenMalformedError;
127
- declare function isBadRequestError(input: unknown): input is BadRequestError;
128
- declare function isValidationError(input: unknown): input is ValidationError;
129
- declare function isUnauthorizedError(input: unknown): input is UnauthorizedError;
130
- declare function isEntityNotFoundError(input: unknown): input is EntityNotFoundError;
131
- declare function isEntityConflictError(input: unknown): input is EntityConflictError;
132
- declare function isEntityInactiveError(input: unknown): input is EntityInactiveError;
133
- declare function isEntityCredentialsInvalidError(input: unknown): input is EntityCredentialsInvalidError;
134
- declare function isInternalError(input: unknown): input is InternalError;
135
- declare function isLoginThrottledError(input: unknown): input is LoginThrottledError;
136
- declare function isMfaThrottledError(input: unknown): input is MfaThrottledError;
137
+ export declare function isAuthHeaderError(input: unknown): input is AuthHeaderError;
138
+ export declare function isBearerTokenMalformedError(input: unknown): input is BearerTokenMalformedError;
139
+ export declare function isBadRequestError(input: unknown): input is BadRequestError;
140
+ export declare function isValidationError(input: unknown): input is ValidationError;
141
+ export declare function isUnauthorizedError(input: unknown): input is UnauthorizedError;
142
+ export declare function isEntityNotFoundError(input: unknown): input is EntityNotFoundError;
143
+ export declare function isEntityConflictError(input: unknown): input is EntityConflictError;
144
+ export declare function isEntityInactiveError(input: unknown): input is EntityInactiveError;
145
+ export declare function isEntityCredentialsInvalidError(input: unknown): input is EntityCredentialsInvalidError;
146
+ export declare function isInternalError(input: unknown): input is InternalError;
147
+ export declare function isLoginThrottledError(input: unknown): input is LoginThrottledError;
148
+ export declare function isMfaThrottledError(input: unknown): input is MfaThrottledError;
149
+ export declare function isDeviceVerificationThrottledError(input: unknown): input is DeviceVerificationThrottledError;
137
150
  //#endregion
138
151
  //#region src/check.d.ts
139
152
  /**
@@ -145,7 +158,7 @@ declare function isMfaThrottledError(input: unknown): input is MfaThrottledError
145
158
  * `instanceof Error` for cross-realm boundaries (worker threads,
146
159
  * duplicate-module copies) where `instanceof` can yield false negatives.
147
160
  */
148
- declare function isError(input: unknown): input is Error;
161
+ export declare function isError(input: unknown): input is Error;
149
162
  /**
150
163
  * Duck-type guard for AuthupError.
151
164
  *
@@ -165,10 +178,10 @@ declare function isError(input: unknown): input is Error;
165
178
  * from any other ebec-derived error anyway. There is no reliable way left
166
179
  * to recognise a chain-less legacy payload as specifically an AuthupError.
167
180
  */
168
- declare function isAuthupError(input: unknown): input is AuthupError;
181
+ export declare function isAuthupError(input: unknown): input is AuthupError;
169
182
  //#endregion
170
183
  //#region src/constants.d.ts
171
- declare enum ErrorCode {
184
+ export declare enum ErrorCode {
172
185
  BAD_REQUEST = "bad_request",
173
186
  INTERNAL_ERROR = "internal_error",
174
187
  /**
@@ -217,6 +230,10 @@ declare enum ErrorCode {
217
230
  OAUTH_RESPONSE_TYPE_UNSUPPORTED = "unsupported_response_type",
218
231
  OAUTH_SCOPE_INVALID = "invalid_scope",
219
232
  OAUTH_SCOPE_INSUFFICIENT = "insufficient_scope",
233
+ OAUTH_AUTHORIZATION_PENDING = "authorization_pending",
234
+ OAUTH_SLOW_DOWN = "slow_down",
235
+ OAUTH_DEVICE_CODE_EXPIRED = "device_code_expired",
236
+ OAUTH_DEVICE_VERIFICATION_THROTTLED = "device_verification_throttled",
220
237
  PERMISSION_NOT_FOUND = "permission_not_found",
221
238
  PERMISSION_DENIED = "permission_denied",
222
239
  PERMISSION_EVALUATION_FAILED = "permission_evaluation_failed",
@@ -235,7 +252,7 @@ declare enum ErrorCode {
235
252
  * passing `isError` is returned as-is. Strings become `new Error(str)`;
236
253
  * any other value is stringified.
237
254
  */
238
- declare function normalizeError(input: unknown): Error;
255
+ export declare function normalizeError(input: unknown): Error;
239
256
  //#endregion
240
257
  //#region src/serialize.d.ts
241
258
  /**
@@ -251,7 +268,7 @@ declare function normalizeError(input: unknown): Error;
251
268
  * Pair with `normalizeError` to handle arbitrary thrown values:
252
269
  * `serializeError(normalizeError(e))`.
253
270
  */
254
- declare function serializeError(input: Error): Record<string, any>;
271
+ export declare function serializeError(input: Error): Record<string, any>;
255
272
  //#endregion
256
273
  //#region src/status.d.ts
257
274
  /**
@@ -279,12 +296,12 @@ declare function serializeError(input: Error): Record<string, any>;
279
296
  * token-endpoint path that verifies a JWT has to do the same - this map
280
297
  * cannot know which surface it is on.
281
298
  */
282
- declare const ERROR_CODE_TO_STATUS: Readonly<Partial<Record<`${ErrorCode}`, number>>>;
299
+ export declare const ERROR_CODE_TO_STATUS: Readonly<Partial<Record<`${ErrorCode}`, number>>>;
283
300
  /**
284
301
  * Resolve an HTTP status for a given error code. Unknown codes fall back
285
302
  * to `fallback` (default 400).
286
303
  */
287
- declare function httpStatusFromCode(code: string, fallback?: number): number;
304
+ export declare function httpStatusFromCode(code: string, fallback?: number): number;
288
305
  /**
289
306
  * Resolve a semantic `ErrorCode` for a foreign HTTP status. Used at the
290
307
  * boundary where a non-AuthupError (e.g. `@ebec/http` HTTPError thrown by
@@ -295,7 +312,7 @@ declare function httpStatusFromCode(code: string, fallback?: number): number;
295
312
  * Default mapping covers the common HTTP statuses. Anything 5xx
296
313
  * collapses to `INTERNAL_ERROR`; unknown 4xx collapses to `BAD_REQUEST`.
297
314
  */
298
- declare function codeFromHttpStatus(status: number): ErrorCode;
315
+ export declare function codeFromHttpStatus(status: number): ErrorCode;
299
316
  //#endregion
300
- export { AUTHUP_ERROR_INSTANCE, AUTH_HEADER_ERROR_INSTANCE, AuthHeaderError, AuthupEntityErrorInput, AuthupEntityErrorOptions, AuthupError, AuthupErrorInput, AuthupErrorOptions, BAD_REQUEST_ERROR_INSTANCE, BASE_ERROR_INSTANCE, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE, BadRequestError, BearerTokenMalformedError, ENTITY_CONFLICT_ERROR_INSTANCE, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE, ENTITY_INACTIVE_ERROR_INSTANCE, ENTITY_NOT_FOUND_ERROR_INSTANCE, ERROR_CODE_TO_STATUS, EntityConflictError, EntityCredentialsInvalidError, EntityInactiveError, EntityNotFoundError, ErrorCode, INSTANCEOF_PROPERTY, INTERNAL_ERROR_INSTANCE, InternalError, LOGIN_THROTTLED_ERROR_INSTANCE, LoginThrottledError, LoginThrottledErrorOptions, MFA_THROTTLED_ERROR_INSTANCE, MfaThrottledError, MfaThrottledErrorOptions, UNAUTHORIZED_ERROR_INSTANCE, UnauthorizedError, VALIDATION_ERROR_INSTANCE, ValidationError, codeFromHttpStatus, hasInstanceof, httpStatusFromCode, isAuthHeaderError, isAuthupError, isBadRequestError, isBearerTokenMalformedError, isEntityConflictError, isEntityCredentialsInvalidError, isEntityInactiveError, isEntityNotFoundError, isError, isInternalError, isLoginThrottledError, isMfaThrottledError, isUnauthorizedError, isValidationError, markInstanceof, matchesInstanceof, normalizeError, serializeError, serializeInstanceofChain };
317
+ export { BASE_ERROR_INSTANCE, INSTANCEOF_PROPERTY, hasInstanceof, markInstanceof, matchesInstanceof, serializeInstanceofChain };
301
318
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/module.ts","../src/built-in/unauthorized.ts","../src/built-in/auth-header.ts","../src/built-in/bad-request.ts","../src/built-in/bearer-token.ts","../src/built-in/validation.ts","../src/built-in/entity-conflict.ts","../src/built-in/entity-credentials-invalid.ts","../src/built-in/entity-inactive.ts","../src/built-in/entity-not-found.ts","../src/built-in/internal.ts","../src/built-in/login-throttled.ts","../src/built-in/mfa-throttled.ts","../src/built-in/check.ts","../src/check.ts","../src/constants.ts","../src/normalize.ts","../src/serialize.ts","../src/status.ts"],"mappings":";;KASY,qBAAqB;EAC7B,OAAO;;KAGC,4BAA4B;KAE5B,2BAA2B;EACnC;;KAGQ,kCAAkC;;;cCJjC;cAEA,oBAAoB;WACb,OAAO;EAEX,YAAA,QAAQ;;;;;;EAcX;;;;;;;;;;;;cCtBA;cAEA,0BAA0B;EACvB,YAAA,iBAAiB;;;;cCJpB;cAEA,wBAAwB;EACrB,YAAA;SAQL,gBAAgB,eAAY;;;;cCV1B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;;;;;iBCjEY,eAAe,iBAAiB;;;;;;;;;;;;;;;;iBCIhC,eAAe,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCYjC,sBAAsB,SAAS,QAAQ,UAAU;;;;;iBAwC9C,mBAAmB,cAAc;;;;;;;;;;;iBAcjC,mBAAmB,iBAAiB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/module.ts","../src/built-in/unauthorized.ts","../src/built-in/auth-header.ts","../src/built-in/bad-request.ts","../src/built-in/bearer-token.ts","../src/built-in/validation.ts","../src/built-in/device-verification-throttled.ts","../src/built-in/entity-conflict.ts","../src/built-in/entity-credentials-invalid.ts","../src/built-in/entity-inactive.ts","../src/built-in/entity-not-found.ts","../src/built-in/internal.ts","../src/built-in/login-throttled.ts","../src/built-in/mfa-throttled.ts","../src/built-in/check.ts","../src/check.ts","../src/constants.ts","../src/normalize.ts","../src/serialize.ts","../src/status.ts"],"mappings":";;YASY,qBAAqB;EAC7B,OAAO;;YAGC,4BAA4B;YAE5B,2BAA2B;EACnC;;YAGQ,kCAAkC;;;qBCJjC;qBAEA,oBAAoB;WACb,OAAO;EAEX,YAAA,QAAQ;;;;;;EAcX;;;;;;;;;;;;qBCtBA;qBAEA,0BAA0B;EACvB,YAAA,iBAAiB;;;;qBCJpB;qBAEA,wBAAwB;EACrB,YAAA;SAQL,gBAAgB,eAAY;;;;qBCV1B;qBAEA,wBAAwB;EACrB,YAAA,iBAAiB;;;;qBCJpB;qBAEA,kCAAkC;EAC/B,YAAA;;;;qBCFH;;;;;;;qBAQA,wBAAwB;EACrB,YAAA,iBAAiB;;;;qBCTpB;YAED,0CAA0C;;;;EAIlD;;qBAGS,yCAAyC;EACtC,YAAA,QAAQ;;;;qBCVX;qBAEA,4BAA4B;EACzB,YAAA,iBAAiB;;;;qBCHpB;qBAEA,sCAAsC;EACnC,YAAA,iBAAiB;;;;qBCHpB;qBAEA,4BAA4B;EACzB,YAAA,iBAAiB;;;;qB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"}
package/dist/index.mjs CHANGED
@@ -49,6 +49,10 @@ let ErrorCode = /* @__PURE__ */ function(ErrorCode) {
49
49
  ErrorCode["OAUTH_RESPONSE_TYPE_UNSUPPORTED"] = "unsupported_response_type";
50
50
  ErrorCode["OAUTH_SCOPE_INVALID"] = "invalid_scope";
51
51
  ErrorCode["OAUTH_SCOPE_INSUFFICIENT"] = "insufficient_scope";
52
+ ErrorCode["OAUTH_AUTHORIZATION_PENDING"] = "authorization_pending";
53
+ ErrorCode["OAUTH_SLOW_DOWN"] = "slow_down";
54
+ ErrorCode["OAUTH_DEVICE_CODE_EXPIRED"] = "device_code_expired";
55
+ ErrorCode["OAUTH_DEVICE_VERIFICATION_THROTTLED"] = "device_verification_throttled";
52
56
  ErrorCode["PERMISSION_NOT_FOUND"] = "permission_not_found";
53
57
  ErrorCode["PERMISSION_DENIED"] = "permission_denied";
54
58
  ErrorCode["PERMISSION_EVALUATION_FAILED"] = "permission_evaluation_failed";
@@ -189,6 +193,24 @@ var ValidationError = class extends AuthupError {
189
193
  }
190
194
  };
191
195
  //#endregion
196
+ //#region src/built-in/device-verification-throttled.ts
197
+ const DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE = Symbol.for("@authup/errors/DeviceVerificationThrottledError");
198
+ var DeviceVerificationThrottledError = class extends AuthupError {
199
+ constructor(input) {
200
+ const { retryAfter, ...rest } = input ?? {};
201
+ super({
202
+ code: "device_verification_throttled",
203
+ message: "Too many verification attempts. Try again later.",
204
+ ...rest,
205
+ data: {
206
+ ...typeof retryAfter === "number" ? { retryAfter } : {},
207
+ ...rest.data ?? {}
208
+ }
209
+ });
210
+ markInstanceof$1(this, DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE);
211
+ }
212
+ };
213
+ //#endregion
192
214
  //#region src/built-in/entity-conflict.ts
193
215
  const ENTITY_CONFLICT_ERROR_INSTANCE = Symbol.for("@authup/errors/EntityConflictError");
194
216
  var EntityConflictError = class extends AuthupError {
@@ -355,6 +377,11 @@ function isMfaThrottledError(input) {
355
377
  if (!isAuthupError(input)) return false;
356
378
  return input.code === "mfa_attempt_throttled";
357
379
  }
380
+ function isDeviceVerificationThrottledError(input) {
381
+ if (matchesInstanceof$1(input, DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE)) return true;
382
+ if (!isAuthupError(input)) return false;
383
+ return input.code === "device_verification_throttled";
384
+ }
358
385
  //#endregion
359
386
  //#region src/normalize.ts
360
387
  /**
@@ -440,6 +467,7 @@ const ERROR_CODE_TO_STATUS = {
440
467
  ["entity_conflict"]: 409,
441
468
  ["login_attempt_throttled"]: 429,
442
469
  ["mfa_attempt_throttled"]: 429,
470
+ ["device_verification_throttled"]: 429,
443
471
  ["internal_error"]: 500,
444
472
  ["upstream_error"]: 502,
445
473
  ["storage_insufficient"]: 507
@@ -472,6 +500,6 @@ function codeFromHttpStatus(status) {
472
500
  return "bad_request";
473
501
  }
474
502
  //#endregion
475
- export { AUTHUP_ERROR_INSTANCE, AUTH_HEADER_ERROR_INSTANCE, AuthHeaderError, AuthupError, BAD_REQUEST_ERROR_INSTANCE, BASE_ERROR_INSTANCE, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE, BadRequestError, BearerTokenMalformedError, ENTITY_CONFLICT_ERROR_INSTANCE, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE, ENTITY_INACTIVE_ERROR_INSTANCE, ENTITY_NOT_FOUND_ERROR_INSTANCE, ERROR_CODE_TO_STATUS, EntityConflictError, EntityCredentialsInvalidError, EntityInactiveError, EntityNotFoundError, ErrorCode, INSTANCEOF_PROPERTY, INTERNAL_ERROR_INSTANCE, InternalError, LOGIN_THROTTLED_ERROR_INSTANCE, LoginThrottledError, MFA_THROTTLED_ERROR_INSTANCE, MfaThrottledError, UNAUTHORIZED_ERROR_INSTANCE, UnauthorizedError, VALIDATION_ERROR_INSTANCE, ValidationError, codeFromHttpStatus, hasInstanceof, httpStatusFromCode, isAuthHeaderError, isAuthupError, isBadRequestError, isBearerTokenMalformedError, isEntityConflictError, isEntityCredentialsInvalidError, isEntityInactiveError, isEntityNotFoundError, isError, isInternalError, isLoginThrottledError, isMfaThrottledError, isUnauthorizedError, isValidationError, markInstanceof, matchesInstanceof, normalizeError, serializeError, serializeInstanceofChain };
503
+ export { AUTHUP_ERROR_INSTANCE, AUTH_HEADER_ERROR_INSTANCE, AuthHeaderError, AuthupError, BAD_REQUEST_ERROR_INSTANCE, BASE_ERROR_INSTANCE, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE, BadRequestError, BearerTokenMalformedError, DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE, DeviceVerificationThrottledError, ENTITY_CONFLICT_ERROR_INSTANCE, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE, ENTITY_INACTIVE_ERROR_INSTANCE, ENTITY_NOT_FOUND_ERROR_INSTANCE, ERROR_CODE_TO_STATUS, EntityConflictError, EntityCredentialsInvalidError, EntityInactiveError, EntityNotFoundError, ErrorCode, INSTANCEOF_PROPERTY, INTERNAL_ERROR_INSTANCE, InternalError, LOGIN_THROTTLED_ERROR_INSTANCE, LoginThrottledError, MFA_THROTTLED_ERROR_INSTANCE, MfaThrottledError, UNAUTHORIZED_ERROR_INSTANCE, UnauthorizedError, VALIDATION_ERROR_INSTANCE, ValidationError, codeFromHttpStatus, hasInstanceof, httpStatusFromCode, isAuthHeaderError, isAuthupError, isBadRequestError, isBearerTokenMalformedError, isDeviceVerificationThrottledError, isEntityConflictError, isEntityCredentialsInvalidError, isEntityInactiveError, isEntityNotFoundError, isError, isInternalError, isLoginThrottledError, isMfaThrottledError, isUnauthorizedError, isValidationError, markInstanceof, matchesInstanceof, normalizeError, serializeError, serializeInstanceofChain };
476
504
 
477
505
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["INSTANCEOF_PROPERTY","serializeInstanceofChain","isRawError","INSTANCEOF_PROPERTY","matchesInstanceof","matchesInstanceof"],"sources":["../src/constants.ts","../src/module.ts","../src/built-in/unauthorized.ts","../src/built-in/auth-header.ts","../src/built-in/bad-request.ts","../src/built-in/bearer-token.ts","../src/check.ts","../src/built-in/validation.ts","../src/built-in/entity-conflict.ts","../src/built-in/entity-credentials-invalid.ts","../src/built-in/entity-inactive.ts","../src/built-in/entity-not-found.ts","../src/built-in/internal.ts","../src/built-in/login-throttled.ts","../src/built-in/mfa-throttled.ts","../src/built-in/check.ts","../src/normalize.ts","../src/serialize.ts","../src/status.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum ErrorCode {\n // Generic\n BAD_REQUEST = 'bad_request',\n INTERNAL_ERROR = 'internal_error',\n\n /**\n * An outbound call to a service this server depends on failed, either\n * as a transport failure or as an error answer. Distinct from\n * INTERNAL_ERROR so a caller can tell \"authup is broken\" from \"authup\n * could not reach a dependency\", and so the upstream status is never\n * mirrored onto authup's own response.\n */\n UPSTREAM_ERROR = 'upstream_error',\n\n // HTTP Codes\n HTTP_HEADER_AUTH_TYPE_UNSUPPORTED = 'unsupported_auth_header_type',\n HTTP_BEARER_TOKEN_MALFORMED = 'bearer_token_malformed',\n\n // Identity Auth\n IDENTITY_UNAUTHORIZED = 'identity_unauthorized',\n\n // Entity Codes\n ENTITY_CREDENTIALS_INVALID = 'invalid_credentials',\n ENTITY_INACTIVE = 'entity_inactive',\n ENTITY_NOT_FOUND = 'entity_not_found',\n ENTITY_CONFLICT = 'entity_conflict',\n ENTITY_RELATION_INVALID = 'entity_relation_invalid',\n\n // Identity Codes\n REGISTRATION_DISABLED = 'registration_disabled',\n PASSWORD_RECOVERY_DISABLED = 'password_recovery_disabled',\n EMAIL_VERIFICATION_REQUIRED = 'email_verification_required',\n RESET_TOKEN_EXPIRED = 'reset_token_expired',\n LOGIN_ATTEMPT_THROTTLED = 'login_attempt_throttled',\n MFA_ATTEMPT_THROTTLED = 'mfa_attempt_throttled',\n MFA_NOT_CONFIGURABLE = 'mfa_not_configurable',\n IDENTITY_PROVIDER_ACCOUNT_ALREADY_LINKED = 'identity_provider_account_already_linked',\n IDENTITY_PROVIDER_ACCOUNT_UNLINK_BLOCKED = 'identity_provider_account_unlink_blocked',\n\n // Storage Codes\n STORAGE_INSUFFICIENT = 'storage_insufficient',\n\n // JWK Codes\n JWK_INVALID = 'jwk_invalid',\n JWK_NOT_FOUND = 'jwk_not_found',\n\n // JWT Codes\n JWT_INVALID = 'invalid_token',\n JWT_INACTIVE = 'inactive_token',\n JWT_EXPIRED = 'expired_token',\n\n // Oauth2 Codes\n OAUTH_REDIRECT_URI_MISMATCH = 'redirect_uri_mismatch',\n OAUTH_CLIENT_INVALID = 'invalid_client',\n OAUTH_CLIENT_UNAUTHORIZED = 'unauthorized_client',\n OAUTH_GRANT_INVALID = 'invalid_grant',\n OAUTH_GRANT_TYPE_UNSUPPORTED = 'unsupported_token_grant_type',\n OAUTH_REQUEST_INVALID = 'invalid_request',\n OAUTH_LOGIN_REQUIRED = 'login_required',\n OAUTH_MFA_REQUIRED = 'mfa_required',\n OAUTH_ACCESS_DENIED = 'access_denied',\n OAUTH_INTERACTION_REQUIRED = 'interaction_required',\n OAUTH_ACCOUNT_SELECTION_REQUIRED = 'account_selection_required',\n OAUTH_CONSENT_REQUIRED = 'consent_required',\n OAUTH_RESPONSE_TYPE_UNSUPPORTED = 'unsupported_response_type',\n OAUTH_SCOPE_INVALID = 'invalid_scope',\n OAUTH_SCOPE_INSUFFICIENT = 'insufficient_scope',\n\n // Permission Codes\n PERMISSION_NOT_FOUND = 'permission_not_found',\n PERMISSION_DENIED = 'permission_denied',\n PERMISSION_EVALUATION_FAILED = 'permission_evaluation_failed',\n\n // Policy Codes\n POLICY_EVALUATOR_NOT_FOUND = 'policy_evaluator_not_found',\n POLICY_EVALUATOR_NOT_PROCESSABLE = 'policy_evaluator_not_processable',\n POLICY_EVALUATOR_CONTEXT_INVALID = 'policy_evaluator_context_invalid',\n}\n","/*\n * Copyright (c) 2024-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { AuthupErrorInput } from './types.ts';\nimport {\n BaseError,\n INSTANCEOF_PROPERTY,\n markInstanceof,\n serializeInstanceofChain,\n} from '@ebec/core';\n\nexport const AUTHUP_ERROR_INSTANCE = Symbol.for('@authup/errors/AuthupError');\n\nexport class AuthupError extends BaseError {\n public readonly data?: Record<string, any>;\n\n constructor(input?: AuthupErrorInput) {\n super(input);\n markInstanceof(this, AUTHUP_ERROR_INSTANCE);\n\n if (input && typeof input !== 'string' && input.data) {\n this.data = input.data;\n }\n }\n\n /**\n * `super.toJSON()` already emits the serialized marker chain, but the\n * `data` spread runs after it — re-stamped last so a `data` key cannot\n * displace the genuine chain.\n */\n override toJSON() {\n return {\n ...super.toJSON(),\n ...(this.data ?? {}),\n [INSTANCEOF_PROPERTY]: serializeInstanceofChain(this),\n };\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const UNAUTHORIZED_ERROR_INSTANCE = Symbol.for('@authup/errors/UnauthorizedError');\n\nexport class UnauthorizedError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.IDENTITY_UNAUTHORIZED,\n message: 'Authentication required.',\n ...options,\n });\n markInstanceof(this, UNAUTHORIZED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2022-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { UnauthorizedError } from './unauthorized.ts';\n\nexport const AUTH_HEADER_ERROR_INSTANCE = Symbol.for('@authup/errors/AuthHeaderError');\n\nexport class AuthHeaderError extends UnauthorizedError {\n constructor(message: string) {\n super({\n code: ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED,\n message,\n });\n markInstanceof(this, AUTH_HEADER_ERROR_INSTANCE);\n }\n\n static unsupportedType(type: string) {\n return new AuthHeaderError(`The authorization header type ${type} is not supported.`);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const BAD_REQUEST_ERROR_INSTANCE = Symbol.for('@authup/errors/BadRequestError');\n\nexport class BadRequestError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.BAD_REQUEST,\n ...options,\n });\n markInstanceof(this, BAD_REQUEST_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2022-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { UnauthorizedError } from './unauthorized.ts';\n\nexport const BEARER_TOKEN_MALFORMED_ERROR_INSTANCE = Symbol.for('@authup/errors/BearerTokenMalformedError');\n\nexport class BearerTokenMalformedError extends UnauthorizedError {\n constructor(message?: string) {\n super({\n code: ErrorCode.HTTP_BEARER_TOKEN_MALFORMED,\n message: message ?? 'The Authorization header is malformed.',\n });\n markInstanceof(this, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n INSTANCEOF_PROPERTY,\n isObject,\n isError as isRawError,\n matchesInstanceof,\n} from '@ebec/core';\nimport type { AuthupError } from './module.ts';\nimport { AUTHUP_ERROR_INSTANCE } from './module.ts';\n\n/**\n * Duck-type guard for `Error`.\n *\n * Re-exports `@ebec/core`'s shape-based check: `input` matches when it\n * carries the standard `name` / `message` / `stack` triplet, regardless\n * of which realm or class hierarchy produced it. Use this instead of\n * `instanceof Error` for cross-realm boundaries (worker threads,\n * duplicate-module copies) where `instanceof` can yield false negatives.\n */\nexport function isError(input: unknown): input is Error {\n return isRawError(input);\n}\n\n/**\n * Duck-type guard for AuthupError.\n *\n * The chain decides, and only the chain: it matches when the AuthupError\n * marker is in it, as the native symbol (in-process) or its serialized\n * string form (JSON-rehydrated). Subclass instances accumulate this\n * marker, so any AuthupError subclass (`OAuth2Error`, `JWTError`, ...)\n * matches too, while a foreign `@ebec/core` error (rapiq's ParseError,\n * which since 2.2 also carries an `issues` array) does not: it announced\n * its ancestry and AuthupError is not in it.\n *\n * Chain-less input never matches. A shape-based fallback for pre-chain\n * JSON (`BaseError` + `issues: Issue[]`) used to cover that case, but\n * `@ebec/core`'s `isBaseError` became chain-only, so that fallback could\n * never fire — and now that every `BaseError` carries an `issues` array,\n * the shape it checked for would no longer distinguish an AuthupError\n * from any other ebec-derived error anyway. There is no reliable way left\n * to recognise a chain-less legacy payload as specifically an AuthupError.\n */\nexport function isAuthupError(input: unknown): input is AuthupError {\n if (!isObject(input)) {\n return false;\n }\n\n if (!Array.isArray(input[INSTANCEOF_PROPERTY])) {\n return false;\n }\n\n return matchesInstanceof(input, AUTHUP_ERROR_INSTANCE);\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const VALIDATION_ERROR_INSTANCE = Symbol.for('@authup/errors/ValidationError');\n\n/**\n * A domain/business-rule violation raised by core logic. Deliberately NOT\n * named after an HTTP status: core code stays transport-agnostic, and the HTTP\n * adapter maps its `ErrorCode.BAD_REQUEST` to a 400 response\n * (`httpStatusFromCode`). Prefer this over `BadRequestError` in `core/**`.\n */\nexport class ValidationError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.BAD_REQUEST,\n ...options,\n });\n markInstanceof(this, VALIDATION_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_CONFLICT_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityConflictError');\n\nexport class EntityConflictError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_CONFLICT,\n message: entity ? `The ${entity} already exists.` : 'Entity already exists.',\n ...rest,\n });\n markInstanceof(this, ENTITY_CONFLICT_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityCredentialsInvalidError');\n\nexport class EntityCredentialsInvalidError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_CREDENTIALS_INVALID,\n message: entity ? `The ${entity} credentials are invalid.` : 'Credentials are invalid.',\n ...rest,\n });\n markInstanceof(this, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_INACTIVE_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityInactiveError');\n\nexport class EntityInactiveError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_INACTIVE,\n message: entity ? `The ${entity} is inactive.` : 'Entity is inactive.',\n ...rest,\n });\n markInstanceof(this, ENTITY_INACTIVE_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_NOT_FOUND_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityNotFoundError');\n\nexport class EntityNotFoundError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_NOT_FOUND,\n message: entity ? `The ${entity} was not found.` : 'Entity not found.',\n ...rest,\n });\n markInstanceof(this, ENTITY_NOT_FOUND_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const INTERNAL_ERROR_INSTANCE = Symbol.for('@authup/errors/InternalError');\n\nexport class InternalError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.INTERNAL_ERROR,\n message: 'An internal error occurred.',\n ...options,\n });\n markInstanceof(this, INTERNAL_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const LOGIN_THROTTLED_ERROR_INSTANCE = Symbol.for('@authup/errors/LoginThrottledError');\n\nexport type LoginThrottledErrorOptions = AuthupErrorOptions & {\n /**\n * Seconds until the sliding throttle window can release the pair.\n */\n retryAfter?: number,\n};\n\nexport class LoginThrottledError extends AuthupError {\n constructor(input?: LoginThrottledErrorOptions) {\n const { retryAfter, ...rest } = input ?? {};\n super({\n code: ErrorCode.LOGIN_ATTEMPT_THROTTLED,\n message: 'Too many failed login attempts. Please try again later.',\n ...rest,\n data: {\n ...(typeof retryAfter === 'number' ? { retryAfter } : {}),\n ...(rest.data ?? {}),\n },\n });\n markInstanceof(this, LOGIN_THROTTLED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const MFA_THROTTLED_ERROR_INSTANCE = Symbol.for('@authup/errors/MfaThrottledError');\n\nexport type MfaThrottledErrorOptions = AuthupErrorOptions & {\n /**\n * Seconds until the exponential backoff releases the account.\n */\n retryAfter?: number,\n};\n\nexport class MfaThrottledError extends AuthupError {\n constructor(input?: MfaThrottledErrorOptions) {\n const { retryAfter, ...rest } = input ?? {};\n super({\n code: ErrorCode.MFA_ATTEMPT_THROTTLED,\n message: 'Too many failed verification attempts. Please try again later.',\n ...rest,\n data: {\n ...(typeof retryAfter === 'number' ? { retryAfter } : {}),\n ...(rest.data ?? {}),\n },\n });\n markInstanceof(this, MFA_THROTTLED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isAuthupError } from '../check.ts';\nimport { ErrorCode } from '../constants.ts';\nimport { matchesInstanceof } from '@ebec/core';\nimport { AUTH_HEADER_ERROR_INSTANCE, type AuthHeaderError } from './auth-header.ts';\nimport { BAD_REQUEST_ERROR_INSTANCE, type BadRequestError } from './bad-request.ts';\nimport { VALIDATION_ERROR_INSTANCE, type ValidationError } from './validation.ts';\nimport { BEARER_TOKEN_MALFORMED_ERROR_INSTANCE, type BearerTokenMalformedError } from './bearer-token.ts';\nimport { ENTITY_CONFLICT_ERROR_INSTANCE, type EntityConflictError } from './entity-conflict.ts';\nimport { ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE, type EntityCredentialsInvalidError } from './entity-credentials-invalid.ts';\nimport { ENTITY_INACTIVE_ERROR_INSTANCE, type EntityInactiveError } from './entity-inactive.ts';\nimport { ENTITY_NOT_FOUND_ERROR_INSTANCE, type EntityNotFoundError } from './entity-not-found.ts';\nimport { INTERNAL_ERROR_INSTANCE, type InternalError } from './internal.ts';\nimport { LOGIN_THROTTLED_ERROR_INSTANCE, type LoginThrottledError } from './login-throttled.ts';\nimport { MFA_THROTTLED_ERROR_INSTANCE, type MfaThrottledError } from './mfa-throttled.ts';\nimport { UNAUTHORIZED_ERROR_INSTANCE, type UnauthorizedError } from './unauthorized.ts';\n\nexport function isAuthHeaderError(input: unknown): input is AuthHeaderError {\n if (matchesInstanceof(input, AUTH_HEADER_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED;\n}\n\nexport function isBearerTokenMalformedError(input: unknown): input is BearerTokenMalformedError {\n if (matchesInstanceof(input, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.HTTP_BEARER_TOKEN_MALFORMED;\n}\n\nexport function isBadRequestError(input: unknown): input is BadRequestError {\n if (matchesInstanceof(input, BAD_REQUEST_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.BAD_REQUEST;\n}\n\nexport function isValidationError(input: unknown): input is ValidationError {\n if (matchesInstanceof(input, VALIDATION_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.BAD_REQUEST;\n}\n\nexport function isUnauthorizedError(input: unknown): input is UnauthorizedError {\n if (matchesInstanceof(input, UNAUTHORIZED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.IDENTITY_UNAUTHORIZED;\n}\n\nexport function isEntityNotFoundError(input: unknown): input is EntityNotFoundError {\n if (matchesInstanceof(input, ENTITY_NOT_FOUND_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_NOT_FOUND;\n}\n\nexport function isEntityConflictError(input: unknown): input is EntityConflictError {\n if (matchesInstanceof(input, ENTITY_CONFLICT_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_CONFLICT;\n}\n\nexport function isEntityInactiveError(input: unknown): input is EntityInactiveError {\n if (matchesInstanceof(input, ENTITY_INACTIVE_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_INACTIVE;\n}\n\nexport function isEntityCredentialsInvalidError(input: unknown): input is EntityCredentialsInvalidError {\n if (matchesInstanceof(input, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_CREDENTIALS_INVALID;\n}\n\nexport function isInternalError(input: unknown): input is InternalError {\n if (matchesInstanceof(input, INTERNAL_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.INTERNAL_ERROR;\n}\n\nexport function isLoginThrottledError(input: unknown): input is LoginThrottledError {\n if (matchesInstanceof(input, LOGIN_THROTTLED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.LOGIN_ATTEMPT_THROTTLED;\n}\n\nexport function isMfaThrottledError(input: unknown): input is MfaThrottledError {\n if (matchesInstanceof(input, MFA_THROTTLED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.MFA_ATTEMPT_THROTTLED;\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isError } from './check.ts';\n\n/**\n * Normalize an arbitrary thrown value into an `Error` instance.\n *\n * Useful at error-pipeline boundaries (catch blocks, error middleware,\n * fallbacks) where TypeScript hands you `unknown` but downstream code\n * wants a real `Error` to inspect or rethrow. Duck-typed: any value\n * passing `isError` is returned as-is. Strings become `new Error(str)`;\n * any other value is stringified.\n */\nexport function normalizeError(input: unknown): Error {\n if (isError(input)) {\n return input;\n }\n\n if (typeof input === 'string') {\n return new Error(input);\n }\n\n return new Error(String(input));\n}\n\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject } from '@ebec/core';\n\n/**\n * Convert an `Error` (or any value with a `toJSON()` method) into a\n * plain object suitable for embedding in a JSON response body.\n *\n * Calls `input.toJSON()` if present — preserves every attribute the\n * error chose to surface (`code`, `cause`, `errors`, `issues`, `data`,\n * AuthupError sub-class fields, ...). Falls back to spreading the\n * Error's enumerable own properties alongside the standard\n * `name` / `message` pair, so caller-attached fields survive.\n *\n * Pair with `normalizeError` to handle arbitrary thrown values:\n * `serializeError(normalizeError(e))`.\n */\nexport function serializeError(input: Error): Record<string, any> {\n if ('toJSON' in input && typeof input.toJSON === 'function') {\n const output = input.toJSON();\n if (isObject(output)) {\n return output;\n }\n }\n\n return {\n ...input,\n name: input.name,\n message: input.message,\n };\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from './constants.ts';\n\n/**\n * Default mapping from `ErrorCode` to HTTP status. Adapters apply this and\n * may layer their own overrides on top. Codes not listed here fall back\n * to 400 (Bad Request) — which is the right default for \"validation /\n * malformed-request\" style errors.\n *\n * The mapping mirrors the HTTP statuses produced by the pre-refactor\n * `@ebec/http`-coupled error classes, with one intentional change:\n *\n * - `OAUTH_CLIENT_INVALID`: 400 → **401**, per RFC 6749 §5.2 (`invalid_client`\n * responses should use 401). Surfaces as a behavior change in HTTP-level\n * tests asserting `status: 400, code: OAUTH_CLIENT_INVALID`.\n * - The three `JWT_*` codes: 400 (the unlisted fallback) → **401**, per\n * RFC 6750 §3.1, which is the status for a resource request carrying an\n * expired or otherwise unusable bearer. They had never been listed, so a\n * dead bearer answered 400 while a MISSING one answered 401, and no\n * client could tell \"your credential died\" from \"your request was\n * malformed\" by status alone. The token endpoint is where RFC 6749 §5.2\n * and RFC 7662/7009 want something else, and each of its handlers says so\n * at its own call site rather than here: the refresh grant re-throws a\n * verification failure as `invalid_grant`, introspection reports one as\n * `active: false`, and revocation answers its ordinary success. A new\n * token-endpoint path that verifies a JWT has to do the same - this map\n * cannot know which surface it is on.\n */\nexport const ERROR_CODE_TO_STATUS: Readonly<Partial<Record<`${ErrorCode}`, number>>> = {\n // 401\n [ErrorCode.OAUTH_CLIENT_INVALID]: 401,\n [ErrorCode.HTTP_BEARER_TOKEN_MALFORMED]: 401,\n [ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED]: 401,\n [ErrorCode.IDENTITY_UNAUTHORIZED]: 401,\n [ErrorCode.JWT_EXPIRED]: 401,\n [ErrorCode.JWT_INACTIVE]: 401,\n [ErrorCode.JWT_INVALID]: 401,\n\n // 403\n [ErrorCode.PERMISSION_NOT_FOUND]: 403,\n [ErrorCode.PERMISSION_DENIED]: 403,\n [ErrorCode.PERMISSION_EVALUATION_FAILED]: 403,\n\n // 404\n [ErrorCode.ENTITY_NOT_FOUND]: 404,\n [ErrorCode.JWK_NOT_FOUND]: 404,\n\n // 409\n [ErrorCode.ENTITY_CONFLICT]: 409,\n\n // 429\n [ErrorCode.LOGIN_ATTEMPT_THROTTLED]: 429,\n [ErrorCode.MFA_ATTEMPT_THROTTLED]: 429,\n\n // 500\n [ErrorCode.INTERNAL_ERROR]: 500,\n\n // 502\n [ErrorCode.UPSTREAM_ERROR]: 502,\n\n // 507\n [ErrorCode.STORAGE_INSUFFICIENT]: 507,\n};\n\n/**\n * Resolve an HTTP status for a given error code. Unknown codes fall back\n * to `fallback` (default 400).\n */\nexport function httpStatusFromCode(code: string, fallback = 400): number {\n return ERROR_CODE_TO_STATUS[code as `${ErrorCode}`] ?? fallback;\n}\n\n/**\n * Resolve a semantic `ErrorCode` for a foreign HTTP status. Used at the\n * boundary where a non-AuthupError (e.g. `@ebec/http` HTTPError thrown by\n * the framework, or a foreign service response) enters our system and\n * needs to be normalized into an `AuthupError` with an authup-vocabulary\n * code. Status is the only stable handshake across the two vocabularies.\n *\n * Default mapping covers the common HTTP statuses. Anything 5xx\n * collapses to `INTERNAL_ERROR`; unknown 4xx collapses to `BAD_REQUEST`.\n */\nexport function codeFromHttpStatus(status: number): ErrorCode {\n if (status === 404) return ErrorCode.ENTITY_NOT_FOUND;\n if (status === 409) return ErrorCode.ENTITY_CONFLICT;\n if (status === 401) return ErrorCode.IDENTITY_UNAUTHORIZED;\n if (status === 403) return ErrorCode.PERMISSION_DENIED;\n if (status === 429) return ErrorCode.LOGIN_ATTEMPT_THROTTLED;\n if (status === 507) return ErrorCode.STORAGE_INSUFFICIENT;\n if (status >= 500) return ErrorCode.INTERNAL_ERROR;\n return ErrorCode.BAD_REQUEST;\n}\n"],"mappings":";;AAOA,IAAY,YAAL,yBAAA,WAAA;CAEH,UAAA,iBAAA;CACA,UAAA,oBAAA;;;;;;;;CASA,UAAA,oBAAA;CAGA,UAAA,uCAAA;CACA,UAAA,iCAAA;CAGA,UAAA,2BAAA;CAGA,UAAA,gCAAA;CACA,UAAA,qBAAA;CACA,UAAA,sBAAA;CACA,UAAA,qBAAA;CACA,UAAA,6BAAA;CAGA,UAAA,2BAAA;CACA,UAAA,gCAAA;CACA,UAAA,iCAAA;CACA,UAAA,yBAAA;CACA,UAAA,6BAAA;CACA,UAAA,2BAAA;CACA,UAAA,0BAAA;CACA,UAAA,8CAAA;CACA,UAAA,8CAAA;CAGA,UAAA,0BAAA;CAGA,UAAA,iBAAA;CACA,UAAA,mBAAA;CAGA,UAAA,iBAAA;CACA,UAAA,kBAAA;CACA,UAAA,iBAAA;CAGA,UAAA,iCAAA;CACA,UAAA,0BAAA;CACA,UAAA,+BAAA;CACA,UAAA,yBAAA;CACA,UAAA,kCAAA;CACA,UAAA,2BAAA;CACA,UAAA,0BAAA;CACA,UAAA,wBAAA;CACA,UAA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,OAAO,IAAI,MAAM,KAAK;CAG1B,OAAO,IAAI,MAAM,OAAO,KAAK,CAAC;AAClC;;;;;;;;;;;;;;;;ACNA,SAAgB,eAAe,OAAmC;CAC9D,IAAI,YAAY,SAAS,OAAO,MAAM,WAAW,YAAY;EACzD,MAAM,SAAS,MAAM,OAAO;EAC5B,IAAI,SAAS,MAAM,GACf,OAAO;CAEf;CAEA,OAAO;EACH,GAAG;EACH,MAAM,MAAM;EACZ,SAAS,MAAM;CACnB;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACDA,MAAa,uBAA0E;EAEjD,mBAAA;EACO,2BAAA;EACM,iCAAA;EACZ,0BAAA;EACV,kBAAA;EACC,mBAAA;EACD,kBAAA;EAGS,yBAAA;EACH,sBAAA;EACW,iCAAA;EAGZ,qBAAA;EACH,kBAAA;EAGE,oBAAA;EAGQ,4BAAA;EACF,0BAAA;EAGP,mBAAA;EAGA,mBAAA;EAGM,yBAAA;AACtC;;;;;AAMA,SAAgB,mBAAmB,MAAc,WAAW,KAAa;CACrE,OAAO,qBAAqB,SAA2B;AAC3D;;;;;;;;;;;AAYA,SAAgB,mBAAmB,QAA2B;CAC1D,IAAI,WAAW,KAAK,OAAA;CACpB,IAAI,WAAW,KAAK,OAAA;CACpB,IAAI,WAAW,KAAK,OAAA;CACpB,IAAI,WAAW,KAAK,OAAA;CACpB,IAAI,WAAW,KAAK,OAAA;CACpB,IAAI,WAAW,KAAK,OAAA;CACpB,IAAI,UAAU,KAAK,OAAA;CACnB,OAAA;AACJ"}
1
+ {"version":3,"file":"index.mjs","names":["INSTANCEOF_PROPERTY","serializeInstanceofChain","isRawError","INSTANCEOF_PROPERTY","matchesInstanceof","matchesInstanceof"],"sources":["../src/constants.ts","../src/module.ts","../src/built-in/unauthorized.ts","../src/built-in/auth-header.ts","../src/built-in/bad-request.ts","../src/built-in/bearer-token.ts","../src/check.ts","../src/built-in/validation.ts","../src/built-in/device-verification-throttled.ts","../src/built-in/entity-conflict.ts","../src/built-in/entity-credentials-invalid.ts","../src/built-in/entity-inactive.ts","../src/built-in/entity-not-found.ts","../src/built-in/internal.ts","../src/built-in/login-throttled.ts","../src/built-in/mfa-throttled.ts","../src/built-in/check.ts","../src/normalize.ts","../src/serialize.ts","../src/status.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum ErrorCode {\n // Generic\n BAD_REQUEST = 'bad_request',\n INTERNAL_ERROR = 'internal_error',\n\n /**\n * An outbound call to a service this server depends on failed, either\n * as a transport failure or as an error answer. Distinct from\n * INTERNAL_ERROR so a caller can tell \"authup is broken\" from \"authup\n * could not reach a dependency\", and so the upstream status is never\n * mirrored onto authup's own response.\n */\n UPSTREAM_ERROR = 'upstream_error',\n\n // HTTP Codes\n HTTP_HEADER_AUTH_TYPE_UNSUPPORTED = 'unsupported_auth_header_type',\n HTTP_BEARER_TOKEN_MALFORMED = 'bearer_token_malformed',\n\n // Identity Auth\n IDENTITY_UNAUTHORIZED = 'identity_unauthorized',\n\n // Entity Codes\n ENTITY_CREDENTIALS_INVALID = 'invalid_credentials',\n ENTITY_INACTIVE = 'entity_inactive',\n ENTITY_NOT_FOUND = 'entity_not_found',\n ENTITY_CONFLICT = 'entity_conflict',\n ENTITY_RELATION_INVALID = 'entity_relation_invalid',\n\n // Identity Codes\n REGISTRATION_DISABLED = 'registration_disabled',\n PASSWORD_RECOVERY_DISABLED = 'password_recovery_disabled',\n EMAIL_VERIFICATION_REQUIRED = 'email_verification_required',\n RESET_TOKEN_EXPIRED = 'reset_token_expired',\n LOGIN_ATTEMPT_THROTTLED = 'login_attempt_throttled',\n MFA_ATTEMPT_THROTTLED = 'mfa_attempt_throttled',\n MFA_NOT_CONFIGURABLE = 'mfa_not_configurable',\n IDENTITY_PROVIDER_ACCOUNT_ALREADY_LINKED = 'identity_provider_account_already_linked',\n IDENTITY_PROVIDER_ACCOUNT_UNLINK_BLOCKED = 'identity_provider_account_unlink_blocked',\n\n // Storage Codes\n STORAGE_INSUFFICIENT = 'storage_insufficient',\n\n // JWK Codes\n JWK_INVALID = 'jwk_invalid',\n JWK_NOT_FOUND = 'jwk_not_found',\n\n // JWT Codes\n JWT_INVALID = 'invalid_token',\n JWT_INACTIVE = 'inactive_token',\n JWT_EXPIRED = 'expired_token',\n\n // Oauth2 Codes\n OAUTH_REDIRECT_URI_MISMATCH = 'redirect_uri_mismatch',\n OAUTH_CLIENT_INVALID = 'invalid_client',\n OAUTH_CLIENT_UNAUTHORIZED = 'unauthorized_client',\n OAUTH_GRANT_INVALID = 'invalid_grant',\n OAUTH_GRANT_TYPE_UNSUPPORTED = 'unsupported_token_grant_type',\n OAUTH_REQUEST_INVALID = 'invalid_request',\n OAUTH_LOGIN_REQUIRED = 'login_required',\n OAUTH_MFA_REQUIRED = 'mfa_required',\n OAUTH_ACCESS_DENIED = 'access_denied',\n OAUTH_INTERACTION_REQUIRED = 'interaction_required',\n OAUTH_ACCOUNT_SELECTION_REQUIRED = 'account_selection_required',\n OAUTH_CONSENT_REQUIRED = 'consent_required',\n OAUTH_RESPONSE_TYPE_UNSUPPORTED = 'unsupported_response_type',\n OAUTH_SCOPE_INVALID = 'invalid_scope',\n OAUTH_SCOPE_INSUFFICIENT = 'insufficient_scope',\n OAUTH_AUTHORIZATION_PENDING = 'authorization_pending',\n OAUTH_SLOW_DOWN = 'slow_down',\n OAUTH_DEVICE_CODE_EXPIRED = 'device_code_expired',\n OAUTH_DEVICE_VERIFICATION_THROTTLED = 'device_verification_throttled',\n\n // Permission Codes\n PERMISSION_NOT_FOUND = 'permission_not_found',\n PERMISSION_DENIED = 'permission_denied',\n PERMISSION_EVALUATION_FAILED = 'permission_evaluation_failed',\n\n // Policy Codes\n POLICY_EVALUATOR_NOT_FOUND = 'policy_evaluator_not_found',\n POLICY_EVALUATOR_NOT_PROCESSABLE = 'policy_evaluator_not_processable',\n POLICY_EVALUATOR_CONTEXT_INVALID = 'policy_evaluator_context_invalid',\n}\n","/*\n * Copyright (c) 2024-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { AuthupErrorInput } from './types.ts';\nimport {\n BaseError,\n INSTANCEOF_PROPERTY,\n markInstanceof,\n serializeInstanceofChain,\n} from '@ebec/core';\n\nexport const AUTHUP_ERROR_INSTANCE = Symbol.for('@authup/errors/AuthupError');\n\nexport class AuthupError extends BaseError {\n public readonly data?: Record<string, any>;\n\n constructor(input?: AuthupErrorInput) {\n super(input);\n markInstanceof(this, AUTHUP_ERROR_INSTANCE);\n\n if (input && typeof input !== 'string' && input.data) {\n this.data = input.data;\n }\n }\n\n /**\n * `super.toJSON()` already emits the serialized marker chain, but the\n * `data` spread runs after it — re-stamped last so a `data` key cannot\n * displace the genuine chain.\n */\n override toJSON() {\n return {\n ...super.toJSON(),\n ...(this.data ?? {}),\n [INSTANCEOF_PROPERTY]: serializeInstanceofChain(this),\n };\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const UNAUTHORIZED_ERROR_INSTANCE = Symbol.for('@authup/errors/UnauthorizedError');\n\nexport class UnauthorizedError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.IDENTITY_UNAUTHORIZED,\n message: 'Authentication required.',\n ...options,\n });\n markInstanceof(this, UNAUTHORIZED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2022-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { UnauthorizedError } from './unauthorized.ts';\n\nexport const AUTH_HEADER_ERROR_INSTANCE = Symbol.for('@authup/errors/AuthHeaderError');\n\nexport class AuthHeaderError extends UnauthorizedError {\n constructor(message: string) {\n super({\n code: ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED,\n message,\n });\n markInstanceof(this, AUTH_HEADER_ERROR_INSTANCE);\n }\n\n static unsupportedType(type: string) {\n return new AuthHeaderError(`The authorization header type ${type} is not supported.`);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const BAD_REQUEST_ERROR_INSTANCE = Symbol.for('@authup/errors/BadRequestError');\n\nexport class BadRequestError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.BAD_REQUEST,\n ...options,\n });\n markInstanceof(this, BAD_REQUEST_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2022-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { UnauthorizedError } from './unauthorized.ts';\n\nexport const BEARER_TOKEN_MALFORMED_ERROR_INSTANCE = Symbol.for('@authup/errors/BearerTokenMalformedError');\n\nexport class BearerTokenMalformedError extends UnauthorizedError {\n constructor(message?: string) {\n super({\n code: ErrorCode.HTTP_BEARER_TOKEN_MALFORMED,\n message: message ?? 'The Authorization header is malformed.',\n });\n markInstanceof(this, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n INSTANCEOF_PROPERTY,\n isObject,\n isError as isRawError,\n matchesInstanceof,\n} from '@ebec/core';\nimport type { AuthupError } from './module.ts';\nimport { AUTHUP_ERROR_INSTANCE } from './module.ts';\n\n/**\n * Duck-type guard for `Error`.\n *\n * Re-exports `@ebec/core`'s shape-based check: `input` matches when it\n * carries the standard `name` / `message` / `stack` triplet, regardless\n * of which realm or class hierarchy produced it. Use this instead of\n * `instanceof Error` for cross-realm boundaries (worker threads,\n * duplicate-module copies) where `instanceof` can yield false negatives.\n */\nexport function isError(input: unknown): input is Error {\n return isRawError(input);\n}\n\n/**\n * Duck-type guard for AuthupError.\n *\n * The chain decides, and only the chain: it matches when the AuthupError\n * marker is in it, as the native symbol (in-process) or its serialized\n * string form (JSON-rehydrated). Subclass instances accumulate this\n * marker, so any AuthupError subclass (`OAuth2Error`, `JWTError`, ...)\n * matches too, while a foreign `@ebec/core` error (rapiq's ParseError,\n * which since 2.2 also carries an `issues` array) does not: it announced\n * its ancestry and AuthupError is not in it.\n *\n * Chain-less input never matches. A shape-based fallback for pre-chain\n * JSON (`BaseError` + `issues: Issue[]`) used to cover that case, but\n * `@ebec/core`'s `isBaseError` became chain-only, so that fallback could\n * never fire — and now that every `BaseError` carries an `issues` array,\n * the shape it checked for would no longer distinguish an AuthupError\n * from any other ebec-derived error anyway. There is no reliable way left\n * to recognise a chain-less legacy payload as specifically an AuthupError.\n */\nexport function isAuthupError(input: unknown): input is AuthupError {\n if (!isObject(input)) {\n return false;\n }\n\n if (!Array.isArray(input[INSTANCEOF_PROPERTY])) {\n return false;\n }\n\n return matchesInstanceof(input, AUTHUP_ERROR_INSTANCE);\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const VALIDATION_ERROR_INSTANCE = Symbol.for('@authup/errors/ValidationError');\n\n/**\n * A domain/business-rule violation raised by core logic. Deliberately NOT\n * named after an HTTP status: core code stays transport-agnostic, and the HTTP\n * adapter maps its `ErrorCode.BAD_REQUEST` to a 400 response\n * (`httpStatusFromCode`). Prefer this over `BadRequestError` in `core/**`.\n */\nexport class ValidationError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.BAD_REQUEST,\n ...options,\n });\n markInstanceof(this, VALIDATION_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE = Symbol.for('@authup/errors/DeviceVerificationThrottledError');\n\nexport type DeviceVerificationThrottledErrorOptions = AuthupErrorOptions & {\n /**\n * Seconds until the per-actor lookup window releases the account.\n */\n retryAfter?: number,\n};\n\nexport class DeviceVerificationThrottledError extends AuthupError {\n constructor(input?: DeviceVerificationThrottledErrorOptions) {\n const { retryAfter, ...rest } = input ?? {};\n super({\n code: ErrorCode.OAUTH_DEVICE_VERIFICATION_THROTTLED,\n message: 'Too many verification attempts. Try again later.',\n ...rest,\n data: {\n ...(typeof retryAfter === 'number' ? { retryAfter } : {}),\n ...(rest.data ?? {}),\n },\n });\n markInstanceof(this, DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_CONFLICT_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityConflictError');\n\nexport class EntityConflictError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_CONFLICT,\n message: entity ? `The ${entity} already exists.` : 'Entity already exists.',\n ...rest,\n });\n markInstanceof(this, ENTITY_CONFLICT_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityCredentialsInvalidError');\n\nexport class EntityCredentialsInvalidError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_CREDENTIALS_INVALID,\n message: entity ? `The ${entity} credentials are invalid.` : 'Credentials are invalid.',\n ...rest,\n });\n markInstanceof(this, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_INACTIVE_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityInactiveError');\n\nexport class EntityInactiveError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_INACTIVE,\n message: entity ? `The ${entity} is inactive.` : 'Entity is inactive.',\n ...rest,\n });\n markInstanceof(this, ENTITY_INACTIVE_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupEntityErrorOptions } from '../types.ts';\n\nexport const ENTITY_NOT_FOUND_ERROR_INSTANCE = Symbol.for('@authup/errors/EntityNotFoundError');\n\nexport class EntityNotFoundError extends AuthupError {\n constructor(input?: string | AuthupEntityErrorOptions) {\n const options: AuthupEntityErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n const { entity, ...rest } = options;\n super({\n code: ErrorCode.ENTITY_NOT_FOUND,\n message: entity ? `The ${entity} was not found.` : 'Entity not found.',\n ...rest,\n });\n markInstanceof(this, ENTITY_NOT_FOUND_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from '../constants.ts';\nimport { markInstanceof } from '@ebec/core';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const INTERNAL_ERROR_INSTANCE = Symbol.for('@authup/errors/InternalError');\n\nexport class InternalError extends AuthupError {\n constructor(input?: string | AuthupErrorOptions) {\n const options: AuthupErrorOptions = typeof input === 'string' ? { message: input } : (input ?? {});\n super({\n code: ErrorCode.INTERNAL_ERROR,\n message: 'An internal error occurred.',\n ...options,\n });\n markInstanceof(this, INTERNAL_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const LOGIN_THROTTLED_ERROR_INSTANCE = Symbol.for('@authup/errors/LoginThrottledError');\n\nexport type LoginThrottledErrorOptions = AuthupErrorOptions & {\n /**\n * Seconds until the sliding throttle window can release the pair.\n */\n retryAfter?: number,\n};\n\nexport class LoginThrottledError extends AuthupError {\n constructor(input?: LoginThrottledErrorOptions) {\n const { retryAfter, ...rest } = input ?? {};\n super({\n code: ErrorCode.LOGIN_ATTEMPT_THROTTLED,\n message: 'Too many failed login attempts. Please try again later.',\n ...rest,\n data: {\n ...(typeof retryAfter === 'number' ? { retryAfter } : {}),\n ...(rest.data ?? {}),\n },\n });\n markInstanceof(this, LOGIN_THROTTLED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { markInstanceof } from '@ebec/core';\nimport { ErrorCode } from '../constants.ts';\nimport { AuthupError } from '../module.ts';\nimport type { AuthupErrorOptions } from '../types.ts';\n\nexport const MFA_THROTTLED_ERROR_INSTANCE = Symbol.for('@authup/errors/MfaThrottledError');\n\nexport type MfaThrottledErrorOptions = AuthupErrorOptions & {\n /**\n * Seconds until the exponential backoff releases the account.\n */\n retryAfter?: number,\n};\n\nexport class MfaThrottledError extends AuthupError {\n constructor(input?: MfaThrottledErrorOptions) {\n const { retryAfter, ...rest } = input ?? {};\n super({\n code: ErrorCode.MFA_ATTEMPT_THROTTLED,\n message: 'Too many failed verification attempts. Please try again later.',\n ...rest,\n data: {\n ...(typeof retryAfter === 'number' ? { retryAfter } : {}),\n ...(rest.data ?? {}),\n },\n });\n markInstanceof(this, MFA_THROTTLED_ERROR_INSTANCE);\n }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isAuthupError } from '../check.ts';\nimport { ErrorCode } from '../constants.ts';\nimport { matchesInstanceof } from '@ebec/core';\nimport { AUTH_HEADER_ERROR_INSTANCE, type AuthHeaderError } from './auth-header.ts';\nimport { BAD_REQUEST_ERROR_INSTANCE, type BadRequestError } from './bad-request.ts';\nimport { VALIDATION_ERROR_INSTANCE, type ValidationError } from './validation.ts';\nimport { BEARER_TOKEN_MALFORMED_ERROR_INSTANCE, type BearerTokenMalformedError } from './bearer-token.ts';\nimport { DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE, type DeviceVerificationThrottledError } from './device-verification-throttled.ts';\nimport { ENTITY_CONFLICT_ERROR_INSTANCE, type EntityConflictError } from './entity-conflict.ts';\nimport { ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE, type EntityCredentialsInvalidError } from './entity-credentials-invalid.ts';\nimport { ENTITY_INACTIVE_ERROR_INSTANCE, type EntityInactiveError } from './entity-inactive.ts';\nimport { ENTITY_NOT_FOUND_ERROR_INSTANCE, type EntityNotFoundError } from './entity-not-found.ts';\nimport { INTERNAL_ERROR_INSTANCE, type InternalError } from './internal.ts';\nimport { LOGIN_THROTTLED_ERROR_INSTANCE, type LoginThrottledError } from './login-throttled.ts';\nimport { MFA_THROTTLED_ERROR_INSTANCE, type MfaThrottledError } from './mfa-throttled.ts';\nimport { UNAUTHORIZED_ERROR_INSTANCE, type UnauthorizedError } from './unauthorized.ts';\n\nexport function isAuthHeaderError(input: unknown): input is AuthHeaderError {\n if (matchesInstanceof(input, AUTH_HEADER_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED;\n}\n\nexport function isBearerTokenMalformedError(input: unknown): input is BearerTokenMalformedError {\n if (matchesInstanceof(input, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.HTTP_BEARER_TOKEN_MALFORMED;\n}\n\nexport function isBadRequestError(input: unknown): input is BadRequestError {\n if (matchesInstanceof(input, BAD_REQUEST_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.BAD_REQUEST;\n}\n\nexport function isValidationError(input: unknown): input is ValidationError {\n if (matchesInstanceof(input, VALIDATION_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.BAD_REQUEST;\n}\n\nexport function isUnauthorizedError(input: unknown): input is UnauthorizedError {\n if (matchesInstanceof(input, UNAUTHORIZED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.IDENTITY_UNAUTHORIZED;\n}\n\nexport function isEntityNotFoundError(input: unknown): input is EntityNotFoundError {\n if (matchesInstanceof(input, ENTITY_NOT_FOUND_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_NOT_FOUND;\n}\n\nexport function isEntityConflictError(input: unknown): input is EntityConflictError {\n if (matchesInstanceof(input, ENTITY_CONFLICT_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_CONFLICT;\n}\n\nexport function isEntityInactiveError(input: unknown): input is EntityInactiveError {\n if (matchesInstanceof(input, ENTITY_INACTIVE_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_INACTIVE;\n}\n\nexport function isEntityCredentialsInvalidError(input: unknown): input is EntityCredentialsInvalidError {\n if (matchesInstanceof(input, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.ENTITY_CREDENTIALS_INVALID;\n}\n\nexport function isInternalError(input: unknown): input is InternalError {\n if (matchesInstanceof(input, INTERNAL_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.INTERNAL_ERROR;\n}\n\nexport function isLoginThrottledError(input: unknown): input is LoginThrottledError {\n if (matchesInstanceof(input, LOGIN_THROTTLED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.LOGIN_ATTEMPT_THROTTLED;\n}\n\nexport function isMfaThrottledError(input: unknown): input is MfaThrottledError {\n if (matchesInstanceof(input, MFA_THROTTLED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.MFA_ATTEMPT_THROTTLED;\n}\n\nexport function isDeviceVerificationThrottledError(input: unknown): input is DeviceVerificationThrottledError {\n if (matchesInstanceof(input, DEVICE_VERIFICATION_THROTTLED_ERROR_INSTANCE)) return true;\n if (!isAuthupError(input)) return false;\n return input.code === ErrorCode.OAUTH_DEVICE_VERIFICATION_THROTTLED;\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isError } from './check.ts';\n\n/**\n * Normalize an arbitrary thrown value into an `Error` instance.\n *\n * Useful at error-pipeline boundaries (catch blocks, error middleware,\n * fallbacks) where TypeScript hands you `unknown` but downstream code\n * wants a real `Error` to inspect or rethrow. Duck-typed: any value\n * passing `isError` is returned as-is. Strings become `new Error(str)`;\n * any other value is stringified.\n */\nexport function normalizeError(input: unknown): Error {\n if (isError(input)) {\n return input;\n }\n\n if (typeof input === 'string') {\n return new Error(input);\n }\n\n return new Error(String(input));\n}\n\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject } from '@ebec/core';\n\n/**\n * Convert an `Error` (or any value with a `toJSON()` method) into a\n * plain object suitable for embedding in a JSON response body.\n *\n * Calls `input.toJSON()` if present — preserves every attribute the\n * error chose to surface (`code`, `cause`, `errors`, `issues`, `data`,\n * AuthupError sub-class fields, ...). Falls back to spreading the\n * Error's enumerable own properties alongside the standard\n * `name` / `message` pair, so caller-attached fields survive.\n *\n * Pair with `normalizeError` to handle arbitrary thrown values:\n * `serializeError(normalizeError(e))`.\n */\nexport function serializeError(input: Error): Record<string, any> {\n if ('toJSON' in input && typeof input.toJSON === 'function') {\n const output = input.toJSON();\n if (isObject(output)) {\n return output;\n }\n }\n\n return {\n ...input,\n name: input.name,\n message: input.message,\n };\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { ErrorCode } from './constants.ts';\n\n/**\n * Default mapping from `ErrorCode` to HTTP status. Adapters apply this and\n * may layer their own overrides on top. Codes not listed here fall back\n * to 400 (Bad Request) — which is the right default for \"validation /\n * malformed-request\" style errors.\n *\n * The mapping mirrors the HTTP statuses produced by the pre-refactor\n * `@ebec/http`-coupled error classes, with one intentional change:\n *\n * - `OAUTH_CLIENT_INVALID`: 400 → **401**, per RFC 6749 §5.2 (`invalid_client`\n * responses should use 401). Surfaces as a behavior change in HTTP-level\n * tests asserting `status: 400, code: OAUTH_CLIENT_INVALID`.\n * - The three `JWT_*` codes: 400 (the unlisted fallback) → **401**, per\n * RFC 6750 §3.1, which is the status for a resource request carrying an\n * expired or otherwise unusable bearer. They had never been listed, so a\n * dead bearer answered 400 while a MISSING one answered 401, and no\n * client could tell \"your credential died\" from \"your request was\n * malformed\" by status alone. The token endpoint is where RFC 6749 §5.2\n * and RFC 7662/7009 want something else, and each of its handlers says so\n * at its own call site rather than here: the refresh grant re-throws a\n * verification failure as `invalid_grant`, introspection reports one as\n * `active: false`, and revocation answers its ordinary success. A new\n * token-endpoint path that verifies a JWT has to do the same - this map\n * cannot know which surface it is on.\n */\nexport const ERROR_CODE_TO_STATUS: Readonly<Partial<Record<`${ErrorCode}`, number>>> = {\n // 401\n [ErrorCode.OAUTH_CLIENT_INVALID]: 401,\n [ErrorCode.HTTP_BEARER_TOKEN_MALFORMED]: 401,\n [ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED]: 401,\n [ErrorCode.IDENTITY_UNAUTHORIZED]: 401,\n [ErrorCode.JWT_EXPIRED]: 401,\n [ErrorCode.JWT_INACTIVE]: 401,\n [ErrorCode.JWT_INVALID]: 401,\n\n // 403\n [ErrorCode.PERMISSION_NOT_FOUND]: 403,\n [ErrorCode.PERMISSION_DENIED]: 403,\n [ErrorCode.PERMISSION_EVALUATION_FAILED]: 403,\n\n // 404\n [ErrorCode.ENTITY_NOT_FOUND]: 404,\n [ErrorCode.JWK_NOT_FOUND]: 404,\n\n // 409\n [ErrorCode.ENTITY_CONFLICT]: 409,\n\n // 429\n [ErrorCode.LOGIN_ATTEMPT_THROTTLED]: 429,\n [ErrorCode.MFA_ATTEMPT_THROTTLED]: 429,\n [ErrorCode.OAUTH_DEVICE_VERIFICATION_THROTTLED]: 429,\n\n // 500\n [ErrorCode.INTERNAL_ERROR]: 500,\n\n // 502\n [ErrorCode.UPSTREAM_ERROR]: 502,\n\n // 507\n [ErrorCode.STORAGE_INSUFFICIENT]: 507,\n};\n\n/**\n * Resolve an HTTP status for a given error code. Unknown codes fall back\n * to `fallback` (default 400).\n */\nexport function httpStatusFromCode(code: string, fallback = 400): number {\n return ERROR_CODE_TO_STATUS[code as `${ErrorCode}`] ?? fallback;\n}\n\n/**\n * Resolve a semantic `ErrorCode` for a foreign HTTP status. Used at the\n * boundary where a non-AuthupError (e.g. `@ebec/http` HTTPError thrown by\n * the framework, or a foreign service response) enters our system and\n * needs to be normalized into an `AuthupError` with an authup-vocabulary\n * code. Status is the only stable handshake across the two vocabularies.\n *\n * Default mapping covers the common HTTP statuses. Anything 5xx\n * collapses to `INTERNAL_ERROR`; unknown 4xx collapses to `BAD_REQUEST`.\n */\nexport function codeFromHttpStatus(status: number): ErrorCode {\n if (status === 404) return ErrorCode.ENTITY_NOT_FOUND;\n if (status === 409) return ErrorCode.ENTITY_CONFLICT;\n if (status === 401) return ErrorCode.IDENTITY_UNAUTHORIZED;\n if (status === 403) return ErrorCode.PERMISSION_DENIED;\n if (status === 429) return ErrorCode.LOGIN_ATTEMPT_THROTTLED;\n if (status === 507) return ErrorCode.STORAGE_INSUFFICIENT;\n if (status >= 500) return ErrorCode.INTERNAL_ERROR;\n return ErrorCode.BAD_REQUEST;\n}\n"],"mappings":";;AAOA,IAAY,YAAL,yBAAA,WAAA;CAEH,UAAA,iBAAA;CACA,UAAA,oBAAA;;;;;;;;CASA,UAAA,oBAAA;CAGA,UAAA,uCAAA;CACA,UAAA,iCAAA;CAGA,UAAA,2BAAA;CAGA,UAAA,gCAAA;CACA,UAAA,qBAAA;CACA,UAAA,sBAAA;CACA,UAAA,qBAAA;CACA,UAAA,6BAAA;CAGA,UAAA,2BAAA;CACA,UAAA,gCAAA;CACA,UAAA,iCAAA;CACA,UAAA,yBAAA;CACA,UAAA,6BAAA;CACA,UAAA,2BAAA;CACA,UAAA,0BAAA;CACA,UAAA,8CAAA;CACA,UAAA,8CAAA;CAGA,UAAA,0BAAA;CAGA,UAAA,iBAAA;CACA,UAAA,mBAAA;CAGA,UAAA,iBAAA;CACA,UAAA,kBAAA;CACA,UAAA,iBAAA;CAGA,UAAA,iCAAA;CACA,UAAA,0BAAA;CACA,UAAA,+BAAA;CACA,UAAA,yBAAA;CACA,UAAA,kCAAA;CACA,UAAA,2BAAA;CACA,UAAA,0BAAA;CACA,UAAA,wBAAA;CACA,UAAA,yBAAA;CACA,UAAA,gCAAA;CACA,UAAA,sCAAA;CACA,UAAA,4BAAA;CACA,UAAA,qCAAA;CACA,UAAA,yBAAA;CACA,UAAA,8BAAA;CACA,UAAA,iCAAA;CACA,UAAA,qBAAA;CACA,UAAA,+BAAA;CACA,UAAA,yCAAA;CAGA,UAAA,0B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,KAAK,OAAA;CACpB,IAAI,WAAW,KAAK,OAAA;CACpB,IAAI,UAAU,KAAK,OAAA;CACnB,OAAA;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC,CAkClF,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,CAEvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAS5D"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC,CAmClF,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,CAEvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAS5D"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authup/errors",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.64",
4
+ "version": "1.0.0-beta.66",
5
5
  "description": "Package containing error codes and basic error classes.",
6
6
  "license": "Apache-2.0",
7
7
  "exports": {