@udibo/oauth2 0.14.1 → 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.
Files changed (411) hide show
  1. package/README.md +45 -24
  2. package/{esm → dist}/adapters/hono/_common.d.ts +5 -5
  3. package/{esm → dist}/adapters/hono/_common.js +1 -1
  4. package/{esm → dist}/adapters/hono/authorization-server.d.ts +6 -7
  5. package/{esm → dist}/adapters/hono/authorization-server.js +0 -1
  6. package/{esm → dist}/adapters/hono/bff/auth-request-store.d.ts +2 -2
  7. package/{esm → dist}/adapters/hono/bff/auth-request-store.js +2 -2
  8. package/{esm → dist}/adapters/hono/bff/bff.d.ts +8 -8
  9. package/{esm → dist}/adapters/hono/bff/bff.js +31 -26
  10. package/{esm → dist}/adapters/hono/bff/cookie-prefix.js +1 -2
  11. package/{esm → dist}/adapters/hono/bff/mod.d.ts +5 -6
  12. package/{esm → dist}/adapters/hono/bff/mod.js +1 -2
  13. package/{esm → dist}/adapters/hono/bff/proxy.js +2 -1
  14. package/{esm → dist}/adapters/hono/bff/session-store.d.ts +2 -2
  15. package/{esm → dist}/adapters/hono/bff/session-store.js +7 -6
  16. package/{esm → dist}/adapters/hono/bff/testing.d.ts +7 -8
  17. package/{esm → dist}/adapters/hono/bff/testing.js +19 -22
  18. package/{esm → dist}/adapters/hono/identity.d.ts +1 -2
  19. package/{esm → dist}/adapters/hono/identity.js +10 -10
  20. package/{esm → dist}/adapters/hono/log.d.ts +0 -1
  21. package/{esm → dist}/adapters/hono/log.js +0 -6
  22. package/{esm → dist}/adapters/hono/resource-server.d.ts +5 -6
  23. package/{esm → dist}/adapters/hono/resource-server.js +0 -1
  24. package/dist/cli/bin.d.ts +2 -0
  25. package/dist/cli/bin.js +3 -0
  26. package/dist/cli/idp/config.d.ts +110 -0
  27. package/dist/cli/idp/config.js +269 -0
  28. package/dist/cli/idp/mod.d.ts +20 -0
  29. package/dist/cli/idp/mod.js +175 -0
  30. package/dist/cli/idp/pages.d.ts +56 -0
  31. package/dist/cli/idp/pages.js +190 -0
  32. package/dist/cli/idp/server.d.ts +93 -0
  33. package/dist/cli/idp/server.js +559 -0
  34. package/dist/cli/keygen.d.ts +13 -0
  35. package/dist/cli/keygen.js +30 -0
  36. package/dist/cli/mod.d.ts +34 -0
  37. package/dist/cli/mod.js +94 -0
  38. package/{esm → dist}/client/_http.d.ts +1 -1
  39. package/{esm → dist}/client/base.d.ts +1 -1
  40. package/{esm → dist}/client/bff-client.d.ts +1 -1
  41. package/{esm → dist}/client/bff-client.js +7 -6
  42. package/{esm → dist}/client/browser-storage.d.ts +1 -1
  43. package/{esm → dist}/client/check.js +1 -1
  44. package/{esm → dist}/client/direct-client.d.ts +6 -6
  45. package/{esm → dist}/client/direct-client.js +11 -13
  46. package/{esm → dist}/client/discovery-cache.d.ts +1 -1
  47. package/{esm → dist}/client/discovery-cache.js +2 -2
  48. package/{esm → dist}/client/events.d.ts +1 -1
  49. package/{esm → dist}/client/mod.d.ts +11 -12
  50. package/{esm → dist}/client/mod.js +1 -1
  51. package/{esm → dist}/errors.d.ts +1 -1
  52. package/{esm → dist}/errors.js +1 -1
  53. package/{esm → dist}/identity/events.d.ts +1 -1
  54. package/{esm → dist}/identity/external/_shared.d.ts +1 -1
  55. package/{esm → dist}/identity/external/_shared.js +1 -2
  56. package/{esm → dist}/identity/external/apple-client-secret.d.ts +1 -1
  57. package/{esm → dist}/identity/external/apple-client-secret.js +6 -7
  58. package/{esm → dist}/identity/external/apple.d.ts +5 -5
  59. package/{esm → dist}/identity/external/apple.js +10 -11
  60. package/{esm → dist}/identity/external/discord.d.ts +3 -3
  61. package/{esm → dist}/identity/external/discord.js +2 -2
  62. package/{esm → dist}/identity/external/flow.d.ts +1 -1
  63. package/{esm → dist}/identity/external/flow.js +2 -2
  64. package/{esm → dist}/identity/external/github.d.ts +3 -3
  65. package/{esm → dist}/identity/external/github.js +12 -17
  66. package/{esm → dist}/identity/external/google.d.ts +5 -5
  67. package/{esm → dist}/identity/external/google.js +2 -2
  68. package/{esm → dist}/identity/external/mod.d.ts +12 -13
  69. package/{esm → dist}/identity/external/mod.js +0 -1
  70. package/{esm → dist}/identity/external/oauth2.d.ts +1 -1
  71. package/{esm → dist}/identity/external/oauth2.js +8 -8
  72. package/{esm → dist}/identity/external/oidc.d.ts +4 -4
  73. package/{esm → dist}/identity/external/oidc.js +9 -8
  74. package/{esm → dist}/identity/hibp.d.ts +1 -1
  75. package/{esm → dist}/identity/hibp.js +1 -1
  76. package/{esm → dist}/identity/lockout.js +1 -2
  77. package/{esm → dist}/identity/mfa/mod.d.ts +4 -5
  78. package/{esm → dist}/identity/mfa/mod.js +1 -2
  79. package/{esm → dist}/identity/mfa/service.d.ts +3 -3
  80. package/{esm → dist}/identity/mfa/service.js +4 -3
  81. package/{esm → dist}/identity/mfa/totp.d.ts +1 -1
  82. package/{esm → dist}/identity/mfa/totp.js +2 -2
  83. package/{esm → dist}/identity/migration.d.ts +2 -3
  84. package/{esm → dist}/identity/migration.js +3 -4
  85. package/{esm → dist}/identity/mod.d.ts +14 -15
  86. package/{esm → dist}/identity/mod.js +0 -1
  87. package/{esm → dist}/identity/otp.d.ts +1 -1
  88. package/{esm → dist}/identity/otp.js +4 -2
  89. package/{esm → dist}/identity/password.js +8 -5
  90. package/{esm → dist}/identity/rate-limit.d.ts +1 -1
  91. package/{esm → dist}/identity/service.d.ts +10 -10
  92. package/{esm → dist}/identity/service.js +17 -18
  93. package/{esm → dist}/identity/session.js +2 -2
  94. package/{esm → dist}/identity/token-flow.js +3 -2
  95. package/{esm → dist}/models/authorization-code.d.ts +3 -3
  96. package/{esm → dist}/models/authorization.d.ts +1 -1
  97. package/{esm → dist}/models/authorization.js +1 -2
  98. package/{esm → dist}/models/device-authorization.d.ts +2 -2
  99. package/{esm → dist}/models/token.d.ts +3 -3
  100. package/{esm → dist}/react/callback.d.ts +1 -1
  101. package/{esm → dist}/react/callback.js +0 -1
  102. package/{esm → dist}/react/components/class-names.d.ts +1 -1
  103. package/{esm → dist}/react/components/class-names.js +3 -2
  104. package/{esm → dist}/react/components/internal.d.ts +2 -2
  105. package/{esm → dist}/react/components/internal.js +5 -11
  106. package/{esm → dist}/react/components/mfa-challenge-form.d.ts +2 -2
  107. package/{esm → dist}/react/components/mfa-challenge-form.js +4 -6
  108. package/{esm → dist}/react/components/mfa-enrollment-form.d.ts +2 -2
  109. package/{esm → dist}/react/components/mfa-enrollment-form.js +2 -6
  110. package/{esm → dist}/react/components/mod.d.ts +20 -21
  111. package/{esm → dist}/react/components/mod.js +1 -2
  112. package/{esm → dist}/react/components/request-password-reset-form.d.ts +2 -2
  113. package/{esm → dist}/react/components/request-password-reset-form.js +1 -3
  114. package/{esm → dist}/react/components/reset-password-form.d.ts +2 -2
  115. package/{esm → dist}/react/components/reset-password-form.js +2 -2
  116. package/{esm → dist}/react/components/sign-in-form.d.ts +2 -2
  117. package/{esm → dist}/react/components/sign-in-form.js +1 -5
  118. package/{esm → dist}/react/components/sign-up-form.d.ts +2 -2
  119. package/{esm → dist}/react/components/sign-up-form.js +4 -10
  120. package/{esm → dist}/react/components/types.d.ts +2 -2
  121. package/{esm → dist}/react/components/use-auth-form.d.ts +3 -3
  122. package/{esm → dist}/react/components/use-auth-form.js +4 -7
  123. package/{esm → dist}/react/components/user-menu.d.ts +2 -2
  124. package/{esm → dist}/react/components/user-menu.js +9 -14
  125. package/{esm → dist}/react/context.d.ts +1 -1
  126. package/{esm → dist}/react/mod.d.ts +6 -7
  127. package/{esm → dist}/react/mod.js +0 -1
  128. package/{esm → dist}/react/provider.d.ts +2 -2
  129. package/{esm → dist}/react/require-auth.js +1 -3
  130. package/{esm → dist}/react/testing.d.ts +2 -3
  131. package/{esm → dist}/react/testing.js +1 -2
  132. package/{esm → dist}/react/use-authorization.d.ts +1 -1
  133. package/{esm → dist}/react/use-oauth2.d.ts +8 -1
  134. package/{esm → dist}/react/use-oauth2.js +0 -1
  135. package/{esm → dist}/server/_clock-skew.js +2 -1
  136. package/{esm → dist}/server/authorization-server.d.ts +40 -41
  137. package/{esm → dist}/server/authorization-server.js +32 -42
  138. package/{esm → dist}/server/client-authentication.d.ts +2 -2
  139. package/{esm → dist}/server/grants/authorization-code.d.ts +9 -9
  140. package/{esm → dist}/server/grants/authorization-code.js +5 -6
  141. package/{esm → dist}/server/grants/client-credentials.d.ts +4 -4
  142. package/{esm → dist}/server/grants/device-authorization.d.ts +6 -6
  143. package/{esm → dist}/server/grants/device-authorization.js +4 -4
  144. package/{esm → dist}/server/grants/grant.d.ts +7 -7
  145. package/{esm → dist}/server/grants/grant.js +7 -7
  146. package/{esm → dist}/server/grants/password.d.ts +5 -5
  147. package/{esm → dist}/server/grants/refresh-token.d.ts +4 -4
  148. package/{esm → dist}/server/grants/refresh-token.js +5 -6
  149. package/{esm → dist}/server/introspection-token-reader.d.ts +5 -5
  150. package/{esm → dist}/server/introspection-token-reader.js +4 -4
  151. package/{esm → dist}/server/jwks-token-reader.d.ts +5 -5
  152. package/{esm → dist}/server/jwks-token-reader.js +4 -4
  153. package/{esm → dist}/server/mod.d.ts +12 -13
  154. package/{esm → dist}/server/mod.js +0 -1
  155. package/{esm → dist}/server/public-suffix/mod.d.ts +2 -3
  156. package/{esm → dist}/server/public-suffix/mod.js +1 -2
  157. package/{esm → dist}/server/public-suffix/rules.d.ts +1 -1
  158. package/{esm → dist}/server/public-suffix/rules.js +1 -1
  159. package/{esm → dist}/server/redirect-uri.js +5 -4
  160. package/{esm → dist}/server/resource-server.d.ts +11 -12
  161. package/{esm → dist}/server/resource-server.js +12 -14
  162. package/{esm → dist}/server/services/authorization-code.d.ts +5 -5
  163. package/{esm → dist}/server/services/client.d.ts +1 -1
  164. package/{esm → dist}/server/services/device-authorization.d.ts +3 -3
  165. package/{esm → dist}/server/services/token.d.ts +6 -6
  166. package/{esm → dist}/server/services/token.js +3 -1
  167. package/{esm → dist}/server/services/user.d.ts +1 -1
  168. package/{esm → dist}/server/signing-keys.d.ts +1 -1
  169. package/{esm → dist}/server/signing-keys.js +8 -2
  170. package/{esm → dist}/server/utils/hash.js +1 -1
  171. package/{esm → dist}/testing/contract/auth-request-storage.d.ts +1 -1
  172. package/{esm → dist}/testing/contract/auth-request-storage.js +24 -29
  173. package/{esm → dist}/testing/contract/authorization-code.d.ts +6 -6
  174. package/{esm → dist}/testing/contract/authorization-code.js +16 -17
  175. package/{esm → dist}/testing/contract/client.d.ts +4 -4
  176. package/{esm → dist}/testing/contract/client.js +14 -15
  177. package/{esm → dist}/testing/contract/device-authorization.d.ts +6 -6
  178. package/{esm → dist}/testing/contract/device-authorization.js +37 -39
  179. package/{esm → dist}/testing/contract/identity-session.d.ts +6 -1
  180. package/{esm → dist}/testing/contract/identity-session.js +44 -36
  181. package/{esm → dist}/testing/contract/identity-user-store.d.ts +8 -2
  182. package/{esm → dist}/testing/contract/identity-user-store.js +48 -46
  183. package/{esm → dist}/testing/contract/lockout-store.d.ts +1 -1
  184. package/{esm → dist}/testing/contract/lockout-store.js +23 -24
  185. package/{esm → dist}/testing/contract/mfa-store.d.ts +1 -1
  186. package/{esm → dist}/testing/contract/mfa-store.js +53 -54
  187. package/{esm → dist}/testing/contract/mod.d.ts +15 -16
  188. package/{esm → dist}/testing/contract/mod.js +0 -1
  189. package/{esm → dist}/testing/contract/otp-store.d.ts +1 -1
  190. package/{esm → dist}/testing/contract/otp-store.js +33 -34
  191. package/{esm → dist}/testing/contract/rate-limit-store.d.ts +1 -1
  192. package/{esm → dist}/testing/contract/rate-limit-store.js +15 -16
  193. package/{esm → dist}/testing/contract/tenant.js +361 -330
  194. package/{esm → dist}/testing/contract/token-flow-store.d.ts +1 -1
  195. package/{esm → dist}/testing/contract/token-flow-store.js +27 -32
  196. package/{esm → dist}/testing/contract/token-reader.d.ts +3 -3
  197. package/{esm → dist}/testing/contract/token-reader.js +6 -7
  198. package/{esm → dist}/testing/contract/token.d.ts +7 -7
  199. package/{esm → dist}/testing/contract/token.js +48 -53
  200. package/{esm → dist}/testing/contract/user.d.ts +2 -2
  201. package/{esm → dist}/testing/contract/user.js +8 -9
  202. package/{esm → dist}/testing/mod.d.ts +5 -6
  203. package/{esm → dist}/testing/mod.js +2 -3
  204. package/{esm → dist}/testing/server.d.ts +7 -6
  205. package/{esm → dist}/testing/server.js +2 -1
  206. package/{esm → dist}/testing/services.d.ts +11 -11
  207. package/{esm → dist}/testing/services.js +8 -8
  208. package/{esm → dist}/testing/tenant.d.ts +11 -7
  209. package/{esm → dist}/testing/tenant.js +109 -94
  210. package/dist/utils/_constant-time.d.ts +12 -0
  211. package/dist/utils/_constant-time.js +19 -0
  212. package/{esm → dist}/utils/_default-fetch.js +4 -1
  213. package/dist/utils/_delay.d.ts +13 -0
  214. package/dist/utils/_delay.js +28 -0
  215. package/dist/utils/_encoding.d.ts +39 -0
  216. package/dist/utils/_encoding.js +126 -0
  217. package/{esm → dist}/utils/authentication-context.d.ts +1 -1
  218. package/{esm → dist}/utils/crypto.d.ts +2 -3
  219. package/{esm → dist}/utils/crypto.js +3 -4
  220. package/{esm → dist}/utils/pkce.js +1 -1
  221. package/{esm → dist}/utils/text.js +1 -1
  222. package/{esm → dist}/utils/url.d.ts +0 -1
  223. package/{esm → dist}/utils/url.js +0 -1
  224. package/package.json +156 -33
  225. package/esm/_dnt.polyfills.d.ts +0 -31
  226. package/esm/_dnt.polyfills.js +0 -26
  227. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +0 -29
  228. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +0 -47
  229. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +0 -28
  230. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +0 -65
  231. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +0 -16
  232. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +0 -23
  233. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +0 -25
  234. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +0 -30
  235. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +0 -24
  236. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +0 -193
  237. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +0 -36
  238. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +0 -61
  239. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +0 -17
  240. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +0 -27
  241. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +0 -14
  242. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +0 -20
  243. package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +0 -18
  244. package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +0 -23
  245. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +0 -19
  246. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +0 -29
  247. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +0 -19
  248. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +0 -29
  249. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +0 -22
  250. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +0 -52
  251. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +0 -24
  252. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +0 -53
  253. package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +0 -18
  254. package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +0 -28
  255. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +0 -19
  256. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +0 -29
  257. package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +0 -17
  258. package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +0 -26
  259. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +0 -43
  260. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +0 -45
  261. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +0 -26
  262. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +0 -39
  263. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +0 -19
  264. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +0 -29
  265. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +0 -17
  266. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +0 -26
  267. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +0 -22
  268. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +0 -32
  269. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +0 -28
  270. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +0 -177
  271. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +0 -41
  272. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +0 -53
  273. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +0 -23
  274. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +0 -58
  275. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +0 -17
  276. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +0 -26
  277. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +0 -44
  278. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +0 -44
  279. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +0 -14
  280. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +0 -20
  281. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +0 -14
  282. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +0 -20
  283. package/esm/deps/jsr.io/@std/async/1.5.0/delay.d.ts +0 -44
  284. package/esm/deps/jsr.io/@std/async/1.5.0/delay.js +0 -84
  285. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +0 -39
  286. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +0 -61
  287. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.d.ts +0 -22
  288. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.js +0 -51
  289. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.d.ts +0 -34
  290. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.js +0 -192
  291. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.d.ts +0 -34
  292. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.js +0 -113
  293. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.d.ts +0 -3
  294. package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.js +0 -13
  295. package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.d.ts +0 -8
  296. package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.js +0 -2
  297. package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.d.ts +0 -1
  298. package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.js +0 -26
  299. package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.d.ts +0 -60
  300. package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.js +0 -152
  301. package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.d.ts +0 -39
  302. package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.js +0 -87
  303. package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.d.ts +0 -39
  304. package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.js +0 -131
  305. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.d.ts +0 -39
  306. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.js +0 -82
  307. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.d.ts +0 -39
  308. package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.js +0 -72
  309. package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.d.ts +0 -38
  310. package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.js +0 -87
  311. package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.d.ts +0 -97
  312. package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.js +0 -99
  313. package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.d.ts +0 -119
  314. package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.js +0 -209
  315. package/esm/deps/jsr.io/@std/http/1.1.3/status.d.ts +0 -343
  316. package/esm/deps/jsr.io/@std/http/1.1.3/status.js +0 -343
  317. package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.d.ts +0 -159
  318. package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.js +0 -223
  319. package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.d.ts +0 -79
  320. package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.js +0 -116
  321. package/esm/deps/jsr.io/@std/internal/1.0.14/diff.d.ts +0 -139
  322. package/esm/deps/jsr.io/@std/internal/1.0.14/diff.js +0 -277
  323. package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.d.ts +0 -98
  324. package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.js +0 -181
  325. package/esm/deps/jsr.io/@std/internal/1.0.14/format.d.ts +0 -29
  326. package/esm/deps/jsr.io/@std/internal/1.0.14/format.js +0 -68
  327. package/esm/deps/jsr.io/@std/internal/1.0.14/styles.d.ts +0 -158
  328. package/esm/deps/jsr.io/@std/internal/1.0.14/styles.js +0 -206
  329. package/esm/deps/jsr.io/@std/internal/1.0.14/types.d.ts +0 -24
  330. package/esm/deps/jsr.io/@std/internal/1.0.14/types.js +0 -3
  331. package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.d.ts +0 -91
  332. package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.js +0 -347
  333. package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.d.ts +0 -382
  334. package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.js +0 -1110
  335. package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.d.ts +0 -363
  336. package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.js +0 -616
  337. package/esm/package.json +0 -3
  338. /package/{esm → dist}/adapters/hono/bff/cookie-prefix.d.ts +0 -0
  339. /package/{esm → dist}/adapters/hono/bff/proxy.d.ts +0 -0
  340. /package/{esm → dist}/client/_http.js +0 -0
  341. /package/{esm → dist}/client/base.js +0 -0
  342. /package/{esm → dist}/client/browser-storage.js +0 -0
  343. /package/{esm → dist}/client/check.d.ts +0 -0
  344. /package/{esm → dist}/client/events.js +0 -0
  345. /package/{esm → dist}/client/storage.d.ts +0 -0
  346. /package/{esm → dist}/client/storage.js +0 -0
  347. /package/{esm → dist}/identity/captcha.d.ts +0 -0
  348. /package/{esm → dist}/identity/captcha.js +0 -0
  349. /package/{esm → dist}/identity/delivery.d.ts +0 -0
  350. /package/{esm → dist}/identity/delivery.js +0 -0
  351. /package/{esm → dist}/identity/errors.d.ts +0 -0
  352. /package/{esm → dist}/identity/errors.js +0 -0
  353. /package/{esm → dist}/identity/events.js +0 -0
  354. /package/{esm → dist}/identity/external/_token-exchange.d.ts +0 -0
  355. /package/{esm → dist}/identity/external/_token-exchange.js +0 -0
  356. /package/{esm → dist}/identity/external/errors.d.ts +0 -0
  357. /package/{esm → dist}/identity/external/errors.js +0 -0
  358. /package/{esm → dist}/identity/external/provider.d.ts +0 -0
  359. /package/{esm → dist}/identity/external/provider.js +0 -0
  360. /package/{esm → dist}/identity/identifier.d.ts +0 -0
  361. /package/{esm → dist}/identity/identifier.js +0 -0
  362. /package/{esm → dist}/identity/lockout.d.ts +0 -0
  363. /package/{esm → dist}/identity/mfa/recovery-codes.d.ts +0 -0
  364. /package/{esm → dist}/identity/mfa/recovery-codes.js +0 -0
  365. /package/{esm → dist}/identity/password-policy.d.ts +0 -0
  366. /package/{esm → dist}/identity/password-policy.js +0 -0
  367. /package/{esm → dist}/identity/password.d.ts +0 -0
  368. /package/{esm → dist}/identity/rate-limit.js +0 -0
  369. /package/{esm → dist}/identity/session.d.ts +0 -0
  370. /package/{esm → dist}/identity/token-flow.d.ts +0 -0
  371. /package/{esm → dist}/models/authentication.d.ts +0 -0
  372. /package/{esm → dist}/models/authentication.js +0 -0
  373. /package/{esm → dist}/models/authorization-code.js +0 -0
  374. /package/{esm → dist}/models/client.d.ts +0 -0
  375. /package/{esm → dist}/models/client.js +0 -0
  376. /package/{esm → dist}/models/device-authorization.js +0 -0
  377. /package/{esm → dist}/models/responses.d.ts +0 -0
  378. /package/{esm → dist}/models/responses.js +0 -0
  379. /package/{esm → dist}/models/scope.d.ts +0 -0
  380. /package/{esm → dist}/models/scope.js +0 -0
  381. /package/{esm → dist}/models/token.js +0 -0
  382. /package/{esm → dist}/react/components/types.js +0 -0
  383. /package/{esm → dist}/react/context.js +0 -0
  384. /package/{esm → dist}/react/provider.js +0 -0
  385. /package/{esm → dist}/react/require-auth.d.ts +0 -0
  386. /package/{esm → dist}/react/use-authorization.js +0 -0
  387. /package/{esm → dist}/server/_clock-skew.d.ts +0 -0
  388. /package/{esm → dist}/server/client-authentication.js +0 -0
  389. /package/{esm → dist}/server/grants/client-credentials.js +0 -0
  390. /package/{esm → dist}/server/grants/password.js +0 -0
  391. /package/{esm → dist}/server/redirect-uri.d.ts +0 -0
  392. /package/{esm → dist}/server/services/authorization-code.js +0 -0
  393. /package/{esm → dist}/server/services/client.js +0 -0
  394. /package/{esm → dist}/server/services/device-authorization.js +0 -0
  395. /package/{esm → dist}/server/services/user.js +0 -0
  396. /package/{esm → dist}/server/utils/hash.d.ts +0 -0
  397. /package/{esm → dist}/testing/contract/_race.d.ts +0 -0
  398. /package/{esm → dist}/testing/contract/_race.js +0 -0
  399. /package/{esm → dist}/testing/contract/tenant.d.ts +0 -0
  400. /package/{esm → dist}/utils/_body.d.ts +0 -0
  401. /package/{esm → dist}/utils/_body.js +0 -0
  402. /package/{esm → dist}/utils/_buffer.d.ts +0 -0
  403. /package/{esm → dist}/utils/_buffer.js +0 -0
  404. /package/{esm → dist}/utils/_default-fetch.d.ts +0 -0
  405. /package/{esm → dist}/utils/_timing-safe.d.ts +0 -0
  406. /package/{esm → dist}/utils/_timing-safe.js +0 -0
  407. /package/{esm → dist}/utils/authentication-context.js +0 -0
  408. /package/{esm → dist}/utils/basic-auth.d.ts +0 -0
  409. /package/{esm → dist}/utils/basic-auth.js +0 -0
  410. /package/{esm → dist}/utils/pkce.d.ts +0 -0
  411. /package/{esm → dist}/utils/text.d.ts +0 -0
