@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,343 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
/**
|
|
4
|
-
* Contains the {@linkcode STATUS_CODE} object which contains standard HTTP
|
|
5
|
-
* status codes and provides several type guards for handling status codes
|
|
6
|
-
* with type safety.
|
|
7
|
-
*
|
|
8
|
-
* @example The status code and status text
|
|
9
|
-
* ```ts
|
|
10
|
-
* import {
|
|
11
|
-
* STATUS_CODE,
|
|
12
|
-
* STATUS_TEXT,
|
|
13
|
-
* } from "@std/http/status";
|
|
14
|
-
*
|
|
15
|
-
* console.log(STATUS_CODE.NotFound); // Returns 404
|
|
16
|
-
* console.log(STATUS_TEXT[STATUS_CODE.NotFound]); // Returns "Not Found"
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @example Checking the status code type
|
|
20
|
-
* ```ts ignore
|
|
21
|
-
* import { isErrorStatus } from "@std/http/status";
|
|
22
|
-
*
|
|
23
|
-
* const res = await fetch("https://example.com/");
|
|
24
|
-
*
|
|
25
|
-
* if (isErrorStatus(res.status)) {
|
|
26
|
-
* // error handling here...
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* await res.body?.cancel();
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @module
|
|
33
|
-
*/
|
|
34
|
-
export const STATUS_CODE = {
|
|
35
|
-
/** RFC 7231, 6.2.1 */
|
|
36
|
-
Continue: 100,
|
|
37
|
-
/** RFC 7231, 6.2.2 */
|
|
38
|
-
SwitchingProtocols: 101,
|
|
39
|
-
/** RFC 2518, 10.1 */
|
|
40
|
-
Processing: 102,
|
|
41
|
-
/** RFC 8297 **/
|
|
42
|
-
EarlyHints: 103,
|
|
43
|
-
/** RFC 7231, 6.3.1 */
|
|
44
|
-
OK: 200,
|
|
45
|
-
/** RFC 7231, 6.3.2 */
|
|
46
|
-
Created: 201,
|
|
47
|
-
/** RFC 7231, 6.3.3 */
|
|
48
|
-
Accepted: 202,
|
|
49
|
-
/** RFC 7231, 6.3.4 */
|
|
50
|
-
NonAuthoritativeInfo: 203,
|
|
51
|
-
/** RFC 7231, 6.3.5 */
|
|
52
|
-
NoContent: 204,
|
|
53
|
-
/** RFC 7231, 6.3.6 */
|
|
54
|
-
ResetContent: 205,
|
|
55
|
-
/** RFC 7233, 4.1 */
|
|
56
|
-
PartialContent: 206,
|
|
57
|
-
/** RFC 4918, 11.1 */
|
|
58
|
-
MultiStatus: 207,
|
|
59
|
-
/** RFC 5842, 7.1 */
|
|
60
|
-
AlreadyReported: 208,
|
|
61
|
-
/** RFC 3229, 10.4.1 */
|
|
62
|
-
IMUsed: 226,
|
|
63
|
-
/** RFC 7231, 6.4.1 */
|
|
64
|
-
MultipleChoices: 300,
|
|
65
|
-
/** RFC 7231, 6.4.2 */
|
|
66
|
-
MovedPermanently: 301,
|
|
67
|
-
/** RFC 7231, 6.4.3 */
|
|
68
|
-
Found: 302,
|
|
69
|
-
/** RFC 7231, 6.4.4 */
|
|
70
|
-
SeeOther: 303,
|
|
71
|
-
/** RFC 7232, 4.1 */
|
|
72
|
-
NotModified: 304,
|
|
73
|
-
/** RFC 7231, 6.4.5 */
|
|
74
|
-
UseProxy: 305,
|
|
75
|
-
/** RFC 7231, 6.4.7 */
|
|
76
|
-
TemporaryRedirect: 307,
|
|
77
|
-
/** RFC 7538, 3 */
|
|
78
|
-
PermanentRedirect: 308,
|
|
79
|
-
/** RFC 7231, 6.5.1 */
|
|
80
|
-
BadRequest: 400,
|
|
81
|
-
/** RFC 7235, 3.1 */
|
|
82
|
-
Unauthorized: 401,
|
|
83
|
-
/** RFC 7231, 6.5.2 */
|
|
84
|
-
PaymentRequired: 402,
|
|
85
|
-
/** RFC 7231, 6.5.3 */
|
|
86
|
-
Forbidden: 403,
|
|
87
|
-
/** RFC 7231, 6.5.4 */
|
|
88
|
-
NotFound: 404,
|
|
89
|
-
/** RFC 7231, 6.5.5 */
|
|
90
|
-
MethodNotAllowed: 405,
|
|
91
|
-
/** RFC 7231, 6.5.6 */
|
|
92
|
-
NotAcceptable: 406,
|
|
93
|
-
/** RFC 7235, 3.2 */
|
|
94
|
-
ProxyAuthRequired: 407,
|
|
95
|
-
/** RFC 7231, 6.5.7 */
|
|
96
|
-
RequestTimeout: 408,
|
|
97
|
-
/** RFC 7231, 6.5.8 */
|
|
98
|
-
Conflict: 409,
|
|
99
|
-
/** RFC 7231, 6.5.9 */
|
|
100
|
-
Gone: 410,
|
|
101
|
-
/** RFC 7231, 6.5.10 */
|
|
102
|
-
LengthRequired: 411,
|
|
103
|
-
/** RFC 7232, 4.2 */
|
|
104
|
-
PreconditionFailed: 412,
|
|
105
|
-
/** RFC 7231, 6.5.11 */
|
|
106
|
-
ContentTooLarge: 413,
|
|
107
|
-
/** RFC 7231, 6.5.12 */
|
|
108
|
-
URITooLong: 414,
|
|
109
|
-
/** RFC 7231, 6.5.13 */
|
|
110
|
-
UnsupportedMediaType: 415,
|
|
111
|
-
/** RFC 7233, 4.4 */
|
|
112
|
-
RangeNotSatisfiable: 416,
|
|
113
|
-
/** RFC 7231, 6.5.14 */
|
|
114
|
-
ExpectationFailed: 417,
|
|
115
|
-
/** RFC 7168, 2.3.3 */
|
|
116
|
-
Teapot: 418,
|
|
117
|
-
/** RFC 7540, 9.1.2 */
|
|
118
|
-
MisdirectedRequest: 421,
|
|
119
|
-
/** RFC 4918, 11.2 */
|
|
120
|
-
UnprocessableEntity: 422,
|
|
121
|
-
/** RFC 4918, 11.3 */
|
|
122
|
-
Locked: 423,
|
|
123
|
-
/** RFC 4918, 11.4 */
|
|
124
|
-
FailedDependency: 424,
|
|
125
|
-
/** RFC 8470, 5.2 */
|
|
126
|
-
TooEarly: 425,
|
|
127
|
-
/** RFC 7231, 6.5.15 */
|
|
128
|
-
UpgradeRequired: 426,
|
|
129
|
-
/** RFC 6585, 3 */
|
|
130
|
-
PreconditionRequired: 428,
|
|
131
|
-
/** RFC 6585, 4 */
|
|
132
|
-
TooManyRequests: 429,
|
|
133
|
-
/** RFC 6585, 5 */
|
|
134
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
135
|
-
/** RFC 7725, 3 */
|
|
136
|
-
UnavailableForLegalReasons: 451,
|
|
137
|
-
/** RFC 7231, 6.6.1 */
|
|
138
|
-
InternalServerError: 500,
|
|
139
|
-
/** RFC 7231, 6.6.2 */
|
|
140
|
-
NotImplemented: 501,
|
|
141
|
-
/** RFC 7231, 6.6.3 */
|
|
142
|
-
BadGateway: 502,
|
|
143
|
-
/** RFC 7231, 6.6.4 */
|
|
144
|
-
ServiceUnavailable: 503,
|
|
145
|
-
/** RFC 7231, 6.6.5 */
|
|
146
|
-
GatewayTimeout: 504,
|
|
147
|
-
/** RFC 7231, 6.6.6 */
|
|
148
|
-
HTTPVersionNotSupported: 505,
|
|
149
|
-
/** RFC 2295, 8.1 */
|
|
150
|
-
VariantAlsoNegotiates: 506,
|
|
151
|
-
/** RFC 4918, 11.5 */
|
|
152
|
-
InsufficientStorage: 507,
|
|
153
|
-
/** RFC 5842, 7.2 */
|
|
154
|
-
LoopDetected: 508,
|
|
155
|
-
/** RFC 2774, 7 */
|
|
156
|
-
NotExtended: 510,
|
|
157
|
-
/** RFC 6585, 6 */
|
|
158
|
-
NetworkAuthenticationRequired: 511,
|
|
159
|
-
};
|
|
160
|
-
/** A record of all the status codes text. */
|
|
161
|
-
export const STATUS_TEXT = {
|
|
162
|
-
[STATUS_CODE.Accepted]: "Accepted",
|
|
163
|
-
[STATUS_CODE.AlreadyReported]: "Already Reported",
|
|
164
|
-
[STATUS_CODE.BadGateway]: "Bad Gateway",
|
|
165
|
-
[STATUS_CODE.BadRequest]: "Bad Request",
|
|
166
|
-
[STATUS_CODE.Conflict]: "Conflict",
|
|
167
|
-
[STATUS_CODE.Continue]: "Continue",
|
|
168
|
-
[STATUS_CODE.Created]: "Created",
|
|
169
|
-
[STATUS_CODE.EarlyHints]: "Early Hints",
|
|
170
|
-
[STATUS_CODE.ExpectationFailed]: "Expectation Failed",
|
|
171
|
-
[STATUS_CODE.FailedDependency]: "Failed Dependency",
|
|
172
|
-
[STATUS_CODE.Forbidden]: "Forbidden",
|
|
173
|
-
[STATUS_CODE.Found]: "Found",
|
|
174
|
-
[STATUS_CODE.GatewayTimeout]: "Gateway Timeout",
|
|
175
|
-
[STATUS_CODE.Gone]: "Gone",
|
|
176
|
-
[STATUS_CODE.HTTPVersionNotSupported]: "HTTP Version Not Supported",
|
|
177
|
-
[STATUS_CODE.IMUsed]: "IM Used",
|
|
178
|
-
[STATUS_CODE.InsufficientStorage]: "Insufficient Storage",
|
|
179
|
-
[STATUS_CODE.InternalServerError]: "Internal Server Error",
|
|
180
|
-
[STATUS_CODE.LengthRequired]: "Length Required",
|
|
181
|
-
[STATUS_CODE.Locked]: "Locked",
|
|
182
|
-
[STATUS_CODE.LoopDetected]: "Loop Detected",
|
|
183
|
-
[STATUS_CODE.MethodNotAllowed]: "Method Not Allowed",
|
|
184
|
-
[STATUS_CODE.MisdirectedRequest]: "Misdirected Request",
|
|
185
|
-
[STATUS_CODE.MovedPermanently]: "Moved Permanently",
|
|
186
|
-
[STATUS_CODE.MultiStatus]: "Multi Status",
|
|
187
|
-
[STATUS_CODE.MultipleChoices]: "Multiple Choices",
|
|
188
|
-
[STATUS_CODE.NetworkAuthenticationRequired]: "Network Authentication Required",
|
|
189
|
-
[STATUS_CODE.NoContent]: "No Content",
|
|
190
|
-
[STATUS_CODE.NonAuthoritativeInfo]: "Non Authoritative Info",
|
|
191
|
-
[STATUS_CODE.NotAcceptable]: "Not Acceptable",
|
|
192
|
-
[STATUS_CODE.NotExtended]: "Not Extended",
|
|
193
|
-
[STATUS_CODE.NotFound]: "Not Found",
|
|
194
|
-
[STATUS_CODE.NotImplemented]: "Not Implemented",
|
|
195
|
-
[STATUS_CODE.NotModified]: "Not Modified",
|
|
196
|
-
[STATUS_CODE.OK]: "OK",
|
|
197
|
-
[STATUS_CODE.PartialContent]: "Partial Content",
|
|
198
|
-
[STATUS_CODE.PaymentRequired]: "Payment Required",
|
|
199
|
-
[STATUS_CODE.PermanentRedirect]: "Permanent Redirect",
|
|
200
|
-
[STATUS_CODE.PreconditionFailed]: "Precondition Failed",
|
|
201
|
-
[STATUS_CODE.PreconditionRequired]: "Precondition Required",
|
|
202
|
-
[STATUS_CODE.Processing]: "Processing",
|
|
203
|
-
[STATUS_CODE.ProxyAuthRequired]: "Proxy Auth Required",
|
|
204
|
-
[STATUS_CODE.ContentTooLarge]: "Content Too Large",
|
|
205
|
-
[STATUS_CODE.RequestHeaderFieldsTooLarge]: "Request Header Fields Too Large",
|
|
206
|
-
[STATUS_CODE.RequestTimeout]: "Request Timeout",
|
|
207
|
-
[STATUS_CODE.URITooLong]: "URI Too Long",
|
|
208
|
-
[STATUS_CODE.RangeNotSatisfiable]: "Range Not Satisfiable",
|
|
209
|
-
[STATUS_CODE.ResetContent]: "Reset Content",
|
|
210
|
-
[STATUS_CODE.SeeOther]: "See Other",
|
|
211
|
-
[STATUS_CODE.ServiceUnavailable]: "Service Unavailable",
|
|
212
|
-
[STATUS_CODE.SwitchingProtocols]: "Switching Protocols",
|
|
213
|
-
[STATUS_CODE.Teapot]: "I'm a teapot",
|
|
214
|
-
[STATUS_CODE.TemporaryRedirect]: "Temporary Redirect",
|
|
215
|
-
[STATUS_CODE.TooEarly]: "Too Early",
|
|
216
|
-
[STATUS_CODE.TooManyRequests]: "Too Many Requests",
|
|
217
|
-
[STATUS_CODE.Unauthorized]: "Unauthorized",
|
|
218
|
-
[STATUS_CODE.UnavailableForLegalReasons]: "Unavailable For Legal Reasons",
|
|
219
|
-
[STATUS_CODE.UnprocessableEntity]: "Unprocessable Entity",
|
|
220
|
-
[STATUS_CODE.UnsupportedMediaType]: "Unsupported Media Type",
|
|
221
|
-
[STATUS_CODE.UpgradeRequired]: "Upgrade Required",
|
|
222
|
-
[STATUS_CODE.UseProxy]: "Use Proxy",
|
|
223
|
-
[STATUS_CODE.VariantAlsoNegotiates]: "Variant Also Negotiates",
|
|
224
|
-
};
|
|
225
|
-
/**
|
|
226
|
-
* Returns whether the provided number is a valid HTTP status code.
|
|
227
|
-
*
|
|
228
|
-
* @example Usage
|
|
229
|
-
* ```ts
|
|
230
|
-
* import { isStatus } from "@std/http/status";
|
|
231
|
-
* import { assert } from "@std/assert";
|
|
232
|
-
*
|
|
233
|
-
* assert(isStatus(404));
|
|
234
|
-
* ```
|
|
235
|
-
*
|
|
236
|
-
* @param status The status to assert against.
|
|
237
|
-
* @returns Whether or not the provided status is a valid status code.
|
|
238
|
-
*/
|
|
239
|
-
export function isStatus(status) {
|
|
240
|
-
return Object.values(STATUS_CODE).includes(status);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* A type guard that determines if the status code is informational.
|
|
244
|
-
*
|
|
245
|
-
* @example Usage
|
|
246
|
-
* ```ts
|
|
247
|
-
* import { isInformationalStatus } from "@std/http/status";
|
|
248
|
-
* import { assert } from "@std/assert";
|
|
249
|
-
*
|
|
250
|
-
* assert(isInformationalStatus(100));
|
|
251
|
-
* ```
|
|
252
|
-
*
|
|
253
|
-
* @param status The status to assert against.
|
|
254
|
-
* @returns Whether or not the provided status is an informational status code.
|
|
255
|
-
*/
|
|
256
|
-
export function isInformationalStatus(status) {
|
|
257
|
-
return isStatus(status) && status >= 100 && status < 200;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* A type guard that determines if the status code is successful.
|
|
261
|
-
*
|
|
262
|
-
* @example Usage
|
|
263
|
-
* ```ts
|
|
264
|
-
* import { isSuccessfulStatus } from "@std/http/status";
|
|
265
|
-
* import { assert } from "@std/assert";
|
|
266
|
-
*
|
|
267
|
-
* assert(isSuccessfulStatus(200));
|
|
268
|
-
* ```
|
|
269
|
-
*
|
|
270
|
-
* @param status The status to assert against.
|
|
271
|
-
* @returns Whether or not the provided status is a successful status code.
|
|
272
|
-
*/
|
|
273
|
-
export function isSuccessfulStatus(status) {
|
|
274
|
-
return isStatus(status) && status >= 200 && status < 300;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* A type guard that determines if the status code is a redirection.
|
|
278
|
-
*
|
|
279
|
-
* @example Usage
|
|
280
|
-
* ```ts
|
|
281
|
-
* import { isRedirectStatus } from "@std/http/status";
|
|
282
|
-
* import { assert } from "@std/assert";
|
|
283
|
-
*
|
|
284
|
-
* assert(isRedirectStatus(302));
|
|
285
|
-
* ```
|
|
286
|
-
*
|
|
287
|
-
* @param status The status to assert against.
|
|
288
|
-
* @returns Whether or not the provided status is a redirect status code.
|
|
289
|
-
*/
|
|
290
|
-
export function isRedirectStatus(status) {
|
|
291
|
-
return isStatus(status) && status >= 300 && status < 400;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* A type guard that determines if the status code is a client error.
|
|
295
|
-
*
|
|
296
|
-
* @example Usage
|
|
297
|
-
* ```ts
|
|
298
|
-
* import { isClientErrorStatus } from "@std/http/status";
|
|
299
|
-
* import { assert } from "@std/assert";
|
|
300
|
-
*
|
|
301
|
-
* assert(isClientErrorStatus(404));
|
|
302
|
-
* ```
|
|
303
|
-
*
|
|
304
|
-
* @param status The status to assert against.
|
|
305
|
-
* @returns Whether or not the provided status is a client error status code.
|
|
306
|
-
*/
|
|
307
|
-
export function isClientErrorStatus(status) {
|
|
308
|
-
return isStatus(status) && status >= 400 && status < 500;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* A type guard that determines if the status code is a server error.
|
|
312
|
-
*
|
|
313
|
-
* @example Usage
|
|
314
|
-
* ```ts
|
|
315
|
-
* import { isServerErrorStatus } from "@std/http/status";
|
|
316
|
-
* import { assert } from "@std/assert";
|
|
317
|
-
*
|
|
318
|
-
* assert(isServerErrorStatus(502));
|
|
319
|
-
* ```
|
|
320
|
-
*
|
|
321
|
-
* @param status The status to assert against.
|
|
322
|
-
* @returns Whether or not the provided status is a server error status code.
|
|
323
|
-
*/
|
|
324
|
-
export function isServerErrorStatus(status) {
|
|
325
|
-
return isStatus(status) && status >= 500 && status < 600;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* A type guard that determines if the status code is an error.
|
|
329
|
-
*
|
|
330
|
-
* @example Usage
|
|
331
|
-
* ```ts
|
|
332
|
-
* import { isErrorStatus } from "@std/http/status";
|
|
333
|
-
* import { assert } from "@std/assert";
|
|
334
|
-
*
|
|
335
|
-
* assert(isErrorStatus(502));
|
|
336
|
-
* ```
|
|
337
|
-
*
|
|
338
|
-
* @param status The status to assert against.
|
|
339
|
-
* @returns Whether or not the provided status is an error status code.
|
|
340
|
-
*/
|
|
341
|
-
export function isErrorStatus(status) {
|
|
342
|
-
return isStatus(status) && status >= 400 && status < 600;
|
|
343
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check the test suite internal state
|
|
3
|
-
*
|
|
4
|
-
* @example Usage
|
|
5
|
-
* ```ts ignore
|
|
6
|
-
* import { AssertionState } from "@std/internal";
|
|
7
|
-
*
|
|
8
|
-
* const assertionState = new AssertionState();
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare class AssertionState {
|
|
12
|
-
#private;
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Get the number that through `expect.assertions` api set.
|
|
16
|
-
*
|
|
17
|
-
* @returns the number that through `expect.assertions` api set.
|
|
18
|
-
*
|
|
19
|
-
* @example Usage
|
|
20
|
-
* ```ts ignore
|
|
21
|
-
* import { AssertionState } from "@std/internal";
|
|
22
|
-
*
|
|
23
|
-
* const assertionState = new AssertionState();
|
|
24
|
-
* assertionState.assertionCount;
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
get assertionCount(): number | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Get a certain number that assertions were called before.
|
|
30
|
-
*
|
|
31
|
-
* @returns return a certain number that assertions were called before.
|
|
32
|
-
*
|
|
33
|
-
* @example Usage
|
|
34
|
-
* ```ts ignore
|
|
35
|
-
* import { AssertionState } from "@std/internal";
|
|
36
|
-
*
|
|
37
|
-
* const assertionState = new AssertionState();
|
|
38
|
-
* assertionState.assertionTriggeredCount;
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
get assertionTriggeredCount(): number;
|
|
42
|
-
/**
|
|
43
|
-
* If `expect.hasAssertions` called, then through this method to update #state.assertionCheck value.
|
|
44
|
-
*
|
|
45
|
-
* @param val Set #state.assertionCheck's value
|
|
46
|
-
*
|
|
47
|
-
* @example Usage
|
|
48
|
-
* ```ts ignore
|
|
49
|
-
* import { AssertionState } from "@std/internal";
|
|
50
|
-
*
|
|
51
|
-
* const assertionState = new AssertionState();
|
|
52
|
-
* assertionState.setAssertionCheck(true);
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
setAssertionCheck(val: boolean): void;
|
|
56
|
-
/**
|
|
57
|
-
* If any matchers was called, `#state.assertionTriggered` will be set through this method.
|
|
58
|
-
*
|
|
59
|
-
* @param val Set #state.assertionTriggered's value
|
|
60
|
-
*
|
|
61
|
-
* @example Usage
|
|
62
|
-
* ```ts ignore
|
|
63
|
-
* import { AssertionState } from "@std/internal";
|
|
64
|
-
*
|
|
65
|
-
* const assertionState = new AssertionState();
|
|
66
|
-
* assertionState.setAssertionTriggered(true);
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
setAssertionTriggered(val: boolean): void;
|
|
70
|
-
/**
|
|
71
|
-
* If `expect.assertions` called, then through this method to update #state.assertionCheck value.
|
|
72
|
-
*
|
|
73
|
-
* @param num Set #state.assertionCount's value, for example if the value is set 2, that means
|
|
74
|
-
* you must have two assertion matchers call in your test suite.
|
|
75
|
-
*
|
|
76
|
-
* @example Usage
|
|
77
|
-
* ```ts ignore
|
|
78
|
-
* import { AssertionState } from "@std/internal";
|
|
79
|
-
*
|
|
80
|
-
* const assertionState = new AssertionState();
|
|
81
|
-
* assertionState.setAssertionCount(2);
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
setAssertionCount(num: number): void;
|
|
85
|
-
/**
|
|
86
|
-
* If any matchers was called, `#state.assertionTriggeredCount` value will plus one internally.
|
|
87
|
-
*
|
|
88
|
-
* @example Usage
|
|
89
|
-
* ```ts ignore
|
|
90
|
-
* import { AssertionState } from "@std/internal";
|
|
91
|
-
*
|
|
92
|
-
* const assertionState = new AssertionState();
|
|
93
|
-
* assertionState.updateAssertionTriggerCount();
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
updateAssertionTriggerCount(): void;
|
|
97
|
-
/**
|
|
98
|
-
* Check Assertion internal state, if `#state.assertionCheck` is set true, but
|
|
99
|
-
* `#state.assertionTriggered` is still false, then should throw an Assertion Error.
|
|
100
|
-
*
|
|
101
|
-
* @returns a boolean value, that the test suite is satisfied with the check. If not,
|
|
102
|
-
* it should throw an AssertionError.
|
|
103
|
-
*
|
|
104
|
-
* @example Usage
|
|
105
|
-
* ```ts ignore
|
|
106
|
-
* import { AssertionState } from "@std/internal";
|
|
107
|
-
*
|
|
108
|
-
* const assertionState = new AssertionState();
|
|
109
|
-
* if (assertionState.checkAssertionErrorState()) {
|
|
110
|
-
* // throw AssertionError("");
|
|
111
|
-
* }
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
checkAssertionErrorState(): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Reset all assertion state when every test suite function ran completely.
|
|
117
|
-
*
|
|
118
|
-
* @example Usage
|
|
119
|
-
* ```ts ignore
|
|
120
|
-
* import { AssertionState } from "@std/internal";
|
|
121
|
-
*
|
|
122
|
-
* const assertionState = new AssertionState();
|
|
123
|
-
* assertionState.resetAssertionState();
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
resetAssertionState(): void;
|
|
127
|
-
/**
|
|
128
|
-
* Check Assertion called state, if `#state.assertionCount` is set to a number value, but
|
|
129
|
-
* `#state.assertionTriggeredCount` is less then it, then should throw an assertion error.
|
|
130
|
-
*
|
|
131
|
-
* @returns a boolean value, that the test suite is satisfied with the check. If not,
|
|
132
|
-
* it should throw an AssertionError.
|
|
133
|
-
*
|
|
134
|
-
* @example Usage
|
|
135
|
-
* ```ts ignore
|
|
136
|
-
* import { AssertionState } from "@std/internal";
|
|
137
|
-
*
|
|
138
|
-
* const assertionState = new AssertionState();
|
|
139
|
-
* if (assertionState.checkAssertionCountSatisfied()) {
|
|
140
|
-
* // throw AssertionError("");
|
|
141
|
-
* }
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
checkAssertionCountSatisfied(): boolean;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* return an instance of AssertionState
|
|
148
|
-
*
|
|
149
|
-
* @returns AssertionState
|
|
150
|
-
*
|
|
151
|
-
* @example Usage
|
|
152
|
-
* ```ts ignore
|
|
153
|
-
* import { getAssertionState } from "@std/internal";
|
|
154
|
-
*
|
|
155
|
-
* const assertionState = getAssertionState();
|
|
156
|
-
* assertionState.setAssertionTriggered(true);
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
export declare function getAssertionState(): AssertionState;
|