@authup/errors 1.0.0-beta.56 → 1.0.0-beta.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check.d.ts +5 -4
- package/dist/check.d.ts.map +1 -1
- package/dist/index.d.mts +13 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +27 -20
- package/dist/index.mjs.map +1 -1
- package/dist/module.d.ts +6 -0
- package/dist/module.d.ts.map +1 -1
- package/package.json +8 -4
package/dist/check.d.ts
CHANGED
|
@@ -12,13 +12,14 @@ export declare function isError(input: unknown): input is Error;
|
|
|
12
12
|
/**
|
|
13
13
|
* Duck-type guard for AuthupError.
|
|
14
14
|
*
|
|
15
|
-
* Fast path: input has the AuthupError marker in its `@instanceof` chain
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Fast path: input has the AuthupError marker in its `@instanceof` chain —
|
|
16
|
+
* as the native symbol (in-process) or its serialized string form
|
|
17
|
+
* (JSON-rehydrated). Subclass instances also accumulate this marker, so this
|
|
18
|
+
* guard matches any AuthupError subclass (`OAuth2Error`, `JWTError`, etc.).
|
|
18
19
|
*
|
|
19
20
|
* Slow path: input is shape-compatible with AuthupError (BaseError + has
|
|
20
21
|
* `issues: Issue[]`). Catches cases where the marker is missing — plain
|
|
21
|
-
* objects rehydrated from JSON
|
|
22
|
+
* objects rehydrated from JSON emitted by older builds without the chain.
|
|
22
23
|
*/
|
|
23
24
|
export declare function isAuthupError(input: unknown): input is AuthupError;
|
|
24
25
|
//# sourceMappingURL=check.d.ts.map
|
package/dist/check.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEtD;AAED
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAclE"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BASE_ERROR_INSTANCE, BaseError, ErrorOptions, INSTANCEOF_PROPERTY, hasInstanceof, markInstanceof } from "@ebec/core";
|
|
1
|
+
import { BASE_ERROR_INSTANCE, BaseError, ErrorOptions, INSTANCEOF_PROPERTY, hasInstanceof, markInstanceof, matchesInstanceof, serializeInstanceofChain } from "@ebec/core";
|
|
2
2
|
import { Issue } from "validup";
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
type AuthupErrorOptions = ErrorOptions & {
|
|
@@ -16,7 +16,13 @@ declare class AuthupError extends BaseError {
|
|
|
16
16
|
readonly issues: Issue[];
|
|
17
17
|
readonly data?: Record<string, any>;
|
|
18
18
|
constructor(input?: AuthupErrorInput);
|
|
19
|
+
/**
|
|
20
|
+
* `super.toJSON()` already emits the serialized marker chain, but the
|
|
21
|
+
* `data` spread runs after it — re-stamped last so a `data` key cannot
|
|
22
|
+
* displace the genuine chain.
|
|
23
|
+
*/
|
|
19
24
|
toJSON(): {
|
|
25
|
+
"@instanceof": string[];
|
|
20
26
|
issues: Issue[];
|
|
21
27
|
name: string;
|
|
22
28
|
message: string;
|
|
@@ -145,13 +151,14 @@ declare function isError(input: unknown): input is Error;
|
|
|
145
151
|
/**
|
|
146
152
|
* Duck-type guard for AuthupError.
|
|
147
153
|
*
|
|
148
|
-
* Fast path: input has the AuthupError marker in its `@instanceof` chain
|
|
149
|
-
*
|
|
150
|
-
*
|
|
154
|
+
* Fast path: input has the AuthupError marker in its `@instanceof` chain —
|
|
155
|
+
* as the native symbol (in-process) or its serialized string form
|
|
156
|
+
* (JSON-rehydrated). Subclass instances also accumulate this marker, so this
|
|
157
|
+
* guard matches any AuthupError subclass (`OAuth2Error`, `JWTError`, etc.).
|
|
151
158
|
*
|
|
152
159
|
* Slow path: input is shape-compatible with AuthupError (BaseError + has
|
|
153
160
|
* `issues: Issue[]`). Catches cases where the marker is missing — plain
|
|
154
|
-
* objects rehydrated from JSON
|
|
161
|
+
* objects rehydrated from JSON emitted by older builds without the chain.
|
|
155
162
|
*/
|
|
156
163
|
declare function isAuthupError(input: unknown): input is AuthupError;
|
|
157
164
|
//#endregion
|
|
@@ -263,5 +270,5 @@ declare function httpStatusFromCode(code: string, fallback?: number): number;
|
|
|
263
270
|
*/
|
|
264
271
|
declare function codeFromHttpStatus(status: number): ErrorCode;
|
|
265
272
|
//#endregion
|
|
266
|
-
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, normalizeError, serializeError };
|
|
273
|
+
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 };
|
|
267
274
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -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;;;
|
|
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;;;cCHjC;cAEA,oBAAoB;WACb,QAAQ;WAER,OAAO;EAEX,YAAA,QAAQ;;;;;;EAgBX;;;;;;;;;;;;cC3BA;cAEA,0BAA0B;EACvB,YAAA,iBAAiB;;;;cCJpB;cAEA,wBAAwB;EACrB,YAAA;SAQL,gBAAgB,eAAY;;;;cCV1B;cAEA,wBAAwB;EACrB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C,eAAe,OAAO,QAAQ;;;;;;;;;;;;;;;;cCAjC,sBAAsB,SAAS,QAAQ,UAAU;;;;;iBAkC9C,mBAAmB,cAAc;;;;;;;;;;;iBAcjC,mBAAmB,iBAAiB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BASE_ERROR_INSTANCE, INSTANCEOF_PROPERTY, hasInstanceof, markInstanceof, } from '@ebec/core';
|
|
1
|
+
export { BASE_ERROR_INSTANCE, INSTANCEOF_PROPERTY, hasInstanceof, markInstanceof, matchesInstanceof, serializeInstanceofChain, } from '@ebec/core';
|
|
2
2
|
export * from './built-in';
|
|
3
3
|
export * from './check';
|
|
4
4
|
export * from './constants';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,wBAAwB,GAC3B,MAAM,YAAY,CAAC;AACpB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BASE_ERROR_INSTANCE, BaseError, INSTANCEOF_PROPERTY,
|
|
1
|
+
import { BASE_ERROR_INSTANCE, BaseError, INSTANCEOF_PROPERTY, INSTANCEOF_PROPERTY as INSTANCEOF_PROPERTY$1, hasInstanceof, isBaseError, isError as isError$1, isObject, markInstanceof, markInstanceof as markInstanceof$1, matchesInstanceof, matchesInstanceof as matchesInstanceof$1, serializeInstanceofChain, serializeInstanceofChain as serializeInstanceofChain$1 } from "@ebec/core";
|
|
2
2
|
//#region src/constants.ts
|
|
3
3
|
let ErrorCode = /* @__PURE__ */ function(ErrorCode) {
|
|
4
4
|
ErrorCode["BAD_REQUEST"] = "bad_request";
|
|
@@ -59,11 +59,17 @@ var AuthupError = class extends BaseError {
|
|
|
59
59
|
this.issues = [];
|
|
60
60
|
if (input && typeof input !== "string" && input.data) this.data = input.data;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* `super.toJSON()` already emits the serialized marker chain, but the
|
|
64
|
+
* `data` spread runs after it — re-stamped last so a `data` key cannot
|
|
65
|
+
* displace the genuine chain.
|
|
66
|
+
*/
|
|
62
67
|
toJSON() {
|
|
63
68
|
return {
|
|
64
69
|
...super.toJSON(),
|
|
65
70
|
issues: this.issues,
|
|
66
|
-
...this.data ?? {}
|
|
71
|
+
...this.data ?? {},
|
|
72
|
+
[INSTANCEOF_PROPERTY$1]: serializeInstanceofChain$1(this)
|
|
67
73
|
};
|
|
68
74
|
}
|
|
69
75
|
};
|
|
@@ -136,16 +142,17 @@ function isError(input) {
|
|
|
136
142
|
/**
|
|
137
143
|
* Duck-type guard for AuthupError.
|
|
138
144
|
*
|
|
139
|
-
* Fast path: input has the AuthupError marker in its `@instanceof` chain
|
|
140
|
-
*
|
|
141
|
-
*
|
|
145
|
+
* Fast path: input has the AuthupError marker in its `@instanceof` chain —
|
|
146
|
+
* as the native symbol (in-process) or its serialized string form
|
|
147
|
+
* (JSON-rehydrated). Subclass instances also accumulate this marker, so this
|
|
148
|
+
* guard matches any AuthupError subclass (`OAuth2Error`, `JWTError`, etc.).
|
|
142
149
|
*
|
|
143
150
|
* Slow path: input is shape-compatible with AuthupError (BaseError + has
|
|
144
151
|
* `issues: Issue[]`). Catches cases where the marker is missing — plain
|
|
145
|
-
* objects rehydrated from JSON
|
|
152
|
+
* objects rehydrated from JSON emitted by older builds without the chain.
|
|
146
153
|
*/
|
|
147
154
|
function isAuthupError(input) {
|
|
148
|
-
if (
|
|
155
|
+
if (matchesInstanceof$1(input, AUTHUP_ERROR_INSTANCE)) return true;
|
|
149
156
|
if (!isBaseError(input)) return false;
|
|
150
157
|
if (!isObject(input)) return false;
|
|
151
158
|
return Array.isArray(input.issues);
|
|
@@ -276,62 +283,62 @@ var MfaThrottledError = class extends AuthupError {
|
|
|
276
283
|
//#endregion
|
|
277
284
|
//#region src/built-in/check.ts
|
|
278
285
|
function isAuthHeaderError(input) {
|
|
279
|
-
if (
|
|
286
|
+
if (matchesInstanceof$1(input, AUTH_HEADER_ERROR_INSTANCE)) return true;
|
|
280
287
|
if (!isAuthupError(input)) return false;
|
|
281
288
|
return input.code === "unsupported_auth_header_type";
|
|
282
289
|
}
|
|
283
290
|
function isBearerTokenMalformedError(input) {
|
|
284
|
-
if (
|
|
291
|
+
if (matchesInstanceof$1(input, BEARER_TOKEN_MALFORMED_ERROR_INSTANCE)) return true;
|
|
285
292
|
if (!isAuthupError(input)) return false;
|
|
286
293
|
return input.code === "bearer_token_malformed";
|
|
287
294
|
}
|
|
288
295
|
function isBadRequestError(input) {
|
|
289
|
-
if (
|
|
296
|
+
if (matchesInstanceof$1(input, BAD_REQUEST_ERROR_INSTANCE)) return true;
|
|
290
297
|
if (!isAuthupError(input)) return false;
|
|
291
298
|
return input.code === "bad_request";
|
|
292
299
|
}
|
|
293
300
|
function isValidationError(input) {
|
|
294
|
-
if (
|
|
301
|
+
if (matchesInstanceof$1(input, VALIDATION_ERROR_INSTANCE)) return true;
|
|
295
302
|
if (!isAuthupError(input)) return false;
|
|
296
303
|
return input.code === "bad_request";
|
|
297
304
|
}
|
|
298
305
|
function isUnauthorizedError(input) {
|
|
299
|
-
if (
|
|
306
|
+
if (matchesInstanceof$1(input, UNAUTHORIZED_ERROR_INSTANCE)) return true;
|
|
300
307
|
if (!isAuthupError(input)) return false;
|
|
301
308
|
return input.code === "identity_unauthorized";
|
|
302
309
|
}
|
|
303
310
|
function isEntityNotFoundError(input) {
|
|
304
|
-
if (
|
|
311
|
+
if (matchesInstanceof$1(input, ENTITY_NOT_FOUND_ERROR_INSTANCE)) return true;
|
|
305
312
|
if (!isAuthupError(input)) return false;
|
|
306
313
|
return input.code === "entity_not_found";
|
|
307
314
|
}
|
|
308
315
|
function isEntityConflictError(input) {
|
|
309
|
-
if (
|
|
316
|
+
if (matchesInstanceof$1(input, ENTITY_CONFLICT_ERROR_INSTANCE)) return true;
|
|
310
317
|
if (!isAuthupError(input)) return false;
|
|
311
318
|
return input.code === "entity_conflict";
|
|
312
319
|
}
|
|
313
320
|
function isEntityInactiveError(input) {
|
|
314
|
-
if (
|
|
321
|
+
if (matchesInstanceof$1(input, ENTITY_INACTIVE_ERROR_INSTANCE)) return true;
|
|
315
322
|
if (!isAuthupError(input)) return false;
|
|
316
323
|
return input.code === "entity_inactive";
|
|
317
324
|
}
|
|
318
325
|
function isEntityCredentialsInvalidError(input) {
|
|
319
|
-
if (
|
|
326
|
+
if (matchesInstanceof$1(input, ENTITY_CREDENTIALS_INVALID_ERROR_INSTANCE)) return true;
|
|
320
327
|
if (!isAuthupError(input)) return false;
|
|
321
328
|
return input.code === "invalid_credentials";
|
|
322
329
|
}
|
|
323
330
|
function isInternalError(input) {
|
|
324
|
-
if (
|
|
331
|
+
if (matchesInstanceof$1(input, INTERNAL_ERROR_INSTANCE)) return true;
|
|
325
332
|
if (!isAuthupError(input)) return false;
|
|
326
333
|
return input.code === "internal_error";
|
|
327
334
|
}
|
|
328
335
|
function isLoginThrottledError(input) {
|
|
329
|
-
if (
|
|
336
|
+
if (matchesInstanceof$1(input, LOGIN_THROTTLED_ERROR_INSTANCE)) return true;
|
|
330
337
|
if (!isAuthupError(input)) return false;
|
|
331
338
|
return input.code === "login_attempt_throttled";
|
|
332
339
|
}
|
|
333
340
|
function isMfaThrottledError(input) {
|
|
334
|
-
if (
|
|
341
|
+
if (matchesInstanceof$1(input, MFA_THROTTLED_ERROR_INSTANCE)) return true;
|
|
335
342
|
if (!isAuthupError(input)) return false;
|
|
336
343
|
return input.code === "mfa_attempt_throttled";
|
|
337
344
|
}
|
|
@@ -436,6 +443,6 @@ function codeFromHttpStatus(status) {
|
|
|
436
443
|
return "bad_request";
|
|
437
444
|
}
|
|
438
445
|
//#endregion
|
|
439
|
-
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, normalizeError, serializeError };
|
|
446
|
+
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 };
|
|
440
447
|
|
|
441
448
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["isRawError","hasInstanceof","hasInstanceof"],"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 // 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\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 { BaseError, markInstanceof } from '@ebec/core';\nimport type { Issue } from 'validup';\n\nexport const AUTHUP_ERROR_INSTANCE = Symbol.for('@authup/errors/AuthupError');\n\nexport class AuthupError extends BaseError {\n public readonly issues: Issue[];\n\n public readonly data?: Record<string, any>;\n\n constructor(input?: AuthupErrorInput) {\n super(input);\n markInstanceof(this, AUTHUP_ERROR_INSTANCE);\n\n this.issues = [];\n\n if (input && typeof input !== 'string' && input.data) {\n this.data = input.data;\n }\n }\n\n override toJSON() {\n return {\n ...super.toJSON(),\n issues: this.issues,\n ...(this.data ?? {}),\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 hasInstanceof,\n isBaseError,\n isObject,\n isError as isRawError,\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 * Fast path: input has the AuthupError marker in its `@instanceof` chain.\n * Subclass instances also accumulate this marker, so this guard matches any\n * AuthupError subclass (`OAuth2Error`, `JWTError`, etc.).\n *\n * Slow path: input is shape-compatible with AuthupError (BaseError + has\n * `issues: Issue[]`). Catches cases where the marker is missing — plain\n * objects rehydrated from JSON, older builds without the marker.\n */\nexport function isAuthupError(input: unknown): input is AuthupError {\n if (hasInstanceof(input, AUTHUP_ERROR_INSTANCE)) {\n return true;\n }\n\n if (!isBaseError(input)) {\n return false;\n }\n\n if (!isObject(input)) {\n return false;\n }\n\n return Array.isArray(input.issues);\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 { hasInstanceof } 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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 (hasInstanceof(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 */\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\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 // 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;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;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;CAGA,UAAA,0BAAA;CACA,UAAA,uBAAA;CACA,UAAA,kCAAA;CAGA,UAAA,gCAAA;CACA,UAAA,sCAAA;CACA,UAAA,sCAAA;;AACJ,EAAA,CAAA,CAAA;;;AC9DA,MAAa,wBAAwB,OAAO,IAAI,4BAA4B;AAE5E,IAAa,cAAb,cAAiC,UAAU;CACvC;CAEA;CAEA,YAAY,OAA0B;EAClC,MAAM,KAAK;EACX,iBAAe,MAAM,qBAAqB;EAE1C,KAAK,SAAS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EAGD,yBAAA;EACH,sBAAA;EACW,iCAAA;EAGZ,qBAAA;EACH,kBAAA;EAGE,oBAAA;EAGQ,4BAAA;EACF,0BAAA;EAGP,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","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 // 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\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';\nimport type { Issue } from 'validup';\n\nexport const AUTHUP_ERROR_INSTANCE = Symbol.for('@authup/errors/AuthupError');\n\nexport class AuthupError extends BaseError {\n public readonly issues: Issue[];\n\n public readonly data?: Record<string, any>;\n\n constructor(input?: AuthupErrorInput) {\n super(input);\n markInstanceof(this, AUTHUP_ERROR_INSTANCE);\n\n this.issues = [];\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 issues: this.issues,\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 isBaseError,\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 * Fast path: input has the AuthupError marker in its `@instanceof` chain —\n * as the native symbol (in-process) or its serialized string form\n * (JSON-rehydrated). Subclass instances also accumulate this marker, so this\n * guard matches any AuthupError subclass (`OAuth2Error`, `JWTError`, etc.).\n *\n * Slow path: input is shape-compatible with AuthupError (BaseError + has\n * `issues: Issue[]`). Catches cases where the marker is missing — plain\n * objects rehydrated from JSON emitted by older builds without the chain.\n */\nexport function isAuthupError(input: unknown): input is AuthupError {\n if (matchesInstanceof(input, AUTHUP_ERROR_INSTANCE)) {\n return true;\n }\n\n if (!isBaseError(input)) {\n return false;\n }\n\n if (!isObject(input)) {\n return false;\n }\n\n return Array.isArray(input.issues);\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 */\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\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 // 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;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;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;CAGA,UAAA,0BAAA;CACA,UAAA,uBAAA;CACA,UAAA,kCAAA;CAGA,UAAA,gCAAA;CACA,UAAA,sCAAA;CACA,UAAA,sCAAA;;AACJ,EAAA,CAAA,CAAA;;;ACzDA,MAAa,wBAAwB,OAAO,IAAI,4BAA4B;AAE5E,IAAa,cAAb,cAAiC,UAAU;CACvC;CAEA;CAEA,YAAY,OAA0B;EAClC,MAAM,KAAK;EACX,iBAAe,MAAM,qBAAqB;EAE1C,KAA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0E;EAEjD,mBAAA;EACO,2BAAA;EACM,iCAAA;EACZ,0BAAA;EAGD,yBAAA;EACH,sBAAA;EACW,iCAAA;EAGZ,qBAAA;EACH,kBAAA;EAGE,oBAAA;EAGQ,4BAAA;EACF,0BAAA;EAGP,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"}
|
package/dist/module.d.ts
CHANGED
|
@@ -6,7 +6,13 @@ export declare class AuthupError extends BaseError {
|
|
|
6
6
|
readonly issues: Issue[];
|
|
7
7
|
readonly data?: Record<string, any>;
|
|
8
8
|
constructor(input?: AuthupErrorInput);
|
|
9
|
+
/**
|
|
10
|
+
* `super.toJSON()` already emits the serialized marker chain, but the
|
|
11
|
+
* `data` spread runs after it — re-stamped last so a `data` key cannot
|
|
12
|
+
* displace the genuine chain.
|
|
13
|
+
*/
|
|
9
14
|
toJSON(): {
|
|
15
|
+
"@instanceof": string[];
|
|
10
16
|
issues: Issue[];
|
|
11
17
|
name: string;
|
|
12
18
|
message: string;
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EACH,SAAS,EAIZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,qBAAqB,eAA2C,CAAC;AAE9E,qBAAa,WAAY,SAAQ,SAAS;IACtC,SAAgB,MAAM,EAAE,KAAK,EAAE,CAAC;IAEhC,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAE/B,KAAK,CAAC,EAAE,gBAAgB;IAWpC;;;;OAIG;IACM,MAAM;;;;;;;;;CAQlB"}
|
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.
|
|
4
|
+
"version": "1.0.0-beta.58",
|
|
5
5
|
"description": "Package containing error codes and basic error classes.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"exports": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
21
21
|
"build:js": "tsdown",
|
|
22
|
-
"build": "rimraf ./dist && npm run build:js && npm run build:types"
|
|
22
|
+
"build": "rimraf ./dist && npm run build:js && npm run build:types",
|
|
23
|
+
"test": "cross-env NODE_ENV=test vitest run test/unit"
|
|
23
24
|
},
|
|
24
25
|
"engines": {
|
|
25
26
|
"node": "^22.13.0 || ^23.5.0 || >=24.0.0"
|
|
@@ -49,8 +50,11 @@
|
|
|
49
50
|
},
|
|
50
51
|
"homepage": "https://github.com/authup/authup#readme",
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@ebec/core": "^1.
|
|
53
|
-
"validup": "^0.
|
|
53
|
+
"@ebec/core": "^1.2.0",
|
|
54
|
+
"validup": "^1.0.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"vitest": "^4.0.14"
|
|
54
58
|
},
|
|
55
59
|
"publishConfig": {
|
|
56
60
|
"access": "public"
|