@@ -1,47 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- import { AssertionError } from "./assertion_error.js";
4
- /**
5
- * Make an assertion that `actual` and `expected` are almost equal numbers
6
- * through a given tolerance. It can be used to take into account IEEE-754
7
- * double-precision floating-point representation limitations. If the values
8
- * are not almost equal then throw.
9
- *
10
- * The default tolerance is one hundred thousandth of a percent of the
11
- * expected value.
12
- *
13
- * @example Usage
14
- * ```ts ignore
15
- * import { assertAlmostEquals } from "@std/assert";
16
- *
17
- * assertAlmostEquals(0.01, 0.02); // Throws
18
- * assertAlmostEquals(1e-8, 1e-9); // Throws
19
- * assertAlmostEquals(1.000000001e-8, 1.000000002e-8); // Doesn't throw
20
- * assertAlmostEquals(0.01, 0.02, 0.1); // Doesn't throw
21
- * assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16); // Doesn't throw
22
- * assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17); // Throws
23
- * ```
24
- *
25
- * @param actual The actual value to compare.
26
- * @param expected The expected value to compare.
27
- * @param tolerance The tolerance to consider the values almost equal. The
28
- * default is one hundred thousandth of a percent of the expected value.
29
- * @param msg The optional message to include in the error.
30
- * @throws {AssertionError} If the values are not almost equal.
31
- */
32
- export function assertAlmostEquals(actual, expected, tolerance, msg) {
33
- if (Object.is(actual, expected)) {
34
- return;
35
- }
36
- const delta = Math.abs(expected - actual);
37
- if (tolerance === undefined) {
38
- tolerance = isFinite(expected) ? Math.abs(expected * 1e-7) : 1e-7;
39
- }
40
- if (delta <= tolerance) {
41
- return;
42
- }
43
- const msgSuffix = msg ? `: ${msg}` : ".";
44
- const f = (n) => Number.isInteger(n) ? n : n.toExponential();
45
- throw new AssertionError(`Expected actual: "${f(actual)}" to be close to "${f(expected)}": \
46
- delta "${f(delta)}" is greater than "${f(tolerance)}"${msgSuffix}`);
47
- }
@@ -1,28 +0,0 @@
1
- /** An array-like object (`Array`, `Uint8Array`, `NodeList`, etc.) that is not a string */
2
- export type ArrayLikeArg<T> = ArrayLike<T> & object;
3
- /**
4
- * Asserts that `actual` contains all values in `expected`, using deep equality
5
- * for non-primitive values.
6
- *
7
- * @example Usage with primitives
8
- * ```ts ignore
9
- * import { assertArrayIncludes } from "@std/assert";
10
- *
11
- * assertArrayIncludes([1, 2, 3], [2, 3]); // Passes
12
- * assertArrayIncludes([1, 2, 3], [4]); // Throws
13
- * ```
14
- *
15
- * @example Usage with objects (deep equality)
16
- * ```ts ignore
17
- * import { assertArrayIncludes } from "@std/assert";
18
- *
19
- * assertArrayIncludes([{ a: 1 }, { b: 2 }], [{ a: 1 }]); // Passes
20
- * ```
21
- *
22
- * @typeParam T The element type of the arrays.
23
- * @param actual The array-like object to search within.
24
- * @param expected The values that must be present in `actual`.
25
- * @param msg Optional message to display on failure.
26
- * @throws {AssertionError} If any value in `expected` is not found in `actual`.
27
- */
28
- export declare function assertArrayIncludes<T>(actual: ArrayLikeArg<T>, expected: ArrayLikeArg<T>, msg?: string): void;
@@ -1,65 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- import { equal } from "./equal.js";
4
- import { format } from "../../internal/1.0.14/format.js";
5
- import { AssertionError } from "./assertion_error.js";
6
- function isPrimitive(value) {
7
- return value === null ||
8
- typeof value !== "object" && typeof value !== "function";
9
- }
10
- /**
11
- * Asserts that `actual` contains all values in `expected`, using deep equality
12
- * for non-primitive values.
13
- *
14
- * @example Usage with primitives
15
- * ```ts ignore
16
- * import { assertArrayIncludes } from "@std/assert";
17
- *
18
- * assertArrayIncludes([1, 2, 3], [2, 3]); // Passes
19
- * assertArrayIncludes([1, 2, 3], [4]); // Throws
20
- * ```
21
- *
22
- * @example Usage with objects (deep equality)
23
- * ```ts ignore
24
- * import { assertArrayIncludes } from "@std/assert";
25
- *
26
- * assertArrayIncludes([{ a: 1 }, { b: 2 }], [{ a: 1 }]); // Passes
27
- * ```
28
- *
29
- * @typeParam T The element type of the arrays.
30
- * @param actual The array-like object to search within.
31
- * @param expected The values that must be present in `actual`.
32
- * @param msg Optional message to display on failure.
33
- * @throws {AssertionError} If any value in `expected` is not found in `actual`.
34
- */
35
- export function assertArrayIncludes(actual, expected, msg) {
36
- const missing = [];
37
- const expectedLen = expected.length;
38
- const actualLen = actual.length;
39
- for (let i = 0; i < expectedLen; i++) {
40
- const item = expected[i];
41
- let found;
42
- if (isPrimitive(item)) {
43
- // Fast path
44
- found = Array.prototype.includes.call(actual, item);
45
- }
46
- else {
47
- found = false;
48
- for (let j = 0; j < actualLen; j++) {
49
- if (equal(item, actual[j])) {
50
- found = true;
51
- break;
52
- }
53
- }
54
- }
55
- if (!found) {
56
- missing.push(item);
57
- }
58
- }
59
- if (missing.length === 0) {
60
- return;
61
- }
62
- const msgSuffix = msg ? `: ${msg}` : ".";
63
- msg = `Expected actual: "${format(actual)}" to include: "${format(expected)}"${msgSuffix}\nmissing: ${format(missing)}`;
64
- throw new AssertionError(msg);
65
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Make an assertion, an error will be thrown if `expr` does not have a truthy value.
3
- *
4
- * @example Usage
5
- * ```ts ignore
6
- * import { assert } from "@std/assert";
7
- *
8
- * assert("hello".includes("ello")); // Doesn't throw
9
- * assert("hello".includes("world")); // Throws
10
- * ```
11
- *
12
- * @param expr The expression to test.
13
- * @param msg The optional message to display if the assertion fails.
14
- * @throws {AssertionError} If `expr` is falsy.
15
- */
16
- export declare function assert(expr: unknown, msg?: string): asserts expr;
@@ -1,23 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- import { AssertionError } from "./assertion_error.js";
4
- /**
5
- * Make an assertion, an error will be thrown if `expr` does not have a truthy value.
6
- *
7
- * @example Usage
8
- * ```ts ignore
9
- * import { assert } from "@std/assert";
10
- *
11
- * assert("hello".includes("ello")); // Doesn't throw
12
- * assert("hello".includes("world")); // Throws
13
- * ```
14
- *
15
- * @param expr The expression to test.
16
- * @param msg The optional message to display if the assertion fails.
17
- * @throws {AssertionError} If `expr` is falsy.
18
- */
19
- export function assert(expr, msg = "") {
20
- if (!expr) {
21
- throw new AssertionError(msg);
22
- }
23
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * Error thrown when an assertion fails.
3
- *
4
- * @example Usage
5
- * ```ts ignore
6
- * import { AssertionError } from "@std/assert";
7
- *
8
- * try {
9
- * throw new AssertionError("foo", { cause: "bar" });
10
- * } catch (error) {
11
- * if (error instanceof AssertionError) {
12
- * error.message === "foo"; // true
13
- * error.cause === "bar"; // true
14
- * }
15
- * }
16
- * ```
17
- */
18
- export declare class AssertionError extends Error {
19
- /** Constructs a new instance.
20
- *
21
- * @param message The error message.
22
- * @param options Additional options. This argument is still unstable. It may change in the future release.
23
- */
24
- constructor(message: string, options?: ErrorOptions);
25
- }
@@ -1,30 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- /**
4
- * Error thrown when an assertion fails.
5
- *
6
- * @example Usage
7
- * ```ts ignore
8
- * import { AssertionError } from "@std/assert";
9
- *
10
- * try {
11
- * throw new AssertionError("foo", { cause: "bar" });
12
- * } catch (error) {
13
- * if (error instanceof AssertionError) {
14
- * error.message === "foo"; // true
15
- * error.cause === "bar"; // true
16
- * }
17
- * }
18
- * ```
19
- */
20
- export class AssertionError extends Error {
21
- /** Constructs a new instance.
22
- *
23
- * @param message The error message.
24
- * @param options Additional options. This argument is still unstable. It may change in the future release.
25
- */
26
- constructor(message, options) {
27
- super(message, options);
28
- this.name = "AssertionError";
29
- }
30
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Deep equality comparison used in assertions.
3
- *
4
- * This function is based on value equality, but for some cases (such as data
5
- * that can only be read asynchronously or function properties) value equality
6
- * is not possible to determine. In such cases, reference equality is used
7
- * instead, which may cause false negatives for objects such as `Blob`s or
8
- * `Request`s.
9
- *
10
- * @param a The actual value
11
- * @param b The expected value
12
- * @returns `true` if the values are deeply equal, `false` otherwise
13
- *
14
- * @throws {TypeError} If either value is a `WeakMap` or `WeakSet`.
15
- *
16
- * @example Usage
17
- * ```ts
18
- * import { equal } from "@std/assert/equal";
19
- *
20
- * equal({ foo: "bar" }, { foo: "bar" }); // Returns `true`
21
- * equal({ foo: "bar" }, { foo: "baz" }); // Returns `false`
22
- * ```
23
- */
24
- export declare function equal(a: unknown, b: unknown): boolean;
@@ -1,193 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- function isKeyedCollection(x) {
4
- return x instanceof Set || x instanceof Map;
5
- }
6
- function prototypesEqual(a, b) {
7
- const pa = Object.getPrototypeOf(a);
8
- const pb = Object.getPrototypeOf(b);
9
- return pa === pb ||
10
- pa === Object.prototype && pb === null ||
11
- pa === null && pb === Object.prototype;
12
- }
13
- function isBasicObjectOrArray(obj) {
14
- const proto = Object.getPrototypeOf(obj);
15
- return proto === null || proto === Object.prototype ||
16
- proto === Array.prototype;
17
- }
18
- // Slightly faster than Reflect.ownKeys in V8 as of 12.9.202.13-rusty (2024-10-28)
19
- function ownKeys(obj) {
20
- return [
21
- ...Object.getOwnPropertyNames(obj),
22
- ...Object.getOwnPropertySymbols(obj),
23
- ];
24
- }
25
- function getKeysDeep(obj) {
26
- const keys = new Set();
27
- while (obj !== Object.prototype && obj !== Array.prototype && obj != null) {
28
- for (const key of ownKeys(obj)) {
29
- keys.add(key);
30
- }
31
- obj = Object.getPrototypeOf(obj);
32
- }
33
- return keys;
34
- }
35
- // deno-lint-ignore no-explicit-any
36
- const Temporal = globalThis.Temporal ?? Object.create(null);
37
- /** A non-exhaustive list of prototypes that can be accurately fast-path compared with `String(instance)` */
38
- const stringComparablePrototypes = new Set([
39
- Intl.Locale,
40
- RegExp,
41
- Temporal.Duration,
42
- Temporal.Instant,
43
- Temporal.PlainDate,
44
- Temporal.PlainDateTime,
45
- Temporal.PlainTime,
46
- Temporal.PlainYearMonth,
47
- Temporal.PlainMonthDay,
48
- Temporal.ZonedDateTime,
49
- URL,
50
- URLSearchParams,
51
- ].filter((x) => x != null).map((x) => x.prototype));
52
- function isPrimitive(x) {
53
- return typeof x === "string" ||
54
- typeof x === "number" ||
55
- typeof x === "boolean" ||
56
- typeof x === "bigint" ||
57
- typeof x === "symbol" ||
58
- x == null;
59
- }
60
- const TypedArray = Object.getPrototypeOf(Uint8Array);
61
- function compareTypedArrays(a, b) {
62
- if (a.length !== b.length)
63
- return false;
64
- for (let i = 0; i < b.length; i++) {
65
- if (!sameValueZero(a[i], b[i]))
66
- return false;
67
- }
68
- return true;
69
- }
70
- /** Check both strict equality (`0 == -0`) and `Object.is` (`NaN == NaN`) */
71
- function sameValueZero(a, b) {
72
- return a === b || Object.is(a, b);
73
- }
74
- /**
75
- * Deep equality comparison used in assertions.
76
- *
77
- * This function is based on value equality, but for some cases (such as data
78
- * that can only be read asynchronously or function properties) value equality
79
- * is not possible to determine. In such cases, reference equality is used
80
- * instead, which may cause false negatives for objects such as `Blob`s or
81
- * `Request`s.
82
- *
83
- * @param a The actual value
84
- * @param b The expected value
85
- * @returns `true` if the values are deeply equal, `false` otherwise
86
- *
87
- * @throws {TypeError} If either value is a `WeakMap` or `WeakSet`.
88
- *
89
- * @example Usage
90
- * ```ts
91
- * import { equal } from "@std/assert/equal";
92
- *
93
- * equal({ foo: "bar" }, { foo: "bar" }); // Returns `true`
94
- * equal({ foo: "bar" }, { foo: "baz" }); // Returns `false`
95
- * ```
96
- */
97
- export function equal(a, b) {
98
- const seen = new Map();
99
- return (function compare(a, b) {
100
- if (sameValueZero(a, b))
101
- return true;
102
- if (isPrimitive(a) || isPrimitive(b))
103
- return false;
104
- if (a instanceof Date && b instanceof Date) {
105
- return Object.is(a.getTime(), b.getTime());
106
- }
107
- if (a && typeof a === "object" && b && typeof b === "object") {
108
- if (!prototypesEqual(a, b)) {
109
- return false;
110
- }
111
- if (a instanceof TypedArray) {
112
- return compareTypedArrays(a, b);
113
- }
114
- if (a instanceof ArrayBuffer ||
115
- (globalThis.SharedArrayBuffer && a instanceof SharedArrayBuffer)) {
116
- return compareTypedArrays(new Uint8Array(a), new Uint8Array(b));
117
- }
118
- if (a instanceof WeakMap) {
119
- throw new TypeError("Cannot compare WeakMap instances");
120
- }
121
- if (a instanceof WeakSet) {
122
- throw new TypeError("Cannot compare WeakSet instances");
123
- }
124
- if (a instanceof WeakRef) {
125
- return compare(a.deref(), b.deref());
126
- }
127
- if (seen.get(a) === b) {
128
- return true;
129
- }
130
- if (Object.keys(a).length !== Object.keys(b).length) {
131
- return false;
132
- }
133
- seen.set(a, b);
134
- if (isKeyedCollection(a) && isKeyedCollection(b)) {
135
- if (a.size !== b.size) {
136
- return false;
137
- }
138
- const aKeys = [...a.keys()];
139
- const primitiveKeysFastPath = aKeys.every(isPrimitive);
140
- if (primitiveKeysFastPath) {
141
- if (a instanceof Set) {
142
- return a.symmetricDifference(b).size === 0;
143
- }
144
- for (const key of aKeys) {
145
- if (!b.has(key) ||
146
- !compare(a.get(key), b.get(key))) {
147
- return false;
148
- }
149
- }
150
- return true;
151
- }
152
- let unmatchedEntries = a.size;
153
- for (const [aKey, aValue] of a.entries()) {
154
- for (const [bKey, bValue] of b.entries()) {
155
- /* Given that Map keys can be references, we need
156
- * to ensure that they are also deeply equal */
157
- if (!compare(aKey, bKey))
158
- continue;
159
- if ((aKey === aValue && bKey === bValue) ||
160
- (compare(aValue, bValue))) {
161
- unmatchedEntries--;
162
- break;
163
- }
164
- }
165
- }
166
- return unmatchedEntries === 0;
167
- }
168
- let keys;
169
- if (isBasicObjectOrArray(a)) {
170
- // fast path
171
- keys = ownKeys({ ...a, ...b });
172
- }
173
- else if (stringComparablePrototypes.has(Object.getPrototypeOf(a))) {
174
- // medium path
175
- return String(a) === String(b);
176
- }
177
- else {
178
- // slow path
179
- keys = getKeysDeep(a).union(getKeysDeep(b));
180
- }
181
- for (const key of keys) {
182
- if (!compare(a[key], b[key])) {
183
- return false;
184
- }
185
- if (((key in a) && (!(key in b))) || ((key in b) && (!(key in a)))) {
186
- return false;
187
- }
188
- }
189
- return true;
190
- }
191
- return false;
192
- })(a, b);
193
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Make an assertion that `actual` and `expected` are equal, deeply. If not
3
- * deeply equal, then throw.
4
- *
5
- * Type parameter can be specified to ensure values under comparison have the
6
- * same type.
7
- *
8
- * Note: This function is based on value equality, but for some cases (such as
9
- * data that can only be read asynchronously or function properties) value
10
- * equality is not possible to determine. In such cases, reference equality is
11
- * used instead, which may cause false negatives for objects such as `Blob`s or
12
- * `Request`s.
13
- *
14
- * @example Usage
15
- * ```ts ignore
16
- * import { assertEquals } from "@std/assert";
17
- *
18
- * assertEquals("world", "world"); // Doesn't throw
19
- * assertEquals("hello", "world"); // Throws
20
- * ```
21
- * @example Compare `Blob` objects
22
- * ```ts ignore
23
- * import { assertEquals } from "@std/assert";
24
- *
25
- * const bytes1 = await new Blob(["foo"]).bytes();
26
- * const bytes2 = await new Blob(["foo"]).bytes();
27
- *
28
- * assertEquals(bytes1, bytes2);
29
- * ```
30
- *
31
- * @typeParam T The type of the values to compare. This is usually inferred.
32
- * @param actual The actual value to compare.
33
- * @param expected The expected value to compare.
34
- * @param msg The optional message to display if the assertion fails.
35
- */
36
- export declare function assertEquals<T>(actual: T, expected: T, msg?: string): void;
@@ -1,61 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- import { equal } from "./equal.js";
4
- import { buildMessage } from "../../internal/1.0.14/build_message.js";
5
- import { diff } from "../../internal/1.0.14/diff.js";
6
- import { diffStr } from "../../internal/1.0.14/diff_str.js";
7
- import { format } from "../../internal/1.0.14/format.js";
8
- import { AssertionError } from "./assertion_error.js";
9
- /**
10
- * Make an assertion that `actual` and `expected` are equal, deeply. If not
11
- * deeply equal, then throw.
12
- *
13
- * Type parameter can be specified to ensure values under comparison have the
14
- * same type.
15
- *
16
- * Note: This function is based on value equality, but for some cases (such as
17
- * data that can only be read asynchronously or function properties) value
18
- * equality is not possible to determine. In such cases, reference equality is
19
- * used instead, which may cause false negatives for objects such as `Blob`s or
20
- * `Request`s.
21
- *
22
- * @example Usage
23
- * ```ts ignore
24
- * import { assertEquals } from "@std/assert";
25
- *
26
- * assertEquals("world", "world"); // Doesn't throw
27
- * assertEquals("hello", "world"); // Throws
28
- * ```
29
- * @example Compare `Blob` objects
30
- * ```ts ignore
31
- * import { assertEquals } from "@std/assert";
32
- *
33
- * const bytes1 = await new Blob(["foo"]).bytes();
34
- * const bytes2 = await new Blob(["foo"]).bytes();
35
- *
36
- * assertEquals(bytes1, bytes2);
37
- * ```
38
- *
39
- * @typeParam T The type of the values to compare. This is usually inferred.
40
- * @param actual The actual value to compare.
41
- * @param expected The expected value to compare.
42
- * @param msg The optional message to display if the assertion fails.
43
- */
44
- export function assertEquals(actual, expected, msg) {
45
- if (equal(actual, expected)) {
46
- return;
47
- }
48
- const msgSuffix = msg ? `: ${msg}` : ".";
49
- let message = `Values are not equal${msgSuffix}`;
50
- const actualString = format(actual);
51
- const expectedString = format(expected);
52
- const stringDiff = (typeof actual === "string") &&
53
- (typeof expected === "string");
54
- const diffResult = stringDiff
55
- ? diffStr(actual, expected)
56
- : diff(actualString.split("\n"), expectedString.split("\n"));
57
- const diffMsg = buildMessage(diffResult, { stringDiff }, arguments[3])
58
- .join("\n");
59
- message = `${message}\n${diffMsg}`;
60
- throw new AssertionError(message);
61
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Make an assertion that actual is not null or undefined.
3
- * If not then throw.
4
- *
5
- * @example Usage
6
- * ```ts ignore
7
- * import { assertExists } from "@std/assert";
8
- *
9
- * assertExists("something"); // Doesn't throw
10
- * assertExists(undefined); // Throws
11
- * ```
12
- *
13
- * @typeParam T The type of the actual value.
14
- * @param actual The actual value to check.
15
- * @param msg The optional message to include in the error if the assertion fails.
16
- */
17
- export declare function assertExists<T>(actual: T, msg?: string): asserts actual is NonNullable<T>;
@@ -1,27 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- import { AssertionError } from "./assertion_error.js";
4
- /**
5
- * Make an assertion that actual is not null or undefined.
6
- * If not then throw.
7
- *
8
- * @example Usage
9
- * ```ts ignore
10
- * import { assertExists } from "@std/assert";
11
- *
12
- * assertExists("something"); // Doesn't throw
13
- * assertExists(undefined); // Throws
14
- * ```
15
- *
16
- * @typeParam T The type of the actual value.
17
- * @param actual The actual value to check.
18
- * @param msg The optional message to include in the error if the assertion fails.
19
- */
20
- export function assertExists(actual, msg) {
21
- if (actual === undefined || actual === null) {
22
- const msgSuffix = msg ? `: ${msg}` : ".";
23
- msg =
24
- `Expected actual: "${actual}" to not be null or undefined${msgSuffix}`;
25
- throw new AssertionError(msg);
26
- }
27
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Forcefully throws a failed assertion.
3
- *
4
- * @example Usage
5
- * ```ts ignore
6
- * import { fail } from "@std/assert";
7
- *
8
- * fail("Deliberately failed!"); // Throws
9
- * ```
10
- *
11
- * @param msg Optional message to include in the error.
12
- * @returns Never returns, always throws.
13
- */
14
- export declare function fail(msg?: string): never;
@@ -1,20 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- import { AssertionError } from "./assertion_error.js";
4
- /**
5
- * Forcefully throws a failed assertion.
6
- *
7
- * @example Usage
8
- * ```ts ignore
9
- * import { fail } from "@std/assert";
10
- *
11
- * fail("Deliberately failed!"); // Throws
12
- * ```
13
- *
14
- * @param msg Optional message to include in the error.
15
- * @returns Never returns, always throws.
16
- */
17
- export function fail(msg) {
18
- const msgSuffix = msg ? `: ${msg}` : ".";
19
- throw new AssertionError(`Failed assertion${msgSuffix}`);
20
- }
@@ -1,18 +0,0 @@
1
- /** Assertion condition for {@linkcode assertFalse}. */
2
- export type Falsy = false | 0 | 0n | "" | null | undefined;
3
- /**
4
- * Make an assertion, an error will be thrown if `expr` has a truthy value.
5
- *
6
- * @example Usage
7
- * ```ts ignore
8
- * import { assertFalse } from "@std/assert";
9
- *
10
- * assertFalse(false); // Doesn't throw
11
- * assertFalse(true); // Throws
12
- * ```
13
- *
14
- * @param expr The expression to test.
15
- * @param msg The optional message to display if the assertion fails.
16
- * @throws {AssertionError} If `expr` is truthy.
17
- */
18
- export declare function assertFalse(expr: unknown, msg?: string): asserts expr is Falsy;