@authup/errors 1.0.0-beta.24 → 1.0.0-beta.25

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/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2021-2024 Peter Placzek
189
+ Copyright 2021-2025 Peter Placzek
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -0,0 +1,6 @@
1
+ import type { AuthorizationHeaderType } from 'hapic';
2
+ import { AuthupError } from '../module';
3
+ export declare class HTTPError extends AuthupError {
4
+ static unsupportedHeaderType(type: `${AuthorizationHeaderType}`): HTTPError;
5
+ }
6
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/built-in/http.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,SAAU,SAAQ,WAAW;IACtC,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,GAAG,uBAAuB,EAAE;CAMlE"}
@@ -1,2 +1,2 @@
1
- export * from './header';
1
+ export * from './http';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/built-in/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/built-in/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC"}
@@ -1,18 +1,19 @@
1
1
  export declare enum ErrorCode {
2
- HEADER_INVALID = "invalid_header",
3
- HEADER_AUTH_TYPE_UNSUPPORTED = "unsupported_auth_header_type",
4
- CREDENTIALS_INVALID = "invalid_credentials",
5
- ENTITY_INACTIVE = "inactive_entity",
6
- TOKEN_REDIRECT_URI_MISMATCH = "redirect_uri_mismatch",
7
- TOKEN_INVALID = "invalid_token",
8
- TOKEN_INACTIVE = "inactive_token",
9
- TOKEN_EXPIRED = "expired_token",
10
- TOKEN_CLIENT_INVALID = "invalid_client",
11
- TOKEN_GRANT_INVALID = "invalid_grant",
12
- TOKEN_GRANT_TYPE_UNSUPPORTED = "unsupported_token_grant_type",
13
- TOKEN_SCOPE_INVALID = "invalid_scope",
14
- TOKEN_SCOPE_INSUFFICIENT = "insufficient_scope",
15
- TOKEN_SUB_KIND_INVALID = "invalid_token_sub_kind",
2
+ HTTP_HEADER_AUTH_TYPE_UNSUPPORTED = "unsupported_auth_header_type",
3
+ ENTITY_CREDENTIALS_INVALID = "invalid_credentials",
4
+ ENTITY_INACTIVE = "entity_inactive",
5
+ ENTITY_NOT_FOUND = "entity_not_found",
6
+ JWK_INVALID = "jwk_invalid",
7
+ JWK_NOT_FOUND = "jwk_not_found",
8
+ JWT_INVALID = "invalid_token",
9
+ JWT_INACTIVE = "inactive_token",
10
+ JWT_EXPIRED = "expired_token",
11
+ OAUTH_REDIRECT_URI_MISMATCH = "redirect_uri_mismatch",
12
+ OAUTH_CLIENT_INVALID = "invalid_client",
13
+ OAUTH_GRANT_INVALID = "invalid_grant",
14
+ OAUTH_GRANT_TYPE_UNSUPPORTED = "unsupported_token_grant_type",
15
+ OAUTH_SCOPE_INVALID = "invalid_scope",
16
+ OAUTH_SCOPE_INSUFFICIENT = "insufficient_scope",
16
17
  PERMISSION_NOT_FOUND = "permission_not_found",
17
18
  PERMISSION_DENIED = "permission_denied",
18
19
  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;IACjB,cAAc,mBAAmB;IACjC,4BAA4B,iCAAiC;IAE7D,mBAAmB,wBAAwB;IAE3C,eAAe,oBAAoB;IAEnC,2BAA2B,0BAA0B;IACrD,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,oBAAoB,mBAAmB;IACvC,mBAAmB,kBAAkB;IACrC,4BAA4B,iCAAiC;IAC7D,mBAAmB,kBAAkB;IACrC,wBAAwB,uBAAuB;IAC/C,sBAAsB,2BAA2B;IAEjD,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,4BAA4B,iCAAiC;IAE7D,0BAA0B,+BAA+B;IACzD,gCAAgC,qCAAqC;IACrE,gCAAgC,qCAAqC;CACxE"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,SAAS;IAEjB,iCAAiC,iCAAiC;IAGlE,0BAA0B,wBAAwB;IAClD,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IAGrC,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAG/B,WAAW,kBAAkB;IAC7B,YAAY,mBAAmB;IAC/B,WAAW,kBAAkB;IAG7B,2BAA2B,0BAA0B;IACrD,oBAAoB,mBAAmB;IACvC,mBAAmB,kBAAkB;IACrC,4BAA4B,iCAAiC;IAC7D,mBAAmB,kBAAkB;IACrC,wBAAwB,uBAAuB;IAG/C,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,4BAA4B,iCAAiC;IAG7D,0BAA0B,+BAA+B;IACzD,gCAAgC,qCAAqC;IACrE,gCAAgC,qCAAqC;CACxE"}
