@udibo/oauth2 0.14.1 → 0.15.1
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/README.md +45 -24
- package/{esm → dist}/adapters/hono/_common.d.ts +5 -5
- package/{esm → dist}/adapters/hono/_common.js +1 -1
- package/{esm → dist}/adapters/hono/authorization-server.d.ts +6 -7
- package/{esm → dist}/adapters/hono/authorization-server.js +0 -1
- package/{esm → dist}/adapters/hono/bff/auth-request-store.d.ts +2 -2
- package/{esm → dist}/adapters/hono/bff/auth-request-store.js +2 -2
- package/{esm → dist}/adapters/hono/bff/bff.d.ts +8 -8
- package/{esm → dist}/adapters/hono/bff/bff.js +33 -27
- package/{esm → dist}/adapters/hono/bff/cookie-prefix.js +1 -2
- package/{esm → dist}/adapters/hono/bff/mod.d.ts +5 -6
- package/{esm → dist}/adapters/hono/bff/mod.js +1 -2
- package/{esm → dist}/adapters/hono/bff/proxy.js +2 -1
- package/{esm → dist}/adapters/hono/bff/session-store.d.ts +2 -2
- package/{esm → dist}/adapters/hono/bff/session-store.js +7 -6
- package/{esm → dist}/adapters/hono/bff/testing.d.ts +7 -8
- package/{esm → dist}/adapters/hono/bff/testing.js +19 -22
- package/{esm → dist}/adapters/hono/identity.d.ts +1 -2
- package/{esm → dist}/adapters/hono/identity.js +10 -10
- package/{esm → dist}/adapters/hono/log.d.ts +0 -1
- package/{esm → dist}/adapters/hono/log.js +0 -6
- package/{esm → dist}/adapters/hono/resource-server.d.ts +5 -6
- package/{esm → dist}/adapters/hono/resource-server.js +0 -1
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +3 -0
- package/dist/cli/idp/config.d.ts +110 -0
- package/dist/cli/idp/config.js +269 -0
- package/dist/cli/idp/mod.d.ts +20 -0
- package/dist/cli/idp/mod.js +175 -0
- package/dist/cli/idp/pages.d.ts +56 -0
- package/dist/cli/idp/pages.js +190 -0
- package/dist/cli/idp/server.d.ts +93 -0
- package/dist/cli/idp/server.js +559 -0
- package/dist/cli/keygen.d.ts +13 -0
- package/dist/cli/keygen.js +30 -0
- package/dist/cli/mod.d.ts +34 -0
- package/dist/cli/mod.js +94 -0
- package/{esm → dist}/client/_http.d.ts +1 -1
- package/{esm → dist}/client/base.d.ts +1 -1
- package/{esm → dist}/client/bff-client.d.ts +1 -1
- package/{esm → dist}/client/bff-client.js +7 -6
- package/{esm → dist}/client/browser-storage.d.ts +1 -1
- package/{esm → dist}/client/check.js +1 -1
- package/{esm → dist}/client/direct-client.d.ts +6 -6
- package/{esm → dist}/client/direct-client.js +11 -13
- package/{esm → dist}/client/discovery-cache.d.ts +1 -1
- package/{esm → dist}/client/discovery-cache.js +2 -2
- package/{esm → dist}/client/events.d.ts +1 -1
- package/{esm → dist}/client/mod.d.ts +11 -12
- package/{esm → dist}/client/mod.js +1 -1
- package/{esm → dist}/errors.d.ts +1 -1
- package/{esm → dist}/errors.js +1 -1
- package/{esm → dist}/identity/events.d.ts +1 -1
- package/{esm → dist}/identity/external/_shared.d.ts +1 -1
- package/{esm → dist}/identity/external/_shared.js +1 -2
- package/{esm → dist}/identity/external/apple-client-secret.d.ts +1 -1
- package/{esm → dist}/identity/external/apple-client-secret.js +6 -7
- package/{esm → dist}/identity/external/apple.d.ts +5 -5
- package/{esm → dist}/identity/external/apple.js +10 -11
- package/{esm → dist}/identity/external/discord.d.ts +3 -3
- package/{esm → dist}/identity/external/discord.js +2 -2
- package/{esm → dist}/identity/external/flow.d.ts +1 -1
- package/{esm → dist}/identity/external/flow.js +2 -2
- package/{esm → dist}/identity/external/github.d.ts +3 -3
- package/{esm → dist}/identity/external/github.js +12 -17
- package/{esm → dist}/identity/external/google.d.ts +5 -5
- package/{esm → dist}/identity/external/google.js +2 -2
- package/{esm → dist}/identity/external/mod.d.ts +12 -13
- package/{esm → dist}/identity/external/mod.js +0 -1
- package/{esm → dist}/identity/external/oauth2.d.ts +1 -1
- package/{esm → dist}/identity/external/oauth2.js +8 -8
- package/{esm → dist}/identity/external/oidc.d.ts +4 -4
- package/{esm → dist}/identity/external/oidc.js +9 -8
- package/{esm → dist}/identity/hibp.d.ts +1 -1
- package/{esm → dist}/identity/hibp.js +1 -1
- package/{esm → dist}/identity/lockout.js +1 -2
- package/{esm → dist}/identity/mfa/mod.d.ts +4 -5
- package/{esm → dist}/identity/mfa/mod.js +1 -2
- package/{esm → dist}/identity/mfa/service.d.ts +3 -3
- package/{esm → dist}/identity/mfa/service.js +4 -3
- package/{esm → dist}/identity/mfa/totp.d.ts +1 -1
- package/{esm → dist}/identity/mfa/totp.js +2 -2
- package/{esm → dist}/identity/migration.d.ts +2 -3
- package/{esm → dist}/identity/migration.js +3 -4
- package/{esm → dist}/identity/mod.d.ts +14 -15
- package/{esm → dist}/identity/mod.js +0 -1
- package/{esm → dist}/identity/otp.d.ts +1 -1
- package/{esm → dist}/identity/otp.js +4 -2
- package/{esm → dist}/identity/password.js +8 -5
- package/{esm → dist}/identity/rate-limit.d.ts +1 -1
- package/{esm → dist}/identity/service.d.ts +10 -10
- package/{esm → dist}/identity/service.js +17 -18
- package/{esm → dist}/identity/session.js +2 -2
- package/{esm → dist}/identity/token-flow.js +3 -2
- package/{esm → dist}/models/authorization-code.d.ts +3 -3
- package/{esm → dist}/models/authorization.d.ts +1 -1
- package/{esm → dist}/models/authorization.js +1 -2
- package/{esm → dist}/models/device-authorization.d.ts +2 -2
- package/{esm → dist}/models/token.d.ts +3 -3
- package/{esm → dist}/react/callback.d.ts +1 -1
- package/{esm → dist}/react/callback.js +0 -1
- package/{esm → dist}/react/components/class-names.d.ts +1 -1
- package/{esm → dist}/react/components/class-names.js +3 -2
- package/{esm → dist}/react/components/internal.d.ts +2 -2
- package/{esm → dist}/react/components/internal.js +5 -11
- package/{esm → dist}/react/components/mfa-challenge-form.d.ts +2 -2
- package/{esm → dist}/react/components/mfa-challenge-form.js +4 -6
- package/{esm → dist}/react/components/mfa-enrollment-form.d.ts +2 -2
- package/{esm → dist}/react/components/mfa-enrollment-form.js +2 -6
- package/{esm → dist}/react/components/mod.d.ts +20 -21
- package/{esm → dist}/react/components/mod.js +1 -2
- package/{esm → dist}/react/components/request-password-reset-form.d.ts +2 -2
- package/{esm → dist}/react/components/request-password-reset-form.js +1 -3
- package/{esm → dist}/react/components/reset-password-form.d.ts +2 -2
- package/{esm → dist}/react/components/reset-password-form.js +2 -2
- package/{esm → dist}/react/components/sign-in-form.d.ts +2 -2
- package/{esm → dist}/react/components/sign-in-form.js +1 -5
- package/{esm → dist}/react/components/sign-up-form.d.ts +2 -2
- package/{esm → dist}/react/components/sign-up-form.js +4 -10
- package/{esm → dist}/react/components/types.d.ts +2 -2
- package/{esm → dist}/react/components/use-auth-form.d.ts +3 -3
- package/{esm → dist}/react/components/use-auth-form.js +4 -7
- package/{esm → dist}/react/components/user-menu.d.ts +2 -2
- package/{esm → dist}/react/components/user-menu.js +9 -14
- package/{esm → dist}/react/context.d.ts +1 -1
- package/{esm → dist}/react/mod.d.ts +6 -7
- package/{esm → dist}/react/mod.js +0 -1
- package/{esm → dist}/react/provider.d.ts +2 -2
- package/{esm → dist}/react/require-auth.js +1 -3
- package/{esm → dist}/react/testing.d.ts +2 -3
- package/{esm → dist}/react/testing.js +1 -2
- package/{esm → dist}/react/use-authorization.d.ts +1 -1
- package/{esm → dist}/react/use-oauth2.d.ts +8 -1
- package/{esm → dist}/react/use-oauth2.js +0 -1
- package/{esm → dist}/server/_clock-skew.js +2 -1
- package/{esm → dist}/server/authorization-server.d.ts +40 -41
- package/{esm → dist}/server/authorization-server.js +32 -42
- package/{esm → dist}/server/client-authentication.d.ts +2 -2
- package/{esm → dist}/server/grants/authorization-code.d.ts +9 -9
- package/{esm → dist}/server/grants/authorization-code.js +5 -6
- package/{esm → dist}/server/grants/client-credentials.d.ts +4 -4
- package/{esm → dist}/server/grants/device-authorization.d.ts +6 -6
- package/{esm → dist}/server/grants/device-authorization.js +4 -4
- package/{esm → dist}/server/grants/grant.d.ts +7 -7
- package/{esm → dist}/server/grants/grant.js +7 -7
- package/{esm → dist}/server/grants/password.d.ts +5 -5
- package/{esm → dist}/server/grants/refresh-token.d.ts +4 -4
- package/{esm → dist}/server/grants/refresh-token.js +5 -6
- package/{esm → dist}/server/introspection-token-reader.d.ts +5 -5
- package/{esm → dist}/server/introspection-token-reader.js +4 -4
- package/{esm → dist}/server/jwks-token-reader.d.ts +5 -5
- package/{esm → dist}/server/jwks-token-reader.js +4 -4
- package/{esm → dist}/server/mod.d.ts +12 -13
- package/{esm → dist}/server/mod.js +0 -1
- package/{esm → dist}/server/public-suffix/mod.d.ts +2 -3
- package/{esm → dist}/server/public-suffix/mod.js +1 -2
- package/{esm → dist}/server/public-suffix/rules.d.ts +1 -1
- package/{esm → dist}/server/public-suffix/rules.js +1 -1
- package/{esm → dist}/server/redirect-uri.js +5 -4
- package/{esm → dist}/server/resource-server.d.ts +11 -12
- package/{esm → dist}/server/resource-server.js +12 -14
- package/{esm → dist}/server/services/authorization-code.d.ts +5 -5
- package/{esm → dist}/server/services/client.d.ts +1 -1
- package/{esm → dist}/server/services/device-authorization.d.ts +3 -3
- package/{esm → dist}/server/services/token.d.ts +6 -6
- package/{esm → dist}/server/services/token.js +3 -1
- package/{esm → dist}/server/services/user.d.ts +1 -1
- package/{esm → dist}/server/signing-keys.d.ts +1 -1
- package/{esm → dist}/server/signing-keys.js +8 -2
- package/{esm → dist}/server/utils/hash.js +1 -1
- package/{esm → dist}/testing/contract/auth-request-storage.d.ts +1 -1
- package/{esm → dist}/testing/contract/auth-request-storage.js +24 -29
- package/{esm → dist}/testing/contract/authorization-code.d.ts +6 -6
- package/{esm → dist}/testing/contract/authorization-code.js +16 -17
- package/{esm → dist}/testing/contract/client.d.ts +4 -4
- package/{esm → dist}/testing/contract/client.js +14 -15
- package/{esm → dist}/testing/contract/device-authorization.d.ts +6 -6
- package/{esm → dist}/testing/contract/device-authorization.js +37 -39
- package/{esm → dist}/testing/contract/identity-session.d.ts +6 -1
- package/{esm → dist}/testing/contract/identity-session.js +44 -36
- package/{esm → dist}/testing/contract/identity-user-store.d.ts +8 -2
- package/{esm → dist}/testing/contract/identity-user-store.js +48 -46
- package/{esm → dist}/testing/contract/lockout-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/lockout-store.js +23 -24
- package/{esm → dist}/testing/contract/mfa-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/mfa-store.js +53 -54
- package/{esm → dist}/testing/contract/mod.d.ts +15 -16
- package/{esm → dist}/testing/contract/mod.js +0 -1
- package/{esm → dist}/testing/contract/otp-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/otp-store.js +33 -34
- package/{esm → dist}/testing/contract/rate-limit-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/rate-limit-store.js +15 -16
- package/{esm → dist}/testing/contract/tenant.js +361 -330
- package/{esm → dist}/testing/contract/token-flow-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/token-flow-store.js +27 -32
- package/{esm → dist}/testing/contract/token-reader.d.ts +3 -3
- package/{esm → dist}/testing/contract/token-reader.js +6 -7
- package/{esm → dist}/testing/contract/token.d.ts +7 -7
- package/{esm → dist}/testing/contract/token.js +48 -53
- package/{esm → dist}/testing/contract/user.d.ts +2 -2
- package/{esm → dist}/testing/contract/user.js +8 -9
- package/{esm → dist}/testing/mod.d.ts +5 -6
- package/{esm → dist}/testing/mod.js +2 -3
- package/{esm → dist}/testing/server.d.ts +7 -6
- package/{esm → dist}/testing/server.js +2 -1
- package/{esm → dist}/testing/services.d.ts +11 -11
- package/{esm → dist}/testing/services.js +8 -8
- package/{esm → dist}/testing/tenant.d.ts +11 -7
- package/{esm → dist}/testing/tenant.js +109 -94
- package/dist/utils/_constant-time.d.ts +12 -0
- package/dist/utils/_constant-time.js +19 -0
- package/{esm → dist}/utils/_default-fetch.js +4 -1
- package/dist/utils/_delay.d.ts +13 -0
- package/dist/utils/_delay.js +28 -0
- package/dist/utils/_encoding.d.ts +39 -0
- package/dist/utils/_encoding.js +126 -0
- package/dist/utils/_inbound-request.d.ts +15 -0
- package/dist/utils/_inbound-request.js +25 -0
- package/{esm → dist}/utils/authentication-context.d.ts +1 -1
- package/{esm → dist}/utils/crypto.d.ts +2 -3
- package/{esm → dist}/utils/crypto.js +3 -4
- package/{esm → dist}/utils/pkce.js +1 -1
- package/{esm → dist}/utils/text.js +1 -1
- package/{esm → dist}/utils/url.d.ts +0 -1
- package/{esm → dist}/utils/url.js +0 -1
- package/package.json +156 -33
- package/esm/_dnt.polyfills.d.ts +0 -31
- package/esm/_dnt.polyfills.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +0 -47
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +0 -65
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +0 -16
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +0 -25
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +0 -30
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +0 -193
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +0 -36
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +0 -61
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +0 -27
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +0 -52
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +0 -43
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +0 -45
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +0 -39
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +0 -32
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +0 -177
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +0 -41
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +0 -58
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +0 -44
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +0 -44
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +0 -20
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.d.ts +0 -44
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.js +0 -84
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +0 -39
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +0 -61
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.d.ts +0 -22
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.js +0 -51
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.d.ts +0 -34
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.js +0 -192
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.d.ts +0 -34
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.js +0 -113
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.d.ts +0 -3
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.js +0 -13
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.d.ts +0 -8
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.js +0 -2
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.d.ts +0 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.js +0 -26
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.d.ts +0 -60
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.js +0 -152
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.js +0 -87
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.js +0 -131
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.js +0 -82
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.js +0 -72
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.d.ts +0 -38
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.js +0 -87
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.d.ts +0 -97
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.js +0 -99
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.d.ts +0 -119
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.js +0 -209
- package/esm/deps/jsr.io/@std/http/1.1.3/status.d.ts +0 -343
- package/esm/deps/jsr.io/@std/http/1.1.3/status.js +0 -343
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.d.ts +0 -159
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.js +0 -223
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.d.ts +0 -79
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.js +0 -116
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.d.ts +0 -139
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.js +0 -277
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.d.ts +0 -98
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.js +0 -181
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.d.ts +0 -29
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.js +0 -68
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.d.ts +0 -158
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.js +0 -206
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.d.ts +0 -24
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.js +0 -3
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.d.ts +0 -91
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.js +0 -347
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.d.ts +0 -382
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.js +0 -1110
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.d.ts +0 -363
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.js +0 -616
- package/esm/package.json +0 -3
- /package/{esm → dist}/adapters/hono/bff/cookie-prefix.d.ts +0 -0
- /package/{esm → dist}/adapters/hono/bff/proxy.d.ts +0 -0
- /package/{esm → dist}/client/_http.js +0 -0
- /package/{esm → dist}/client/base.js +0 -0
- /package/{esm → dist}/client/browser-storage.js +0 -0
- /package/{esm → dist}/client/check.d.ts +0 -0
- /package/{esm → dist}/client/events.js +0 -0
- /package/{esm → dist}/client/storage.d.ts +0 -0
- /package/{esm → dist}/client/storage.js +0 -0
- /package/{esm → dist}/identity/captcha.d.ts +0 -0
- /package/{esm → dist}/identity/captcha.js +0 -0
- /package/{esm → dist}/identity/delivery.d.ts +0 -0
- /package/{esm → dist}/identity/delivery.js +0 -0
- /package/{esm → dist}/identity/errors.d.ts +0 -0
- /package/{esm → dist}/identity/errors.js +0 -0
- /package/{esm → dist}/identity/events.js +0 -0
- /package/{esm → dist}/identity/external/_token-exchange.d.ts +0 -0
- /package/{esm → dist}/identity/external/_token-exchange.js +0 -0
- /package/{esm → dist}/identity/external/errors.d.ts +0 -0
- /package/{esm → dist}/identity/external/errors.js +0 -0
- /package/{esm → dist}/identity/external/provider.d.ts +0 -0
- /package/{esm → dist}/identity/external/provider.js +0 -0
- /package/{esm → dist}/identity/identifier.d.ts +0 -0
- /package/{esm → dist}/identity/identifier.js +0 -0
- /package/{esm → dist}/identity/lockout.d.ts +0 -0
- /package/{esm → dist}/identity/mfa/recovery-codes.d.ts +0 -0
- /package/{esm → dist}/identity/mfa/recovery-codes.js +0 -0
- /package/{esm → dist}/identity/password-policy.d.ts +0 -0
- /package/{esm → dist}/identity/password-policy.js +0 -0
- /package/{esm → dist}/identity/password.d.ts +0 -0
- /package/{esm → dist}/identity/rate-limit.js +0 -0
- /package/{esm → dist}/identity/session.d.ts +0 -0
- /package/{esm → dist}/identity/token-flow.d.ts +0 -0
- /package/{esm → dist}/models/authentication.d.ts +0 -0
- /package/{esm → dist}/models/authentication.js +0 -0
- /package/{esm → dist}/models/authorization-code.js +0 -0
- /package/{esm → dist}/models/client.d.ts +0 -0
- /package/{esm → dist}/models/client.js +0 -0
- /package/{esm → dist}/models/device-authorization.js +0 -0
- /package/{esm → dist}/models/responses.d.ts +0 -0
- /package/{esm → dist}/models/responses.js +0 -0
- /package/{esm → dist}/models/scope.d.ts +0 -0
- /package/{esm → dist}/models/scope.js +0 -0
- /package/{esm → dist}/models/token.js +0 -0
- /package/{esm → dist}/react/components/types.js +0 -0
- /package/{esm → dist}/react/context.js +0 -0
- /package/{esm → dist}/react/provider.js +0 -0
- /package/{esm → dist}/react/require-auth.d.ts +0 -0
- /package/{esm → dist}/react/use-authorization.js +0 -0
- /package/{esm → dist}/server/_clock-skew.d.ts +0 -0
- /package/{esm → dist}/server/client-authentication.js +0 -0
- /package/{esm → dist}/server/grants/client-credentials.js +0 -0
- /package/{esm → dist}/server/grants/password.js +0 -0
- /package/{esm → dist}/server/redirect-uri.d.ts +0 -0
- /package/{esm → dist}/server/services/authorization-code.js +0 -0
- /package/{esm → dist}/server/services/client.js +0 -0
- /package/{esm → dist}/server/services/device-authorization.js +0 -0
- /package/{esm → dist}/server/services/user.js +0 -0
- /package/{esm → dist}/server/utils/hash.d.ts +0 -0
- /package/{esm → dist}/testing/contract/_race.d.ts +0 -0
- /package/{esm → dist}/testing/contract/_race.js +0 -0
- /package/{esm → dist}/testing/contract/tenant.d.ts +0 -0
- /package/{esm → dist}/utils/_body.d.ts +0 -0
- /package/{esm → dist}/utils/_body.js +0 -0
- /package/{esm → dist}/utils/_buffer.d.ts +0 -0
- /package/{esm → dist}/utils/_buffer.js +0 -0
- /package/{esm → dist}/utils/_default-fetch.d.ts +0 -0
- /package/{esm → dist}/utils/_timing-safe.d.ts +0 -0
- /package/{esm → dist}/utils/_timing-safe.js +0 -0
- /package/{esm → dist}/utils/authentication-context.js +0 -0
- /package/{esm → dist}/utils/basic-auth.d.ts +0 -0
- /package/{esm → dist}/utils/basic-auth.js +0 -0
- /package/{esm → dist}/utils/pkce.d.ts +0 -0
- /package/{esm → dist}/utils/text.d.ts +0 -0
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
/** Options for initializing an HttpError. */
|
|
2
|
-
export interface HttpErrorOptions<Extensions extends object = Record<string, unknown>> extends ErrorOptions {
|
|
3
|
-
/** The name of the error. The default value is based on error status. This will be the default value for the `title` property in the response body. */
|
|
4
|
-
name?: string;
|
|
5
|
-
/** The message of the error. This will be the default value for the `detail` property in the response body. */
|
|
6
|
-
message?: string;
|
|
7
|
-
/** The HTTP status associated with the error. Defaults to 500. */
|
|
8
|
-
status?: number;
|
|
9
|
-
/** The HTTP status text associated with the error. */
|
|
10
|
-
statusText?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Determines if the error detail should be exposed in the response.
|
|
13
|
-
* Defaults to true for client error statuses and false for server error statuses.
|
|
14
|
-
*/
|
|
15
|
-
expose?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* The cause of the error. This is never exposed in the response.
|
|
18
|
-
*/
|
|
19
|
-
cause?: unknown;
|
|
20
|
-
/**
|
|
21
|
-
* The type of the error is a URI reference that identifies the problem type.
|
|
22
|
-
*/
|
|
23
|
-
type?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The instance of the error is a URI reference that identifies the specific occurrence of the problem.
|
|
26
|
-
*/
|
|
27
|
-
instance?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Additional data to send in the response.
|
|
30
|
-
*/
|
|
31
|
-
extensions?: Extensions;
|
|
32
|
-
/**
|
|
33
|
-
* The headers to send in the response. The content-type will default to application/problem+json unless otherwise specified in the headers.
|
|
34
|
-
*/
|
|
35
|
-
headers?: Headers | Record<string, string>;
|
|
36
|
-
/**
|
|
37
|
-
* The message to expose in the response. This is used in toJSON() as the `detail` field.
|
|
38
|
-
* If not provided:
|
|
39
|
-
* - When expose is true and message exists, exposedMessage defaults to message
|
|
40
|
-
* - Otherwise, exposedMessage defaults to a generic message for the status code
|
|
41
|
-
* This allows you to have detailed internal error messages while showing safe, user-friendly messages to clients.
|
|
42
|
-
*/
|
|
43
|
-
exposedMessage?: string;
|
|
44
|
-
}
|
|
45
|
-
interface ProblemDetailsBase {
|
|
46
|
-
type?: string;
|
|
47
|
-
status?: number;
|
|
48
|
-
title?: string;
|
|
49
|
-
detail?: string;
|
|
50
|
-
instance?: string;
|
|
51
|
-
}
|
|
52
|
-
export type ProblemDetails<Extensions extends object = Record<string, unknown>> = ProblemDetailsBase & Extensions;
|
|
53
|
-
/**
|
|
54
|
-
* An error for an HTTP request.
|
|
55
|
-
*
|
|
56
|
-
* This class can be used on its own to create any HttpError. It has a few
|
|
57
|
-
* different call signatures you can use. The 4 examples below would throw the same
|
|
58
|
-
* error.
|
|
59
|
-
*
|
|
60
|
-
* ```ts
|
|
61
|
-
* import { HttpError } from "@udibo/http-error";
|
|
62
|
-
*
|
|
63
|
-
* throw new HttpError(404, "file not found");
|
|
64
|
-
* throw new HttpError(404, { message: "file not found" });
|
|
65
|
-
* throw new HttpError("file not found", { status: 404 });
|
|
66
|
-
* throw new HttpError({ status: 404, message: "file not found" });
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* You can also include a cause in the optional options argument for it like you
|
|
70
|
-
* can with regular errors.
|
|
71
|
-
*
|
|
72
|
-
* ```ts
|
|
73
|
-
* import { HttpError } from "@udibo/http-error";
|
|
74
|
-
*
|
|
75
|
-
* throw new HttpError(404, "file not found", { cause: error });
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* All HttpError objects have a status associated with them. If a status is not
|
|
79
|
-
* provided it will default to 500. The expose property will default to true for
|
|
80
|
-
* client error status and false for server error status. You can override the
|
|
81
|
-
* default behavior by setting the expose property on the options argument.
|
|
82
|
-
*
|
|
83
|
-
* For all known HTTP error status codes, a name will be generated for them. For
|
|
84
|
-
* example, the name of an HttpError with the 404 status would be NotFoundError. If
|
|
85
|
-
* the name is not known for an HTTP error status code, it will default to
|
|
86
|
-
* UnknownClientError or UnknownServerError.
|
|
87
|
-
*
|
|
88
|
-
* ```ts
|
|
89
|
-
* import { HttpError } from "@udibo/http-error";
|
|
90
|
-
*
|
|
91
|
-
* const error = new HttpError(404, "file not found");
|
|
92
|
-
* console.log(error.toString()); // NotFoundError: file not found
|
|
93
|
-
* ```
|
|
94
|
-
*
|
|
95
|
-
* If you would like to extend the HttpError class, you can pass your own error
|
|
96
|
-
* name in the options.
|
|
97
|
-
*
|
|
98
|
-
* ```ts
|
|
99
|
-
* import { HttpError, type HttpErrorOptions } from "@udibo/http-error";
|
|
100
|
-
*
|
|
101
|
-
* class CustomError extends HttpError {
|
|
102
|
-
* constructor(
|
|
103
|
-
* message?: string,
|
|
104
|
-
* options?: HttpErrorOptions,
|
|
105
|
-
* ) {
|
|
106
|
-
* super(message, { name: "CustomError", status: 420, ...options });
|
|
107
|
-
* }
|
|
108
|
-
* }
|
|
109
|
-
* ```
|
|
110
|
-
*
|
|
111
|
-
* If you'd like the arguments to match the parent HttpError classes call
|
|
112
|
-
* signature, you can make use of the optionsFromArgs function. It will prioritize
|
|
113
|
-
* the status / message arguments over status / message options.
|
|
114
|
-
*
|
|
115
|
-
* ```ts
|
|
116
|
-
* import {
|
|
117
|
-
* HttpError,
|
|
118
|
-
* type HttpErrorOptions,
|
|
119
|
-
* optionsFromArgs,
|
|
120
|
-
* } from "@udibo/http-error";
|
|
121
|
-
*
|
|
122
|
-
* class CustomError extends HttpError {
|
|
123
|
-
* constructor(
|
|
124
|
-
* status?: number,
|
|
125
|
-
* message?: string,
|
|
126
|
-
* options?: HttpErrorOptions,
|
|
127
|
-
* );
|
|
128
|
-
* constructor(status?: number, options?: HttpErrorOptions);
|
|
129
|
-
* constructor(message?: string, options?: HttpErrorOptions);
|
|
130
|
-
* constructor(options?: HttpErrorOptions);
|
|
131
|
-
* constructor(
|
|
132
|
-
* statusOrMessageOrOptions?: number | string | HttpErrorOptions,
|
|
133
|
-
* messageOrOptions?: string | HttpErrorOptions,
|
|
134
|
-
* options?: HttpErrorOptions,
|
|
135
|
-
* ) {
|
|
136
|
-
* const init = optionsFromArgs(
|
|
137
|
-
* statusOrMessageOrOptions,
|
|
138
|
-
* messageOrOptions,
|
|
139
|
-
* options,
|
|
140
|
-
* );
|
|
141
|
-
* super({ name: "CustomError", status: 420, ...init });
|
|
142
|
-
* }
|
|
143
|
-
* }
|
|
144
|
-
* ```
|
|
145
|
-
*
|
|
146
|
-
* The HttpError class also provides `toJSON()` and `getResponse()` methods to
|
|
147
|
-
* convert errors into RFC 9457 Problem Details objects or Response objects,
|
|
148
|
-
* respectively. This makes it easy to return standardized error responses from
|
|
149
|
-
* your HTTP APIs.
|
|
150
|
-
*
|
|
151
|
-
* ```ts
|
|
152
|
-
* import { HttpError } from "@udibo/http-error";
|
|
153
|
-
*
|
|
154
|
-
* const error = new HttpError(403, "Access denied", {
|
|
155
|
-
* type: "/errors/forbidden",
|
|
156
|
-
* instance: "/docs/123/edit",
|
|
157
|
-
* extensions: { accountId: "user-abc" },
|
|
158
|
-
* });
|
|
159
|
-
*
|
|
160
|
-
* // Get Problem Details object
|
|
161
|
-
* const problemDetails = error.toJSON();
|
|
162
|
-
* console.log(problemDetails);
|
|
163
|
-
* // Output:
|
|
164
|
-
* // {
|
|
165
|
-
* // accountId: "user-abc",
|
|
166
|
-
* // status: 403,
|
|
167
|
-
* // title: "ForbiddenError",
|
|
168
|
-
* // detail: "Access denied",
|
|
169
|
-
* // type: "/errors/forbidden",
|
|
170
|
-
* // instance: "/docs/123/edit"
|
|
171
|
-
* // }
|
|
172
|
-
*
|
|
173
|
-
* // Get a Response object
|
|
174
|
-
* const response = error.getResponse();
|
|
175
|
-
* console.log(response.status); // 403
|
|
176
|
-
* response.json().then(body => console.log(body)); // Same as problemDetails
|
|
177
|
-
* ```
|
|
178
|
-
*
|
|
179
|
-
* @typeparam Extensions - Other data associated with the error that will be included in the error response.
|
|
180
|
-
* @param status - The HTTP status associated with the error.
|
|
181
|
-
* @param message - The message associated with the error.
|
|
182
|
-
* @param options - Other data associated with the error.
|
|
183
|
-
* @returns An HttpError object.
|
|
184
|
-
*/
|
|
185
|
-
export declare class HttpError<Extensions extends object = Record<string, unknown>> extends Error {
|
|
186
|
-
/**
|
|
187
|
-
* The HTTP status associated with the error.
|
|
188
|
-
* Must be a client or server error status. Defaults to 500.
|
|
189
|
-
*/
|
|
190
|
-
status: number;
|
|
191
|
-
/** The HTTP status text associated with the error. */
|
|
192
|
-
statusText?: string;
|
|
193
|
-
/**
|
|
194
|
-
* Determines if the error detail should be exposed in the response.
|
|
195
|
-
* Defaults to true for client error statuses and false for server error statuses.
|
|
196
|
-
*/
|
|
197
|
-
expose?: boolean;
|
|
198
|
-
/**
|
|
199
|
-
* The type of the error is a URI reference that identifies the problem type.
|
|
200
|
-
*/
|
|
201
|
-
type?: string;
|
|
202
|
-
/**
|
|
203
|
-
* The instance of the error is a URI reference that identifies the specific occurrence of the problem.
|
|
204
|
-
*/
|
|
205
|
-
instance?: string;
|
|
206
|
-
/**
|
|
207
|
-
* Other data associated with the error that will be included in the error response.
|
|
208
|
-
*/
|
|
209
|
-
extensions: Extensions;
|
|
210
|
-
/**
|
|
211
|
-
* The headers to send in the response. The content-type will default to application/problem+json unless otherwise specified in the headers.
|
|
212
|
-
*/
|
|
213
|
-
headers: Headers;
|
|
214
|
-
/**
|
|
215
|
-
* The message to expose in the response. Used as the `detail` field in toJSON().
|
|
216
|
-
* - If explicitly set in options, that value is used
|
|
217
|
-
* - If expose is true and message exists, defaults to message
|
|
218
|
-
* - Otherwise, defaults to a generic message for the status code
|
|
219
|
-
*
|
|
220
|
-
* Use this instead of `message` when rendering errors to prevent leaking internal details.
|
|
221
|
-
*/
|
|
222
|
-
exposedMessage: string;
|
|
223
|
-
constructor(status?: number, message?: string, options?: HttpErrorOptions<Extensions>);
|
|
224
|
-
constructor(status?: number, options?: HttpErrorOptions<Extensions>);
|
|
225
|
-
constructor(message?: string, options?: HttpErrorOptions<Extensions>);
|
|
226
|
-
constructor(options?: HttpErrorOptions<Extensions>);
|
|
227
|
-
/**
|
|
228
|
-
* Converts any HttpError like objects into an HttpError.
|
|
229
|
-
* If the object is already an instance of HttpError, it will be returned as is.
|
|
230
|
-
*
|
|
231
|
-
* ```ts
|
|
232
|
-
* import { HttpError } from "@udibo/http-error";
|
|
233
|
-
*
|
|
234
|
-
* try {
|
|
235
|
-
* throw new Error("something went wrong");
|
|
236
|
-
* } catch (cause) {
|
|
237
|
-
* // Converts any non HttpError objects into an HttpError before re-throwing.
|
|
238
|
-
* throw HttpError.from(cause);
|
|
239
|
-
* }
|
|
240
|
-
* ```
|
|
241
|
-
*
|
|
242
|
-
* @param error - The error to convert.
|
|
243
|
-
* @returns An HttpError object.
|
|
244
|
-
*/
|
|
245
|
-
static from<Extensions extends object = Record<string, unknown>>(error: HttpError<Extensions> | ProblemDetails<Extensions>): HttpError<Extensions>;
|
|
246
|
-
static from<Extensions extends object = Record<string, unknown>>(error: Response): Promise<HttpError<Extensions>>;
|
|
247
|
-
static from(error: Error): HttpError;
|
|
248
|
-
static from<Extensions extends object = Record<string, unknown>>(error: unknown): HttpError<Extensions>;
|
|
249
|
-
/**
|
|
250
|
-
* Converts the HttpError to a ProblemDetails object that matches the RFC 9457
|
|
251
|
-
* Problem Details for HTTP APIs specification. This object is suitable for
|
|
252
|
-
* direct serialization into a JSON response body.
|
|
253
|
-
*
|
|
254
|
-
* @returns A ProblemDetails object representing the error, compliant with RFC 9457.
|
|
255
|
-
*/
|
|
256
|
-
toJSON(): ProblemDetails<Extensions>;
|
|
257
|
-
/**
|
|
258
|
-
* Converts the HttpError to a Response object that matches the RFC 9457
|
|
259
|
-
* Problem Details for HTTP APIs specification. The body of the response will
|
|
260
|
-
* be a JSON string representing the ProblemDetails object.
|
|
261
|
-
*
|
|
262
|
-
* @returns A Response object suitable for returning from an HTTP handler, compliant with RFC 9457.
|
|
263
|
-
*/
|
|
264
|
-
getResponse(): Response;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Checks if a value is HttpError-like (an Error with a numeric status property).
|
|
268
|
-
*
|
|
269
|
-
* This function returns true for any Error object that has a numeric `status` property,
|
|
270
|
-
* not just HttpError instances. This allows it to recognize HTTP errors from other
|
|
271
|
-
* libraries or custom error classes that follow the same pattern.
|
|
272
|
-
*
|
|
273
|
-
* If you need to verify that an error is specifically an HttpError instance
|
|
274
|
-
* (not just similar to one), use `error instanceof HttpError` instead.
|
|
275
|
-
*
|
|
276
|
-
* ```ts
|
|
277
|
-
* import { HttpError, isHttpErrorLike } from "@udibo/http-error";
|
|
278
|
-
*
|
|
279
|
-
* let error = new Error("file not found");
|
|
280
|
-
* console.log(isHttpErrorLike(error)); // false
|
|
281
|
-
*
|
|
282
|
-
* error = new HttpError(404, "file not found");
|
|
283
|
-
* console.log(isHttpErrorLike(error)); // true
|
|
284
|
-
* console.log(error instanceof HttpError); // true
|
|
285
|
-
*
|
|
286
|
-
* // Custom error class with status property
|
|
287
|
-
* class CustomHttpError extends Error {
|
|
288
|
-
* status = 400;
|
|
289
|
-
* }
|
|
290
|
-
* const customError = new CustomHttpError("bad request");
|
|
291
|
-
* console.log(isHttpErrorLike(customError)); // true
|
|
292
|
-
* console.log(customError instanceof HttpError); // false
|
|
293
|
-
* ```
|
|
294
|
-
*
|
|
295
|
-
* @param value - The value to check.
|
|
296
|
-
* @returns True if the value is an HttpError or an Error with a numeric status property.
|
|
297
|
-
*/
|
|
298
|
-
export declare function isHttpErrorLike<Extensions extends object = Record<string, unknown>>(value: unknown): value is HttpError<Extensions> | (Error & {
|
|
299
|
-
status: number;
|
|
300
|
-
});
|
|
301
|
-
/**
|
|
302
|
-
* Creates a new class that extends HttpError, allowing for predefined default
|
|
303
|
-
* options and a specific default type for extensions.
|
|
304
|
-
*
|
|
305
|
-
* This factory is useful for creating custom HttpError types tailored to specific
|
|
306
|
-
* kinds of errors in an application, each with its own default status, name,
|
|
307
|
-
* or custom extension fields.
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* ```ts
|
|
311
|
-
* // Define a type for default extensions
|
|
312
|
-
* interface MyApiErrorExtensions {
|
|
313
|
-
* errorCode: string;
|
|
314
|
-
* requestId?: string;
|
|
315
|
-
* }
|
|
316
|
-
*
|
|
317
|
-
* // Create a custom error class with defaults
|
|
318
|
-
* const MyApiError = createHttpErrorClass<MyApiErrorExtensions>({
|
|
319
|
-
* name: "MyApiError",
|
|
320
|
-
* status: 452, // Custom default status
|
|
321
|
-
* extensions: {
|
|
322
|
-
* errorCode: "API_GENERAL_FAILURE", // Default extension value
|
|
323
|
-
* },
|
|
324
|
-
* });
|
|
325
|
-
*
|
|
326
|
-
* // Usage of the custom error class
|
|
327
|
-
* try {
|
|
328
|
-
* // Simulate an error condition
|
|
329
|
-
* throw new MyApiError("A specific API operation failed.", {
|
|
330
|
-
* extensions: {
|
|
331
|
-
* errorCode: "API_OPERATION_X_FAILED", // Override default extension
|
|
332
|
-
* requestId: "req-12345", // Add instance-specific extension
|
|
333
|
-
* },
|
|
334
|
-
* });
|
|
335
|
-
* } catch (e) {
|
|
336
|
-
* if (e instanceof MyApiError) {
|
|
337
|
-
* console.log(e.name); // "MyApiError"
|
|
338
|
-
* console.log(e.status); // 452
|
|
339
|
-
* console.log(e.message); // "A specific API operation failed."
|
|
340
|
-
* console.log(e.extensions.errorCode); // "API_OPERATION_X_FAILED"
|
|
341
|
-
* console.log(e.extensions.requestId); // "req-12345"
|
|
342
|
-
* // console.log(e.toJSON());
|
|
343
|
-
* }
|
|
344
|
-
* }
|
|
345
|
-
*
|
|
346
|
-
* // Example with a different status code at instantiation
|
|
347
|
-
* const anotherError = new MyApiError(453, "Another failure");
|
|
348
|
-
* console.log(anotherError.status) // 453
|
|
349
|
-
* console.log(anotherError.extensions.errorCode) // "API_GENERAL_FAILURE"
|
|
350
|
-
* ```
|
|
351
|
-
*
|
|
352
|
-
* @typeparam DefaultExtensions The type for the default `extensions` object. Defaults to `Record<string, unknown>`.
|
|
353
|
-
* @param defaultOptionsForClass Optional default HttpErrorOptions to apply to the new error class.
|
|
354
|
-
* @returns A new class that extends `HttpError`.
|
|
355
|
-
*/
|
|
356
|
-
export declare function createHttpErrorClass<DefaultExtensions extends object = Record<string, unknown>>(defaultOptionsForClass?: HttpErrorOptions<DefaultExtensions>): {
|
|
357
|
-
new <Extensions extends DefaultExtensions = DefaultExtensions>(status?: number, message?: string, options?: HttpErrorOptions<Extensions>): HttpError<Extensions>;
|
|
358
|
-
new <Extensions extends DefaultExtensions = DefaultExtensions>(status?: number, options?: HttpErrorOptions<Extensions>): HttpError<Extensions>;
|
|
359
|
-
new <Extensions extends DefaultExtensions = DefaultExtensions>(message?: string, options?: HttpErrorOptions<Extensions>): HttpError<Extensions>;
|
|
360
|
-
new <Extensions extends DefaultExtensions = DefaultExtensions>(options?: HttpErrorOptions<Extensions>): HttpError<Extensions>;
|
|
361
|
-
prototype: HttpError<DefaultExtensions>;
|
|
362
|
-
};
|
|
363
|
-
export {};
|