@udibo/oauth2 0.14.0 → 0.15.0
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 +22 -12
- package/{esm → dist}/adapters/hono/bff/bff.js +35 -29
- 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/{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,209 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
// Copyright 2020 Keith Cirkel. All rights reserved. MIT license.
|
|
3
|
-
// Copyright 2023 Skye "MierenManz". All rights reserved. MIT license.
|
|
4
|
-
/**
|
|
5
|
-
* Utilities for {@link https://protobuf.dev/programming-guides/encoding/#varints Varint} encoding
|
|
6
|
-
* of typed integers. Varint encoding represents integers using a variable number of bytes, with
|
|
7
|
-
* smaller values requiring fewer bytes.
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* import { encodeVarint, decodeVarint } from "@std/encoding/varint";
|
|
11
|
-
* import { assertEquals } from "@std/assert";
|
|
12
|
-
*
|
|
13
|
-
* const buf = new Uint8Array(10);
|
|
14
|
-
* assertEquals(
|
|
15
|
-
* encodeVarint(42n, buf),
|
|
16
|
-
* [new Uint8Array([42]), 1]
|
|
17
|
-
* );
|
|
18
|
-
*
|
|
19
|
-
* assertEquals(
|
|
20
|
-
* decodeVarint(new Uint8Array([42])),
|
|
21
|
-
* [ 42n, 1 ]
|
|
22
|
-
* );
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @module
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* The maximum value of an unsigned 64-bit integer.
|
|
29
|
-
* Equivalent to `2n**64n - 1n`
|
|
30
|
-
*/
|
|
31
|
-
export const MaxUint64 = 18446744073709551615n;
|
|
32
|
-
/**
|
|
33
|
-
* The maximum length, in bytes, of a Varint encoded 64-bit integer.
|
|
34
|
-
*/
|
|
35
|
-
export const MaxVarintLen64 = 10;
|
|
36
|
-
/**
|
|
37
|
-
* The maximum length, in bytes, of a Varint encoded 32-bit integer.
|
|
38
|
-
*/
|
|
39
|
-
export const MaxVarintLen32 = 5;
|
|
40
|
-
const MSB = 0x80;
|
|
41
|
-
const REST = 0x7f;
|
|
42
|
-
const SHIFT = 7;
|
|
43
|
-
const MSBN = 0x80n;
|
|
44
|
-
const SHIFTN = 7n;
|
|
45
|
-
// ArrayBuffer and TypedArray's for "pointer casting"
|
|
46
|
-
const AB = new ArrayBuffer(8);
|
|
47
|
-
const U32_VIEW = new Uint32Array(AB);
|
|
48
|
-
const U64_VIEW = new BigUint64Array(AB);
|
|
49
|
-
/**
|
|
50
|
-
* Given a non empty `buf`, starting at `offset` (default: 0), begin decoding bytes as
|
|
51
|
-
* Varint encoded bytes, for a maximum of 10 bytes (offset + 10). The returned
|
|
52
|
-
* tuple is of the decoded varint 32-bit number, and the new offset with which
|
|
53
|
-
* to continue decoding other data.
|
|
54
|
-
*
|
|
55
|
-
* If a `bigint` in return is undesired, the `decode32` function will return a
|
|
56
|
-
* `number`, but this should only be used in cases where the varint is
|
|
57
|
-
* _assured_ to be 32-bits. If in doubt, use `decode()`.
|
|
58
|
-
*
|
|
59
|
-
* To know how many bytes the Varint took to encode, simply negate `offset`
|
|
60
|
-
* from the returned new `offset`.
|
|
61
|
-
*
|
|
62
|
-
* @param buf The buffer to decode from.
|
|
63
|
-
* @param offset The offset to start decoding from.
|
|
64
|
-
* @returns A tuple of the decoded varint 64-bit number, and the new offset.
|
|
65
|
-
*
|
|
66
|
-
* @example Usage
|
|
67
|
-
* ```ts
|
|
68
|
-
* import { decodeVarint } from "@std/encoding/varint";
|
|
69
|
-
* import { assertEquals } from "@std/assert";
|
|
70
|
-
*
|
|
71
|
-
* const buf = new Uint8Array([0x8E, 0x02]);
|
|
72
|
-
* assertEquals(decodeVarint(buf), [270n, 2]);
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export function decodeVarint(buf, offset = 0) {
|
|
76
|
-
// Clear the last result from the Two's complement view
|
|
77
|
-
U64_VIEW[0] = 0n;
|
|
78
|
-
// Setup the initiat state of the function
|
|
79
|
-
let intermediate = 0;
|
|
80
|
-
let position = 0;
|
|
81
|
-
let i = offset;
|
|
82
|
-
// If the buffer is empty Throw
|
|
83
|
-
if (buf.length === 0)
|
|
84
|
-
throw new RangeError("Cannot read empty buffer");
|
|
85
|
-
let byte;
|
|
86
|
-
do {
|
|
87
|
-
// Get a single byte from the buffer
|
|
88
|
-
byte = buf[i];
|
|
89
|
-
// 1. Take the lower 7 bits of the byte.
|
|
90
|
-
// 2. Shift the bits into the correct position.
|
|
91
|
-
// 3. Bitwise OR it with the intermediate value
|
|
92
|
-
// QUIRK: in the 5th (and 10th) iteration of this loop it will overflow on the shift.
|
|
93
|
-
// This causes only the lower 4 bits to be shifted into place and removing the upper 3 bits
|
|
94
|
-
intermediate |= (byte & 0b01111111) << position;
|
|
95
|
-
// If position is 28
|
|
96
|
-
// it means that this iteration needs to be written the the two's complement view
|
|
97
|
-
// This only happens once due to the `-4` in this branch
|
|
98
|
-
if (position === 28) {
|
|
99
|
-
// Write to the view
|
|
100
|
-
U32_VIEW[0] = intermediate;
|
|
101
|
-
// set `intermediate` to the remaining 3 bits
|
|
102
|
-
// We only want the remaining three bits because the other 4 have been "consumed" on line 21
|
|
103
|
-
intermediate = (byte & 0b01110000) >>> 4;
|
|
104
|
-
// set `position` to -4 because later 7 will be added, making it 3
|
|
105
|
-
position = -4;
|
|
106
|
-
}
|
|
107
|
-
// Increment the shift position by 7
|
|
108
|
-
position += 7;
|
|
109
|
-
// Increment the iterator by 1
|
|
110
|
-
i++;
|
|
111
|
-
// Keep going while there is a continuation bit
|
|
112
|
-
} while ((byte & 0b10000000) === 0b10000000);
|
|
113
|
-
// subtract the initial offset from `i` to get the bytes read
|
|
114
|
-
const nRead = i - offset;
|
|
115
|
-
// If 10 bytes have been read and intermediate has overflown
|
|
116
|
-
// it means that the varint is malformed
|
|
117
|
-
// If 11 bytes have been read it means that the varint is malformed
|
|
118
|
-
// If `i` is bigger than the buffer it means we overread the buffer and the varint is malformed
|
|
119
|
-
if ((nRead === 10 && intermediate > -1) || nRead === 11 || i > buf.length) {
|
|
120
|
-
throw new RangeError("Cannot decode the varint input: Malformed or overflow varint");
|
|
121
|
-
}
|
|
122
|
-
// Write the intermediate value to the "empty" slot
|
|
123
|
-
// if the first slot is taken. Take the second slot
|
|
124
|
-
U32_VIEW[Number(nRead > 4)] = intermediate;
|
|
125
|
-
return [U64_VIEW[0], i];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Given a `buf`, starting at `offset` (default: 0), begin decoding bytes as
|
|
129
|
-
* Varint encoded bytes, for a maximum of 5 bytes (offset + 5). The returned
|
|
130
|
-
* tuple is of the decoded varint 32-bit number, and the new offset with which
|
|
131
|
-
* to continue decoding other data.
|
|
132
|
-
*
|
|
133
|
-
* Varints are _not 32-bit by default_ so this should only be used in cases
|
|
134
|
-
* where the varint is _assured_ to be 32-bits. If in doubt, use `decode()`.
|
|
135
|
-
*
|
|
136
|
-
* To know how many bytes the Varint took to encode, simply negate `offset`
|
|
137
|
-
* from the returned new `offset`.
|
|
138
|
-
*
|
|
139
|
-
* @param buf The buffer to decode from.
|
|
140
|
-
* @param offset The offset to start decoding from.
|
|
141
|
-
* @returns A tuple of the decoded varint 32-bit number, and the new offset.
|
|
142
|
-
*
|
|
143
|
-
* @example Usage
|
|
144
|
-
* ```ts
|
|
145
|
-
* import { decodeVarint32 } from "@std/encoding/varint";
|
|
146
|
-
* import { assertEquals } from "@std/assert";
|
|
147
|
-
*
|
|
148
|
-
* const buf = new Uint8Array([0x8E, 0x02]);
|
|
149
|
-
* assertEquals(decodeVarint32(buf), [270, 2]);
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
export function decodeVarint32(buf, offset = 0) {
|
|
153
|
-
let shift = 0;
|
|
154
|
-
let decoded = 0;
|
|
155
|
-
for (let i = offset; i <= Math.min(buf.length, offset + MaxVarintLen32); i += 1, shift += SHIFT) {
|
|
156
|
-
const byte = buf[i];
|
|
157
|
-
decoded += (byte & REST) * Math.pow(2, shift);
|
|
158
|
-
if (!(byte & MSB))
|
|
159
|
-
return [decoded, i + 1];
|
|
160
|
-
}
|
|
161
|
-
throw new RangeError("Cannot decode the varint input: Malformed or overflow varint");
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Takes unsigned number `num` and converts it into a Varint encoded
|
|
165
|
-
* `Uint8Array`, returning a tuple consisting of a `Uint8Array` slice of the
|
|
166
|
-
* encoded Varint, and an offset where the Varint encoded bytes end within the
|
|
167
|
-
* `Uint8Array`.
|
|
168
|
-
*
|
|
169
|
-
* If `buf` is not given then a Uint8Array will be created.
|
|
170
|
-
* `offset` defaults to `0`.
|
|
171
|
-
*
|
|
172
|
-
* If passed `buf` then that will be written into, starting at `offset`. The
|
|
173
|
-
* resulting returned `Uint8Array` will be a slice of `buf`. The resulting
|
|
174
|
-
* returned number is effectively `offset + bytesWritten`.
|
|
175
|
-
*
|
|
176
|
-
* @param num The number to encode.
|
|
177
|
-
* @param buf The buffer to write into.
|
|
178
|
-
* @param offset The offset to start writing at.
|
|
179
|
-
* @returns A tuple of the encoded Varint `Uint8Array` and the new offset.
|
|
180
|
-
*
|
|
181
|
-
* @example Usage
|
|
182
|
-
* ```ts
|
|
183
|
-
* import { encodeVarint } from "@std/encoding/varint";
|
|
184
|
-
* import { assertEquals } from "@std/assert";
|
|
185
|
-
*
|
|
186
|
-
* const buf = new Uint8Array(10);
|
|
187
|
-
* assertEquals(encodeVarint(42n, buf), [new Uint8Array([42]), 1]);
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
// deno-lint-ignore deno-style-guide/exported-function-args-maximum
|
|
191
|
-
export function encodeVarint(num, buf = new Uint8Array(MaxVarintLen64), offset = 0) {
|
|
192
|
-
num = BigInt(num);
|
|
193
|
-
if (num < 0n) {
|
|
194
|
-
throw new RangeError(`Cannot encode the input into varint as it should be non-negative integer: received ${num}`);
|
|
195
|
-
}
|
|
196
|
-
if (num > MaxUint64) {
|
|
197
|
-
throw new RangeError(`Cannot encode the input ${num} into varint as it overflows uint64`);
|
|
198
|
-
}
|
|
199
|
-
for (let i = offset; i < buf.length; i += 1) {
|
|
200
|
-
if (num < MSBN) {
|
|
201
|
-
buf[i] = Number(num);
|
|
202
|
-
i += 1;
|
|
203
|
-
return [buf.slice(offset, i), i];
|
|
204
|
-
}
|
|
205
|
-
buf[i] = Number((num & 0xffn) | MSBN);
|
|
206
|
-
num >>= SHIFTN;
|
|
207
|
-
}
|
|
208
|
-
throw new RangeError("Cannot encode the input into varint: the provided buffer is too small");
|
|
209
|
-
}
|
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contains the {@linkcode STATUS_CODE} object which contains standard HTTP
|
|
3
|
-
* status codes and provides several type guards for handling status codes
|
|
4
|
-
* with type safety.
|
|
5
|
-
*
|
|
6
|
-
* @example The status code and status text
|
|
7
|
-
* ```ts
|
|
8
|
-
* import {
|
|
9
|
-
* STATUS_CODE,
|
|
10
|
-
* STATUS_TEXT,
|
|
11
|
-
* } from "@std/http/status";
|
|
12
|
-
*
|
|
13
|
-
* console.log(STATUS_CODE.NotFound); // Returns 404
|
|
14
|
-
* console.log(STATUS_TEXT[STATUS_CODE.NotFound]); // Returns "Not Found"
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @example Checking the status code type
|
|
18
|
-
* ```ts ignore
|
|
19
|
-
* import { isErrorStatus } from "@std/http/status";
|
|
20
|
-
*
|
|
21
|
-
* const res = await fetch("https://example.com/");
|
|
22
|
-
*
|
|
23
|
-
* if (isErrorStatus(res.status)) {
|
|
24
|
-
* // error handling here...
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* await res.body?.cancel();
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @module
|
|
31
|
-
*/
|
|
32
|
-
export declare const STATUS_CODE: {
|
|
33
|
-
/** RFC 7231, 6.2.1 */
|
|
34
|
-
readonly Continue: 100;
|
|
35
|
-
/** RFC 7231, 6.2.2 */
|
|
36
|
-
readonly SwitchingProtocols: 101;
|
|
37
|
-
/** RFC 2518, 10.1 */
|
|
38
|
-
readonly Processing: 102;
|
|
39
|
-
/** RFC 8297 **/
|
|
40
|
-
readonly EarlyHints: 103;
|
|
41
|
-
/** RFC 7231, 6.3.1 */
|
|
42
|
-
readonly OK: 200;
|
|
43
|
-
/** RFC 7231, 6.3.2 */
|
|
44
|
-
readonly Created: 201;
|
|
45
|
-
/** RFC 7231, 6.3.3 */
|
|
46
|
-
readonly Accepted: 202;
|
|
47
|
-
/** RFC 7231, 6.3.4 */
|
|
48
|
-
readonly NonAuthoritativeInfo: 203;
|
|
49
|
-
/** RFC 7231, 6.3.5 */
|
|
50
|
-
readonly NoContent: 204;
|
|
51
|
-
/** RFC 7231, 6.3.6 */
|
|
52
|
-
readonly ResetContent: 205;
|
|
53
|
-
/** RFC 7233, 4.1 */
|
|
54
|
-
readonly PartialContent: 206;
|
|
55
|
-
/** RFC 4918, 11.1 */
|
|
56
|
-
readonly MultiStatus: 207;
|
|
57
|
-
/** RFC 5842, 7.1 */
|
|
58
|
-
readonly AlreadyReported: 208;
|
|
59
|
-
/** RFC 3229, 10.4.1 */
|
|
60
|
-
readonly IMUsed: 226;
|
|
61
|
-
/** RFC 7231, 6.4.1 */
|
|
62
|
-
readonly MultipleChoices: 300;
|
|
63
|
-
/** RFC 7231, 6.4.2 */
|
|
64
|
-
readonly MovedPermanently: 301;
|
|
65
|
-
/** RFC 7231, 6.4.3 */
|
|
66
|
-
readonly Found: 302;
|
|
67
|
-
/** RFC 7231, 6.4.4 */
|
|
68
|
-
readonly SeeOther: 303;
|
|
69
|
-
/** RFC 7232, 4.1 */
|
|
70
|
-
readonly NotModified: 304;
|
|
71
|
-
/** RFC 7231, 6.4.5 */
|
|
72
|
-
readonly UseProxy: 305;
|
|
73
|
-
/** RFC 7231, 6.4.7 */
|
|
74
|
-
readonly TemporaryRedirect: 307;
|
|
75
|
-
/** RFC 7538, 3 */
|
|
76
|
-
readonly PermanentRedirect: 308;
|
|
77
|
-
/** RFC 7231, 6.5.1 */
|
|
78
|
-
readonly BadRequest: 400;
|
|
79
|
-
/** RFC 7235, 3.1 */
|
|
80
|
-
readonly Unauthorized: 401;
|
|
81
|
-
/** RFC 7231, 6.5.2 */
|
|
82
|
-
readonly PaymentRequired: 402;
|
|
83
|
-
/** RFC 7231, 6.5.3 */
|
|
84
|
-
readonly Forbidden: 403;
|
|
85
|
-
/** RFC 7231, 6.5.4 */
|
|
86
|
-
readonly NotFound: 404;
|
|
87
|
-
/** RFC 7231, 6.5.5 */
|
|
88
|
-
readonly MethodNotAllowed: 405;
|
|
89
|
-
/** RFC 7231, 6.5.6 */
|
|
90
|
-
readonly NotAcceptable: 406;
|
|
91
|
-
/** RFC 7235, 3.2 */
|
|
92
|
-
readonly ProxyAuthRequired: 407;
|
|
93
|
-
/** RFC 7231, 6.5.7 */
|
|
94
|
-
readonly RequestTimeout: 408;
|
|
95
|
-
/** RFC 7231, 6.5.8 */
|
|
96
|
-
readonly Conflict: 409;
|
|
97
|
-
/** RFC 7231, 6.5.9 */
|
|
98
|
-
readonly Gone: 410;
|
|
99
|
-
/** RFC 7231, 6.5.10 */
|
|
100
|
-
readonly LengthRequired: 411;
|
|
101
|
-
/** RFC 7232, 4.2 */
|
|
102
|
-
readonly PreconditionFailed: 412;
|
|
103
|
-
/** RFC 7231, 6.5.11 */
|
|
104
|
-
readonly ContentTooLarge: 413;
|
|
105
|
-
/** RFC 7231, 6.5.12 */
|
|
106
|
-
readonly URITooLong: 414;
|
|
107
|
-
/** RFC 7231, 6.5.13 */
|
|
108
|
-
readonly UnsupportedMediaType: 415;
|
|
109
|
-
/** RFC 7233, 4.4 */
|
|
110
|
-
readonly RangeNotSatisfiable: 416;
|
|
111
|
-
/** RFC 7231, 6.5.14 */
|
|
112
|
-
readonly ExpectationFailed: 417;
|
|
113
|
-
/** RFC 7168, 2.3.3 */
|
|
114
|
-
readonly Teapot: 418;
|
|
115
|
-
/** RFC 7540, 9.1.2 */
|
|
116
|
-
readonly MisdirectedRequest: 421;
|
|
117
|
-
/** RFC 4918, 11.2 */
|
|
118
|
-
readonly UnprocessableEntity: 422;
|
|
119
|
-
/** RFC 4918, 11.3 */
|
|
120
|
-
readonly Locked: 423;
|
|
121
|
-
/** RFC 4918, 11.4 */
|
|
122
|
-
readonly FailedDependency: 424;
|
|
123
|
-
/** RFC 8470, 5.2 */
|
|
124
|
-
readonly TooEarly: 425;
|
|
125
|
-
/** RFC 7231, 6.5.15 */
|
|
126
|
-
readonly UpgradeRequired: 426;
|
|
127
|
-
/** RFC 6585, 3 */
|
|
128
|
-
readonly PreconditionRequired: 428;
|
|
129
|
-
/** RFC 6585, 4 */
|
|
130
|
-
readonly TooManyRequests: 429;
|
|
131
|
-
/** RFC 6585, 5 */
|
|
132
|
-
readonly RequestHeaderFieldsTooLarge: 431;
|
|
133
|
-
/** RFC 7725, 3 */
|
|
134
|
-
readonly UnavailableForLegalReasons: 451;
|
|
135
|
-
/** RFC 7231, 6.6.1 */
|
|
136
|
-
readonly InternalServerError: 500;
|
|
137
|
-
/** RFC 7231, 6.6.2 */
|
|
138
|
-
readonly NotImplemented: 501;
|
|
139
|
-
/** RFC 7231, 6.6.3 */
|
|
140
|
-
readonly BadGateway: 502;
|
|
141
|
-
/** RFC 7231, 6.6.4 */
|
|
142
|
-
readonly ServiceUnavailable: 503;
|
|
143
|
-
/** RFC 7231, 6.6.5 */
|
|
144
|
-
readonly GatewayTimeout: 504;
|
|
145
|
-
/** RFC 7231, 6.6.6 */
|
|
146
|
-
readonly HTTPVersionNotSupported: 505;
|
|
147
|
-
/** RFC 2295, 8.1 */
|
|
148
|
-
readonly VariantAlsoNegotiates: 506;
|
|
149
|
-
/** RFC 4918, 11.5 */
|
|
150
|
-
readonly InsufficientStorage: 507;
|
|
151
|
-
/** RFC 5842, 7.2 */
|
|
152
|
-
readonly LoopDetected: 508;
|
|
153
|
-
/** RFC 2774, 7 */
|
|
154
|
-
readonly NotExtended: 510;
|
|
155
|
-
/** RFC 6585, 6 */
|
|
156
|
-
readonly NetworkAuthenticationRequired: 511;
|
|
157
|
-
};
|
|
158
|
-
/** An HTTP status code. */
|
|
159
|
-
export type StatusCode = typeof STATUS_CODE[keyof typeof STATUS_CODE];
|
|
160
|
-
/** A record of all the status codes text. */
|
|
161
|
-
export declare const STATUS_TEXT: {
|
|
162
|
-
readonly 202: "Accepted";
|
|
163
|
-
readonly 208: "Already Reported";
|
|
164
|
-
readonly 502: "Bad Gateway";
|
|
165
|
-
readonly 400: "Bad Request";
|
|
166
|
-
readonly 409: "Conflict";
|
|
167
|
-
readonly 100: "Continue";
|
|
168
|
-
readonly 201: "Created";
|
|
169
|
-
readonly 103: "Early Hints";
|
|
170
|
-
readonly 417: "Expectation Failed";
|
|
171
|
-
readonly 424: "Failed Dependency";
|
|
172
|
-
readonly 403: "Forbidden";
|
|
173
|
-
readonly 302: "Found";
|
|
174
|
-
readonly 504: "Gateway Timeout";
|
|
175
|
-
readonly 410: "Gone";
|
|
176
|
-
readonly 505: "HTTP Version Not Supported";
|
|
177
|
-
readonly 226: "IM Used";
|
|
178
|
-
readonly 507: "Insufficient Storage";
|
|
179
|
-
readonly 500: "Internal Server Error";
|
|
180
|
-
readonly 411: "Length Required";
|
|
181
|
-
readonly 423: "Locked";
|
|
182
|
-
readonly 508: "Loop Detected";
|
|
183
|
-
readonly 405: "Method Not Allowed";
|
|
184
|
-
readonly 421: "Misdirected Request";
|
|
185
|
-
readonly 301: "Moved Permanently";
|
|
186
|
-
readonly 207: "Multi Status";
|
|
187
|
-
readonly 300: "Multiple Choices";
|
|
188
|
-
readonly 511: "Network Authentication Required";
|
|
189
|
-
readonly 204: "No Content";
|
|
190
|
-
readonly 203: "Non Authoritative Info";
|
|
191
|
-
readonly 406: "Not Acceptable";
|
|
192
|
-
readonly 510: "Not Extended";
|
|
193
|
-
readonly 404: "Not Found";
|
|
194
|
-
readonly 501: "Not Implemented";
|
|
195
|
-
readonly 304: "Not Modified";
|
|
196
|
-
readonly 200: "OK";
|
|
197
|
-
readonly 206: "Partial Content";
|
|
198
|
-
readonly 402: "Payment Required";
|
|
199
|
-
readonly 308: "Permanent Redirect";
|
|
200
|
-
readonly 412: "Precondition Failed";
|
|
201
|
-
readonly 428: "Precondition Required";
|
|
202
|
-
readonly 102: "Processing";
|
|
203
|
-
readonly 407: "Proxy Auth Required";
|
|
204
|
-
readonly 413: "Content Too Large";
|
|
205
|
-
readonly 431: "Request Header Fields Too Large";
|
|
206
|
-
readonly 408: "Request Timeout";
|
|
207
|
-
readonly 414: "URI Too Long";
|
|
208
|
-
readonly 416: "Range Not Satisfiable";
|
|
209
|
-
readonly 205: "Reset Content";
|
|
210
|
-
readonly 303: "See Other";
|
|
211
|
-
readonly 503: "Service Unavailable";
|
|
212
|
-
readonly 101: "Switching Protocols";
|
|
213
|
-
readonly 418: "I'm a teapot";
|
|
214
|
-
readonly 307: "Temporary Redirect";
|
|
215
|
-
readonly 425: "Too Early";
|
|
216
|
-
readonly 429: "Too Many Requests";
|
|
217
|
-
readonly 401: "Unauthorized";
|
|
218
|
-
readonly 451: "Unavailable For Legal Reasons";
|
|
219
|
-
readonly 422: "Unprocessable Entity";
|
|
220
|
-
readonly 415: "Unsupported Media Type";
|
|
221
|
-
readonly 426: "Upgrade Required";
|
|
222
|
-
readonly 305: "Use Proxy";
|
|
223
|
-
readonly 506: "Variant Also Negotiates";
|
|
224
|
-
};
|
|
225
|
-
/** An HTTP status text. */
|
|
226
|
-
export type StatusText = typeof STATUS_TEXT[keyof typeof STATUS_TEXT];
|
|
227
|
-
/** An HTTP status that is a informational (1XX). */
|
|
228
|
-
export type InformationalStatus = typeof STATUS_CODE.Continue | typeof STATUS_CODE.SwitchingProtocols | typeof STATUS_CODE.Processing | typeof STATUS_CODE.EarlyHints;
|
|
229
|
-
/** An HTTP status that is a success (2XX). */
|
|
230
|
-
export type SuccessfulStatus = typeof STATUS_CODE.OK | typeof STATUS_CODE.Created | typeof STATUS_CODE.Accepted | typeof STATUS_CODE.NonAuthoritativeInfo | typeof STATUS_CODE.NoContent | typeof STATUS_CODE.ResetContent | typeof STATUS_CODE.PartialContent | typeof STATUS_CODE.MultiStatus | typeof STATUS_CODE.AlreadyReported | typeof STATUS_CODE.IMUsed;
|
|
231
|
-
/** An HTTP status that is a redirect (3XX). */
|
|
232
|
-
export type RedirectStatus = typeof STATUS_CODE.MultipleChoices | typeof STATUS_CODE.MovedPermanently | typeof STATUS_CODE.Found | typeof STATUS_CODE.SeeOther | typeof STATUS_CODE.UseProxy | typeof STATUS_CODE.TemporaryRedirect | typeof STATUS_CODE.PermanentRedirect;
|
|
233
|
-
/** An HTTP status that is a client error (4XX). */
|
|
234
|
-
export type ClientErrorStatus = typeof STATUS_CODE.BadRequest | typeof STATUS_CODE.Unauthorized | typeof STATUS_CODE.PaymentRequired | typeof STATUS_CODE.Forbidden | typeof STATUS_CODE.NotFound | typeof STATUS_CODE.MethodNotAllowed | typeof STATUS_CODE.NotAcceptable | typeof STATUS_CODE.ProxyAuthRequired | typeof STATUS_CODE.RequestTimeout | typeof STATUS_CODE.Conflict | typeof STATUS_CODE.Gone | typeof STATUS_CODE.LengthRequired | typeof STATUS_CODE.PreconditionFailed | typeof STATUS_CODE.ContentTooLarge | typeof STATUS_CODE.URITooLong | typeof STATUS_CODE.UnsupportedMediaType | typeof STATUS_CODE.RangeNotSatisfiable | typeof STATUS_CODE.ExpectationFailed | typeof STATUS_CODE.Teapot | typeof STATUS_CODE.MisdirectedRequest | typeof STATUS_CODE.UnprocessableEntity | typeof STATUS_CODE.Locked | typeof STATUS_CODE.FailedDependency | typeof STATUS_CODE.UpgradeRequired | typeof STATUS_CODE.PreconditionRequired | typeof STATUS_CODE.TooManyRequests | typeof STATUS_CODE.RequestHeaderFieldsTooLarge | typeof STATUS_CODE.UnavailableForLegalReasons;
|
|
235
|
-
/** An HTTP status that is a server error (5XX). */
|
|
236
|
-
export type ServerErrorStatus = typeof STATUS_CODE.InternalServerError | typeof STATUS_CODE.NotImplemented | typeof STATUS_CODE.BadGateway | typeof STATUS_CODE.ServiceUnavailable | typeof STATUS_CODE.GatewayTimeout | typeof STATUS_CODE.HTTPVersionNotSupported | typeof STATUS_CODE.VariantAlsoNegotiates | typeof STATUS_CODE.InsufficientStorage | typeof STATUS_CODE.LoopDetected | typeof STATUS_CODE.NotExtended | typeof STATUS_CODE.NetworkAuthenticationRequired;
|
|
237
|
-
/** An HTTP status that is an error (4XX and 5XX). */
|
|
238
|
-
export type ErrorStatus = ClientErrorStatus | ServerErrorStatus;
|
|
239
|
-
/**
|
|
240
|
-
* Returns whether the provided number is a valid HTTP status code.
|
|
241
|
-
*
|
|
242
|
-
* @example Usage
|
|
243
|
-
* ```ts
|
|
244
|
-
* import { isStatus } from "@std/http/status";
|
|
245
|
-
* import { assert } from "@std/assert";
|
|
246
|
-
*
|
|
247
|
-
* assert(isStatus(404));
|
|
248
|
-
* ```
|
|
249
|
-
*
|
|
250
|
-
* @param status The status to assert against.
|
|
251
|
-
* @returns Whether or not the provided status is a valid status code.
|
|
252
|
-
*/
|
|
253
|
-
export declare function isStatus(status: number): status is StatusCode;
|
|
254
|
-
/**
|
|
255
|
-
* A type guard that determines if the status code is informational.
|
|
256
|
-
*
|
|
257
|
-
* @example Usage
|
|
258
|
-
* ```ts
|
|
259
|
-
* import { isInformationalStatus } from "@std/http/status";
|
|
260
|
-
* import { assert } from "@std/assert";
|
|
261
|
-
*
|
|
262
|
-
* assert(isInformationalStatus(100));
|
|
263
|
-
* ```
|
|
264
|
-
*
|
|
265
|
-
* @param status The status to assert against.
|
|
266
|
-
* @returns Whether or not the provided status is an informational status code.
|
|
267
|
-
*/
|
|
268
|
-
export declare function isInformationalStatus(status: number): status is InformationalStatus;
|
|
269
|
-
/**
|
|
270
|
-
* A type guard that determines if the status code is successful.
|
|
271
|
-
*
|
|
272
|
-
* @example Usage
|
|
273
|
-
* ```ts
|
|
274
|
-
* import { isSuccessfulStatus } from "@std/http/status";
|
|
275
|
-
* import { assert } from "@std/assert";
|
|
276
|
-
*
|
|
277
|
-
* assert(isSuccessfulStatus(200));
|
|
278
|
-
* ```
|
|
279
|
-
*
|
|
280
|
-
* @param status The status to assert against.
|
|
281
|
-
* @returns Whether or not the provided status is a successful status code.
|
|
282
|
-
*/
|
|
283
|
-
export declare function isSuccessfulStatus(status: number): status is SuccessfulStatus;
|
|
284
|
-
/**
|
|
285
|
-
* A type guard that determines if the status code is a redirection.
|
|
286
|
-
*
|
|
287
|
-
* @example Usage
|
|
288
|
-
* ```ts
|
|
289
|
-
* import { isRedirectStatus } from "@std/http/status";
|
|
290
|
-
* import { assert } from "@std/assert";
|
|
291
|
-
*
|
|
292
|
-
* assert(isRedirectStatus(302));
|
|
293
|
-
* ```
|
|
294
|
-
*
|
|
295
|
-
* @param status The status to assert against.
|
|
296
|
-
* @returns Whether or not the provided status is a redirect status code.
|
|
297
|
-
*/
|
|
298
|
-
export declare function isRedirectStatus(status: number): status is RedirectStatus;
|
|
299
|
-
/**
|
|
300
|
-
* A type guard that determines if the status code is a client error.
|
|
301
|
-
*
|
|
302
|
-
* @example Usage
|
|
303
|
-
* ```ts
|
|
304
|
-
* import { isClientErrorStatus } from "@std/http/status";
|
|
305
|
-
* import { assert } from "@std/assert";
|
|
306
|
-
*
|
|
307
|
-
* assert(isClientErrorStatus(404));
|
|
308
|
-
* ```
|
|
309
|
-
*
|
|
310
|
-
* @param status The status to assert against.
|
|
311
|
-
* @returns Whether or not the provided status is a client error status code.
|
|
312
|
-
*/
|
|
313
|
-
export declare function isClientErrorStatus(status: number): status is ClientErrorStatus;
|
|
314
|
-
/**
|
|
315
|
-
* A type guard that determines if the status code is a server error.
|
|
316
|
-
*
|
|
317
|
-
* @example Usage
|
|
318
|
-
* ```ts
|
|
319
|
-
* import { isServerErrorStatus } from "@std/http/status";
|
|
320
|
-
* import { assert } from "@std/assert";
|
|
321
|
-
*
|
|
322
|
-
* assert(isServerErrorStatus(502));
|
|
323
|
-
* ```
|
|
324
|
-
*
|
|
325
|
-
* @param status The status to assert against.
|
|
326
|
-
* @returns Whether or not the provided status is a server error status code.
|
|
327
|
-
*/
|
|
328
|
-
export declare function isServerErrorStatus(status: number): status is ServerErrorStatus;
|
|
329
|
-
/**
|
|
330
|
-
* A type guard that determines if the status code is an error.
|
|
331
|
-
*
|
|
332
|
-
* @example Usage
|
|
333
|
-
* ```ts
|
|
334
|
-
* import { isErrorStatus } from "@std/http/status";
|
|
335
|
-
* import { assert } from "@std/assert";
|
|
336
|
-
*
|
|
337
|
-
* assert(isErrorStatus(502));
|
|
338
|
-
* ```
|
|
339
|
-
*
|
|
340
|
-
* @param status The status to assert against.
|
|
341
|
-
* @returns Whether or not the provided status is an error status code.
|
|
342
|
-
*/
|
|
343
|
-
export declare function isErrorStatus(status: number): status is ErrorStatus;
|