package/dist/index.cjs CHANGED
@@ -8,23 +8,31 @@ var http = require('@ebec/http');
8
8
  * For the full copyright and license information,
9
9
  * view the LICENSE file that was distributed with this source code.
10
10
  */ var ErrorCode = /*#__PURE__*/ function(ErrorCode) {
11
- ErrorCode["HEADER_INVALID"] = "invalid_header";
12
- ErrorCode["HEADER_AUTH_TYPE_UNSUPPORTED"] = "unsupported_auth_header_type";
13
- ErrorCode["CREDENTIALS_INVALID"] = "invalid_credentials";
14
- ErrorCode["ENTITY_INACTIVE"] = "inactive_entity";
15
- ErrorCode["TOKEN_REDIRECT_URI_MISMATCH"] = "redirect_uri_mismatch";
16
- ErrorCode["TOKEN_INVALID"] = "invalid_token";
17
- ErrorCode["TOKEN_INACTIVE"] = "inactive_token";
18
- ErrorCode["TOKEN_EXPIRED"] = "expired_token";
19
- ErrorCode["TOKEN_CLIENT_INVALID"] = "invalid_client";
20
- ErrorCode["TOKEN_GRANT_INVALID"] = "invalid_grant";
21
- ErrorCode["TOKEN_GRANT_TYPE_UNSUPPORTED"] = "unsupported_token_grant_type";
22
- ErrorCode["TOKEN_SCOPE_INVALID"] = "invalid_scope";
23
- ErrorCode["TOKEN_SCOPE_INSUFFICIENT"] = "insufficient_scope";
24
- ErrorCode["TOKEN_SUB_KIND_INVALID"] = "invalid_token_sub_kind";
11
+ // HTTP Codes
12
+ ErrorCode["HTTP_HEADER_AUTH_TYPE_UNSUPPORTED"] = "unsupported_auth_header_type";
13
+ // Entity Codes
14
+ ErrorCode["ENTITY_CREDENTIALS_INVALID"] = "invalid_credentials";
15
+ ErrorCode["ENTITY_INACTIVE"] = "entity_inactive";
16
+ ErrorCode["ENTITY_NOT_FOUND"] = "entity_not_found";
17
+ // JWK Codes
18
+ ErrorCode["JWK_INVALID"] = "jwk_invalid";
19
+ ErrorCode["JWK_NOT_FOUND"] = "jwk_not_found";
20
+ // JWT Codes
21
+ ErrorCode["JWT_INVALID"] = "invalid_token";
22
+ ErrorCode["JWT_INACTIVE"] = "inactive_token";
23
+ ErrorCode["JWT_EXPIRED"] = "expired_token";
24
+ // Oauth2 Codes
25
+ ErrorCode["OAUTH_REDIRECT_URI_MISMATCH"] = "redirect_uri_mismatch";
26
+ ErrorCode["OAUTH_CLIENT_INVALID"] = "invalid_client";
27
+ ErrorCode["OAUTH_GRANT_INVALID"] = "invalid_grant";
28
+ ErrorCode["OAUTH_GRANT_TYPE_UNSUPPORTED"] = "unsupported_token_grant_type";
29
+ ErrorCode["OAUTH_SCOPE_INVALID"] = "invalid_scope";
30
+ ErrorCode["OAUTH_SCOPE_INSUFFICIENT"] = "insufficient_scope";
31
+ // Permission Codes
25
32
  ErrorCode["PERMISSION_NOT_FOUND"] = "permission_not_found";
26
33
  ErrorCode["PERMISSION_DENIED"] = "permission_denied";
27
34
  ErrorCode["PERMISSION_EVALUATION_FAILED"] = "permission_evaluation_failed";
35
+ // Policy Codes
28
36
  ErrorCode["POLICY_EVALUATOR_NOT_FOUND"] = "policy_evaluator_not_found";
29
37
  ErrorCode["POLICY_EVALUATOR_NOT_PROCESSABLE"] = "policy_evaluator_not_processable";
30
38
  ErrorCode["POLICY_EVALUATOR_CONTEXT_INVALID"] = "policy_evaluator_context_invalid";
@@ -34,21 +42,16 @@ var http = require('@ebec/http');
34
42
  class AuthupError extends http.BadRequestError {
35
43
  }
36
44
 
37
- class HeaderError extends AuthupError {
45
+ class HTTPError extends AuthupError {
38
46
  static unsupportedHeaderType(type) {
39
- return new HeaderError({
40
- code: ErrorCode.HEADER_AUTH_TYPE_UNSUPPORTED,
47
+ return new HTTPError({
48
+ code: ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED,
41
49
  message: `The authorization header type ${type} is not supported.`
42
50
  });
43
51
  }
44
- constructor(...input){
45
- super({
46
- code: ErrorCode.HEADER_INVALID
47
- }, ...input);
48
- }
49
52
  }
50
53
 
51
54
  exports.AuthupError = AuthupError;
52
55
  exports.ErrorCode = ErrorCode;
53
- exports.HeaderError = HeaderError;
56
+ exports.HTTPError = HTTPError;
54
57
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/constants.ts","../src/module.ts","../src/built-in/header.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 HEADER_INVALID = 'invalid_header',\n HEADER_AUTH_TYPE_UNSUPPORTED = 'unsupported_auth_header_type',\n\n CREDENTIALS_INVALID = 'invalid_credentials',\n\n ENTITY_INACTIVE = 'inactive_entity',\n\n TOKEN_REDIRECT_URI_MISMATCH = 'redirect_uri_mismatch',\n TOKEN_INVALID = 'invalid_token',\n TOKEN_INACTIVE = 'inactive_token',\n TOKEN_EXPIRED = 'expired_token',\n TOKEN_CLIENT_INVALID = 'invalid_client',\n TOKEN_GRANT_INVALID = 'invalid_grant',\n TOKEN_GRANT_TYPE_UNSUPPORTED = 'unsupported_token_grant_type',\n TOKEN_SCOPE_INVALID = 'invalid_scope',\n TOKEN_SCOPE_INSUFFICIENT = 'insufficient_scope',\n TOKEN_SUB_KIND_INVALID = 'invalid_token_sub_kind',\n\n PERMISSION_NOT_FOUND = 'permission_not_found',\n PERMISSION_DENIED = 'permission_denied',\n PERMISSION_EVALUATION_FAILED = 'permission_evaluation_failed',\n\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-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\nimport { BadRequestError } from '@ebec/http';\n\nexport class AuthupError extends BadRequestError {\n\n}\n","/*\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\nimport type { AuthorizationHeaderType } from 'hapic';\nimport { ErrorCode } from '../constants';\nimport { AuthupError } from '../module';\nimport type { AuthupErrorOptionsInput } from '../types';\n\nexport class HeaderError extends AuthupError {\n constructor(...input: AuthupErrorOptionsInput[]) {\n super({ code: ErrorCode.HEADER_INVALID }, ...input);\n }\n\n static unsupportedHeaderType(type: `${AuthorizationHeaderType}`) {\n return new HeaderError({\n code: ErrorCode.HEADER_AUTH_TYPE_UNSUPPORTED,\n message: `The authorization header type ${type} is not supported.`,\n });\n }\n}\n"],"names":["ErrorCode","AuthupError","BadRequestError","HeaderError","unsupportedHeaderType","type","code","HEADER_AUTH_TYPE_UNSUPPORTED","message","constructor","input","HEADER_INVALID"],"mappings":";;;;AAAA;;;;;IAOO,IAAKA,SAAAA,iBAAAA,SAAAA,SAAAA,EAAAA;;;;;;;;;;;;;;;;;;;;;AAAAA,IAAAA,OAAAA,SAAAA;AA0BX,CAAA,CAAA,EAAA;;ACxBM,MAAMC,WAAoBC,SAAAA,oBAAAA,CAAAA;AAEjC;;ACCO,MAAMC,WAAoBF,SAAAA,WAAAA,CAAAA;IAK7B,OAAOG,qBAAAA,CAAsBC,IAAkC,EAAE;AAC7D,QAAA,OAAO,IAAIF,WAAY,CAAA;AACnBG,YAAAA,IAAAA,EAAMN,UAAUO,4BAA4B;AAC5CC,YAAAA,OAAAA,EAAS,CAAC,8BAA8B,EAAEH,IAAAA,CAAK,kBAAkB;AACrE,SAAA,CAAA;AACJ;IATAI,WAAY,CAAA,GAAGC,KAAgC,CAAE;AAC7C,QAAA,KAAK,CAAC;AAAEJ,YAAAA,IAAAA,EAAMN,UAAUW;SAAqBD,EAAAA,GAAAA,KAAAA,CAAAA;AACjD;AAQJ;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/constants.ts","../src/module.ts","../src/built-in/http.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 // HTTP Codes\n HTTP_HEADER_AUTH_TYPE_UNSUPPORTED = 'unsupported_auth_header_type',\n\n // Entity Codes\n ENTITY_CREDENTIALS_INVALID = 'invalid_credentials',\n ENTITY_INACTIVE = 'entity_inactive',\n ENTITY_NOT_FOUND = 'entity_not_found',\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_GRANT_INVALID = 'invalid_grant',\n OAUTH_GRANT_TYPE_UNSUPPORTED = 'unsupported_token_grant_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-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\nimport { BadRequestError } from '@ebec/http';\n\nexport class AuthupError extends BadRequestError {\n\n}\n","/*\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\nimport type { AuthorizationHeaderType } from 'hapic';\nimport { ErrorCode } from '../constants';\nimport { AuthupError } from '../module';\n\nexport class HTTPError extends AuthupError {\n static unsupportedHeaderType(type: `${AuthorizationHeaderType}`) {\n return new HTTPError({\n code: ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED,\n message: `The authorization header type ${type} is not supported.`,\n });\n }\n}\n"],"names":["ErrorCode","AuthupError","BadRequestError","HTTPError","unsupportedHeaderType","type","code","HTTP_HEADER_AUTH_TYPE_UNSUPPORTED","message"],"mappings":";;;;AAAA;;;;;IAOO,IAAKA,SAAAA,iBAAAA,SAAAA,SAAAA,EAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,IAAAA,OAAAA,SAAAA;AAmCX,CAAA,CAAA,EAAA;;ACjCM,MAAMC,WAAoBC,SAAAA,oBAAAA,CAAAA;AAEjC;;ACAO,MAAMC,SAAkBF,SAAAA,WAAAA,CAAAA;IAC3B,OAAOG,qBAAAA,CAAsBC,IAAkC,EAAE;AAC7D,QAAA,OAAO,IAAIF,SAAU,CAAA;AACjBG,YAAAA,IAAAA,EAAMN,UAAUO,iCAAiC;AACjDC,YAAAA,OAAAA,EAAS,CAAC,8BAA8B,EAAEH,IAAAA,CAAK,kBAAkB;AACrE,SAAA,CAAA;AACJ;AACJ;;;;;;"}
package/dist/index.mjs CHANGED
@@ -6,23 +6,31 @@ import { BadRequestError } from '@ebec/http';
6
6
  * For the full copyright and license information,
7
7
  * view the LICENSE file that was distributed with this source code.
8
8
  */ var ErrorCode = /*#__PURE__*/ function(ErrorCode) {
9
- ErrorCode["HEADER_INVALID"] = "invalid_header";
10
- ErrorCode["HEADER_AUTH_TYPE_UNSUPPORTED"] = "unsupported_auth_header_type";
11
- ErrorCode["CREDENTIALS_INVALID"] = "invalid_credentials";
12
- ErrorCode["ENTITY_INACTIVE"] = "inactive_entity";
13
- ErrorCode["TOKEN_REDIRECT_URI_MISMATCH"] = "redirect_uri_mismatch";
14
- ErrorCode["TOKEN_INVALID"] = "invalid_token";
15
- ErrorCode["TOKEN_INACTIVE"] = "inactive_token";
16
- ErrorCode["TOKEN_EXPIRED"] = "expired_token";
17
- ErrorCode["TOKEN_CLIENT_INVALID"] = "invalid_client";
18
- ErrorCode["TOKEN_GRANT_INVALID"] = "invalid_grant";
19
- ErrorCode["TOKEN_GRANT_TYPE_UNSUPPORTED"] = "unsupported_token_grant_type";
20
- ErrorCode["TOKEN_SCOPE_INVALID"] = "invalid_scope";
21
- ErrorCode["TOKEN_SCOPE_INSUFFICIENT"] = "insufficient_scope";
22
- ErrorCode["TOKEN_SUB_KIND_INVALID"] = "invalid_token_sub_kind";
9
+ // HTTP Codes
10
+ ErrorCode["HTTP_HEADER_AUTH_TYPE_UNSUPPORTED"] = "unsupported_auth_header_type";
11
+ // Entity Codes
12
+ ErrorCode["ENTITY_CREDENTIALS_INVALID"] = "invalid_credentials";
13
+ ErrorCode["ENTITY_INACTIVE"] = "entity_inactive";
14
+ ErrorCode["ENTITY_NOT_FOUND"] = "entity_not_found";
15
+ // JWK Codes
16
+ ErrorCode["JWK_INVALID"] = "jwk_invalid";
17
+ ErrorCode["JWK_NOT_FOUND"] = "jwk_not_found";
18
+ // JWT Codes
19
+ ErrorCode["JWT_INVALID"] = "invalid_token";
20
+ ErrorCode["JWT_INACTIVE"] = "inactive_token";
21
+ ErrorCode["JWT_EXPIRED"] = "expired_token";
22
+ // Oauth2 Codes
23
+ ErrorCode["OAUTH_REDIRECT_URI_MISMATCH"] = "redirect_uri_mismatch";
24
+ ErrorCode["OAUTH_CLIENT_INVALID"] = "invalid_client";
25
+ ErrorCode["OAUTH_GRANT_INVALID"] = "invalid_grant";
26
+ ErrorCode["OAUTH_GRANT_TYPE_UNSUPPORTED"] = "unsupported_token_grant_type";
27
+ ErrorCode["OAUTH_SCOPE_INVALID"] = "invalid_scope";
28
+ ErrorCode["OAUTH_SCOPE_INSUFFICIENT"] = "insufficient_scope";
29
+ // Permission Codes
23
30
  ErrorCode["PERMISSION_NOT_FOUND"] = "permission_not_found";
24
31
  ErrorCode["PERMISSION_DENIED"] = "permission_denied";
25
32
  ErrorCode["PERMISSION_EVALUATION_FAILED"] = "permission_evaluation_failed";
33
+ // Policy Codes
26
34
  ErrorCode["POLICY_EVALUATOR_NOT_FOUND"] = "policy_evaluator_not_found";
27
35
  ErrorCode["POLICY_EVALUATOR_NOT_PROCESSABLE"] = "policy_evaluator_not_processable";
28
36
  ErrorCode["POLICY_EVALUATOR_CONTEXT_INVALID"] = "policy_evaluator_context_invalid";
@@ -32,19 +40,14 @@ import { BadRequestError } from '@ebec/http';
32
40
  class AuthupError extends BadRequestError {
33
41
  }
34
42
 
35
- class HeaderError extends AuthupError {
43
+ class HTTPError extends AuthupError {
36
44
  static unsupportedHeaderType(type) {
37
- return new HeaderError({
38
- code: ErrorCode.HEADER_AUTH_TYPE_UNSUPPORTED,
45
+ return new HTTPError({
46
+ code: ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED,
39
47
  message: `The authorization header type ${type} is not supported.`
40
48
  });
41
49
  }
42
- constructor(...input){
43
- super({
44
- code: ErrorCode.HEADER_INVALID
45
- }, ...input);
46
- }
47
50
  }
48
51
 
49
- export { AuthupError, ErrorCode, HeaderError };
52
+ export { AuthupError, ErrorCode, HTTPError };
50
53
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/constants.ts","../src/module.ts","../src/built-in/header.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 HEADER_INVALID = 'invalid_header',\n HEADER_AUTH_TYPE_UNSUPPORTED = 'unsupported_auth_header_type',\n\n CREDENTIALS_INVALID = 'invalid_credentials',\n\n ENTITY_INACTIVE = 'inactive_entity',\n\n TOKEN_REDIRECT_URI_MISMATCH = 'redirect_uri_mismatch',\n TOKEN_INVALID = 'invalid_token',\n TOKEN_INACTIVE = 'inactive_token',\n TOKEN_EXPIRED = 'expired_token',\n TOKEN_CLIENT_INVALID = 'invalid_client',\n TOKEN_GRANT_INVALID = 'invalid_grant',\n TOKEN_GRANT_TYPE_UNSUPPORTED = 'unsupported_token_grant_type',\n TOKEN_SCOPE_INVALID = 'invalid_scope',\n TOKEN_SCOPE_INSUFFICIENT = 'insufficient_scope',\n TOKEN_SUB_KIND_INVALID = 'invalid_token_sub_kind',\n\n PERMISSION_NOT_FOUND = 'permission_not_found',\n PERMISSION_DENIED = 'permission_denied',\n PERMISSION_EVALUATION_FAILED = 'permission_evaluation_failed',\n\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-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\nimport { BadRequestError } from '@ebec/http';\n\nexport class AuthupError extends BadRequestError {\n\n}\n","/*\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\nimport type { AuthorizationHeaderType } from 'hapic';\nimport { ErrorCode } from '../constants';\nimport { AuthupError } from '../module';\nimport type { AuthupErrorOptionsInput } from '../types';\n\nexport class HeaderError extends AuthupError {\n constructor(...input: AuthupErrorOptionsInput[]) {\n super({ code: ErrorCode.HEADER_INVALID }, ...input);\n }\n\n static unsupportedHeaderType(type: `${AuthorizationHeaderType}`) {\n return new HeaderError({\n code: ErrorCode.HEADER_AUTH_TYPE_UNSUPPORTED,\n message: `The authorization header type ${type} is not supported.`,\n });\n }\n}\n"],"names":["ErrorCode","AuthupError","BadRequestError","HeaderError","unsupportedHeaderType","type","code","HEADER_AUTH_TYPE_UNSUPPORTED","message","constructor","input","HEADER_INVALID"],"mappings":";;AAAA;;;;;IAOO,IAAKA,SAAAA,iBAAAA,SAAAA,SAAAA,EAAAA;;;;;;;;;;;;;;;;;;;;;AAAAA,IAAAA,OAAAA,SAAAA;AA0BX,CAAA,CAAA,EAAA;;ACxBM,MAAMC,WAAoBC,SAAAA,eAAAA,CAAAA;AAEjC;;ACCO,MAAMC,WAAoBF,SAAAA,WAAAA,CAAAA;IAK7B,OAAOG,qBAAAA,CAAsBC,IAAkC,EAAE;AAC7D,QAAA,OAAO,IAAIF,WAAY,CAAA;AACnBG,YAAAA,IAAAA,EAAMN,UAAUO,4BAA4B;AAC5CC,YAAAA,OAAAA,EAAS,CAAC,8BAA8B,EAAEH,IAAAA,CAAK,kBAAkB;AACrE,SAAA,CAAA;AACJ;IATAI,WAAY,CAAA,GAAGC,KAAgC,CAAE;AAC7C,QAAA,KAAK,CAAC;AAAEJ,YAAAA,IAAAA,EAAMN,UAAUW;SAAqBD,EAAAA,GAAAA,KAAAA,CAAAA;AACjD;AAQJ;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/constants.ts","../src/module.ts","../src/built-in/http.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 // HTTP Codes\n HTTP_HEADER_AUTH_TYPE_UNSUPPORTED = 'unsupported_auth_header_type',\n\n // Entity Codes\n ENTITY_CREDENTIALS_INVALID = 'invalid_credentials',\n ENTITY_INACTIVE = 'entity_inactive',\n ENTITY_NOT_FOUND = 'entity_not_found',\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_GRANT_INVALID = 'invalid_grant',\n OAUTH_GRANT_TYPE_UNSUPPORTED = 'unsupported_token_grant_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-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\nimport { BadRequestError } from '@ebec/http';\n\nexport class AuthupError extends BadRequestError {\n\n}\n","/*\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\nimport type { AuthorizationHeaderType } from 'hapic';\nimport { ErrorCode } from '../constants';\nimport { AuthupError } from '../module';\n\nexport class HTTPError extends AuthupError {\n static unsupportedHeaderType(type: `${AuthorizationHeaderType}`) {\n return new HTTPError({\n code: ErrorCode.HTTP_HEADER_AUTH_TYPE_UNSUPPORTED,\n message: `The authorization header type ${type} is not supported.`,\n });\n }\n}\n"],"names":["ErrorCode","AuthupError","BadRequestError","HTTPError","unsupportedHeaderType","type","code","HTTP_HEADER_AUTH_TYPE_UNSUPPORTED","message"],"mappings":";;AAAA;;;;;IAOO,IAAKA,SAAAA,iBAAAA,SAAAA,SAAAA,EAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,IAAAA,OAAAA,SAAAA;AAmCX,CAAA,CAAA,EAAA;;ACjCM,MAAMC,WAAoBC,SAAAA,eAAAA,CAAAA;AAEjC;;ACAO,MAAMC,SAAkBF,SAAAA,WAAAA,CAAAA;IAC3B,OAAOG,qBAAAA,CAAsBC,IAAkC,EAAE;AAC7D,QAAA,OAAO,IAAIF,SAAU,CAAA;AACjBG,YAAAA,IAAAA,EAAMN,UAAUO,iCAAiC;AACjDC,YAAAA,OAAAA,EAAS,CAAC,8BAA8B,EAAEH,IAAAA,CAAK,kBAAkB;AACrE,SAAA,CAAA;AACJ;AACJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authup/errors",
3
- "version": "1.0.0-beta.24",
3
+ "version": "1.0.0-beta.25",
4
4
  "description": "Package containing error codes and basic error classes.",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
@@ -1,8 +0,0 @@
1
- import type { AuthorizationHeaderType } from 'hapic';
2
- import { AuthupError } from '../module';
3
- import type { AuthupErrorOptionsInput } from '../types';
4
- export declare class HeaderError extends AuthupError {
5
- constructor(...input: AuthupErrorOptionsInput[]);
6
- static unsupportedHeaderType(type: `${AuthorizationHeaderType}`): HeaderError;
7
- }
8
- //# sourceMappingURL=header.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/built-in/header.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,qBAAa,WAAY,SAAQ,WAAW;gBAC5B,GAAG,KAAK,EAAE,uBAAuB,EAAE;IAI/C,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,GAAG,uBAAuB,EAAE;CAMlE"}