@zuplo/cli 7.6.7 → 7.6.9

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 (382) hide show
  1. package/node_modules/@inquirer/ansi/package.json +3 -2
  2. package/node_modules/@inquirer/checkbox/package.json +6 -6
  3. package/node_modules/@inquirer/confirm/package.json +4 -4
  4. package/node_modules/@inquirer/core/package.json +5 -5
  5. package/node_modules/@inquirer/editor/package.json +5 -5
  6. package/node_modules/@inquirer/expand/package.json +4 -4
  7. package/node_modules/@inquirer/external-editor/package.json +2 -2
  8. package/node_modules/@inquirer/figures/package.json +2 -2
  9. package/node_modules/@inquirer/input/package.json +4 -4
  10. package/node_modules/@inquirer/number/package.json +4 -4
  11. package/node_modules/@inquirer/password/package.json +5 -5
  12. package/node_modules/@inquirer/rawlist/package.json +4 -4
  13. package/node_modules/@inquirer/search/package.json +5 -5
  14. package/node_modules/@inquirer/select/package.json +6 -6
  15. package/node_modules/@inquirer/type/package.json +2 -2
  16. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -16
  17. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +6 -17
  18. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -16
  19. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +11 -34
  20. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +7 -16
  21. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +15 -35
  22. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -8
  23. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwk/thumbprint.d.ts +5 -5
  24. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwks/local.d.ts +6 -10
  25. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwks/remote.d.ts +13 -24
  26. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -10
  27. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/compact/verify.d.ts +9 -18
  28. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/flattened/sign.d.ts +7 -16
  29. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/flattened/verify.d.ts +9 -18
  30. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/sign.d.ts +11 -21
  31. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/verify.d.ts +9 -18
  32. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/decrypt.d.ts +10 -20
  33. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +6 -13
  34. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/sign.d.ts +5 -6
  35. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -14
  36. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/verify.d.ts +9 -19
  37. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/export.d.ts +4 -4
  38. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/generate_key_pair.d.ts +6 -8
  39. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/generate_secret.d.ts +4 -11
  40. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/key/import.d.ts +10 -17
  41. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/types.d.ts +44 -84
  42. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/base64url.d.ts +2 -2
  43. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/decode_jwt.d.ts +3 -10
  44. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -4
  45. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/util/errors.d.ts +26 -53
  46. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/index.js +70 -32
  47. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -8
  48. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +42 -48
  49. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -14
  50. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +53 -64
  51. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
  52. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +121 -169
  53. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/embedded.js +30 -32
  54. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/thumbprint.js +54 -70
  55. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/local.js +47 -64
  56. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +88 -136
  57. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/compact/sign.js +21 -21
  58. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
  59. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/sign.js +29 -31
  60. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/verify.js +21 -24
  61. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/sign.js +61 -72
  62. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/verify.js +45 -69
  63. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -20
  64. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/encrypt.js +57 -70
  65. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/sign.js +17 -16
  66. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/unsecured.js +32 -40
  67. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
  68. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/export.js +32 -37
  69. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_key_pair.js +40 -48
  70. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_secret.js +35 -40
  71. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/import.js +52 -56
  72. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/asn1.js +130 -169
  73. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/base64.js +18 -20
  74. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/buffer_utils.js +34 -38
  75. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/content_encryption.js +79 -115
  76. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/crypto_key.js +24 -25
  77. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/deflate.js +45 -47
  78. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/helpers.js +40 -37
  79. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/invalid_key_input.js +10 -24
  80. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -15
  81. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +106 -93
  82. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +207 -230
  83. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +104 -138
  84. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwk_metadata.js +17 -18
  85. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwk_to_key.js +9 -16
  86. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
  87. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_sign.js +50 -75
  88. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_verify.js +80 -125
  89. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +123 -209
  90. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key.js +84 -136
  91. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
  92. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
  93. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_management.js +200 -231
  94. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_options.js +7 -5
  95. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/options.js +55 -68
  96. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/signing.js +18 -22
  97. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/type_checks.js +26 -29
  98. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/base64url.js +26 -35
  99. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
  100. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
  101. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/util/errors.js +94 -84
  102. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +17 -81
  103. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -16
  104. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +6 -17
  105. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -16
  106. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +11 -34
  107. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +7 -16
  108. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +15 -35
  109. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -8
  110. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/thumbprint.d.ts +5 -5
  111. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/local.d.ts +6 -10
  112. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/remote.d.ts +13 -24
  113. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -10
  114. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/verify.d.ts +9 -18
  115. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/sign.d.ts +7 -16
  116. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/verify.d.ts +9 -18
  117. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/sign.d.ts +11 -21
  118. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts +9 -18
  119. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/decrypt.d.ts +10 -20
  120. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +6 -13
  121. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/sign.d.ts +5 -6
  122. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -14
  123. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/verify.d.ts +9 -19
  124. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/export.d.ts +4 -4
  125. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_key_pair.d.ts +6 -8
  126. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_secret.d.ts +4 -11
  127. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/import.d.ts +10 -17
  128. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +44 -84
  129. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/base64url.d.ts +2 -2
  130. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_jwt.d.ts +3 -10
  131. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -4
  132. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/errors.d.ts +26 -53
  133. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/index.js +70 -32
  134. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -8
  135. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +42 -48
  136. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -14
  137. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +53 -64
  138. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
  139. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +121 -169
  140. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/embedded.js +30 -32
  141. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/thumbprint.js +54 -70
  142. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/local.js +47 -64
  143. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +88 -136
  144. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/sign.js +21 -21
  145. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
  146. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/sign.js +29 -31
  147. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/verify.js +21 -24
  148. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/sign.js +61 -72
  149. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +45 -69
  150. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -20
  151. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/encrypt.js +57 -70
  152. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/sign.js +17 -16
  153. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/unsecured.js +32 -40
  154. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
  155. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/export.js +32 -37
  156. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_key_pair.js +40 -48
  157. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_secret.js +35 -40
  158. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/import.js +52 -56
  159. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/asn1.js +130 -169
  160. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/base64.js +18 -20
  161. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/buffer_utils.js +34 -38
  162. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/content_encryption.js +79 -115
  163. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/crypto_key.js +24 -25
  164. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/deflate.js +45 -47
  165. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/helpers.js +40 -37
  166. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/invalid_key_input.js +10 -24
  167. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -15
  168. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +106 -93
  169. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +207 -230
  170. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +104 -138
  171. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_metadata.js +17 -18
  172. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_to_key.js +9 -16
  173. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
  174. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_sign.js +50 -75
  175. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_verify.js +80 -125
  176. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +123 -209
  177. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +84 -136
  178. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
  179. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
  180. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +200 -231
  181. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_options.js +7 -5
  182. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/options.js +55 -68
  183. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/signing.js +18 -22
  184. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/type_checks.js +26 -29
  185. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/base64url.js +26 -35
  186. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
  187. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
  188. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/errors.js +94 -84
  189. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +17 -81
  190. package/node_modules/@posthog/core/dist/cookie.js +17 -13
  191. package/node_modules/@posthog/core/dist/error-tracking/chunk-ids.js +15 -11
  192. package/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.js +12 -8
  193. package/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.js +12 -8
  194. package/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.js +12 -9
  195. package/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs +0 -1
  196. package/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.js +12 -8
  197. package/node_modules/@posthog/core/dist/error-tracking/coercers/index.js +51 -63
  198. package/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.js +12 -8
  199. package/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.js +12 -8
  200. package/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.js +12 -8
  201. package/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.js +15 -11
  202. package/node_modules/@posthog/core/dist/error-tracking/coercers/utils.js +16 -12
  203. package/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.js +12 -8
  204. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.js +18 -14
  205. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.mjs +2 -2
  206. package/node_modules/@posthog/core/dist/error-tracking/index.js +41 -49
  207. package/node_modules/@posthog/core/dist/error-tracking/parsers/base.d.ts.map +1 -1
  208. package/node_modules/@posthog/core/dist/error-tracking/parsers/base.js +13 -9
  209. package/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs +1 -1
  210. package/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.js +12 -8
  211. package/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.js +12 -8
  212. package/node_modules/@posthog/core/dist/error-tracking/parsers/index.js +17 -13
  213. package/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs +4 -4
  214. package/node_modules/@posthog/core/dist/error-tracking/parsers/node.js +12 -8
  215. package/node_modules/@posthog/core/dist/error-tracking/parsers/opera.js +14 -10
  216. package/node_modules/@posthog/core/dist/error-tracking/parsers/safari.js +12 -8
  217. package/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.js +12 -8
  218. package/node_modules/@posthog/core/dist/error-tracking/release.js +15 -11
  219. package/node_modules/@posthog/core/dist/error-tracking/types.js +15 -11
  220. package/node_modules/@posthog/core/dist/error-tracking/utils.js +15 -11
  221. package/node_modules/@posthog/core/dist/eventemitter.js +15 -11
  222. package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.js +18 -14
  223. package/node_modules/@posthog/core/dist/featureFlagLocalEvaluation.mjs +1 -1
  224. package/node_modules/@posthog/core/dist/featureFlagUtils.js +30 -25
  225. package/node_modules/@posthog/core/dist/featureFlagUtils.mjs +2 -2
  226. package/node_modules/@posthog/core/dist/gzip.js +16 -12
  227. package/node_modules/@posthog/core/dist/index.js +302 -310
  228. package/node_modules/@posthog/core/dist/index.mjs +12 -12
  229. package/node_modules/@posthog/core/dist/logs/index.js +13 -9
  230. package/node_modules/@posthog/core/dist/logs/index.mjs +1 -1
  231. package/node_modules/@posthog/core/dist/logs/logs-utils.js +16 -12
  232. package/node_modules/@posthog/core/dist/logs/types.js +2 -2
  233. package/node_modules/@posthog/core/dist/logs/types.mjs +1 -0
  234. package/node_modules/@posthog/core/dist/metrics/config.js +15 -11
  235. package/node_modules/@posthog/core/dist/metrics/index.js +15 -11
  236. package/node_modules/@posthog/core/dist/metrics/index.mjs +2 -2
  237. package/node_modules/@posthog/core/dist/metrics/metrics-utils.js +14 -10
  238. package/node_modules/@posthog/core/dist/metrics/types.js +2 -2
  239. package/node_modules/@posthog/core/dist/metrics/types.mjs +1 -0
  240. package/node_modules/@posthog/core/dist/posthog-core-stateless.js +16 -12
  241. package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +1 -1
  242. package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
  243. package/node_modules/@posthog/core/dist/posthog-core.js +12 -8
  244. package/node_modules/@posthog/core/dist/surveys/activation.js +14 -10
  245. package/node_modules/@posthog/core/dist/surveys/events.js +14 -10
  246. package/node_modules/@posthog/core/dist/surveys/index.js +30 -26
  247. package/node_modules/@posthog/core/dist/surveys/index.mjs +6 -7
  248. package/node_modules/@posthog/core/dist/surveys/keys.js +16 -12
  249. package/node_modules/@posthog/core/dist/surveys/property-matching.js +19 -14
  250. package/node_modules/@posthog/core/dist/surveys/translations.js +16 -12
  251. package/node_modules/@posthog/core/dist/surveys/validation.js +13 -9
  252. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts +3 -3
  253. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts.map +1 -1
  254. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.js +15 -11
  255. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.mjs +3 -3
  256. package/node_modules/@posthog/core/dist/testing/index.js +21 -21
  257. package/node_modules/@posthog/core/dist/testing/test-utils.d.ts.map +1 -1
  258. package/node_modules/@posthog/core/dist/testing/test-utils.js +19 -18
  259. package/node_modules/@posthog/core/dist/testing/test-utils.mjs +7 -10
  260. package/node_modules/@posthog/core/dist/tracing-headers.js +12 -8
  261. package/node_modules/@posthog/core/dist/types.js +31 -26
  262. package/node_modules/@posthog/core/dist/types.mjs +1 -1
  263. package/node_modules/@posthog/core/dist/utils/bot-detection.js +16 -12
  264. package/node_modules/@posthog/core/dist/utils/browser-utils.js +12 -8
  265. package/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.js +14 -10
  266. package/node_modules/@posthog/core/dist/utils/index.js +181 -194
  267. package/node_modules/@posthog/core/dist/utils/index.mjs +3 -3
  268. package/node_modules/@posthog/core/dist/utils/json-utils.js +24 -19
  269. package/node_modules/@posthog/core/dist/utils/logger.js +17 -12
  270. package/node_modules/@posthog/core/dist/utils/number-utils.d.ts.map +1 -1
  271. package/node_modules/@posthog/core/dist/utils/number-utils.js +14 -10
  272. package/node_modules/@posthog/core/dist/utils/number-utils.mjs +1 -1
  273. package/node_modules/@posthog/core/dist/utils/otlp-any-value.js +15 -11
  274. package/node_modules/@posthog/core/dist/utils/otlp-any-value.mjs +1 -1
  275. package/node_modules/@posthog/core/dist/utils/otlp-resource.js +17 -13
  276. package/node_modules/@posthog/core/dist/utils/promise-queue.js +12 -8
  277. package/node_modules/@posthog/core/dist/utils/string-utils.js +21 -16
  278. package/node_modules/@posthog/core/dist/utils/type-utils.js +31 -27
  279. package/node_modules/@posthog/core/dist/utils/type-utils.mjs +2 -2
  280. package/node_modules/@posthog/core/dist/utils/user-agent-utils.js +16 -12
  281. package/node_modules/@posthog/core/dist/vendor/uuidv7.js +22 -17
  282. package/node_modules/@posthog/core/dist/vendor/uuidv7.mjs +1 -1
  283. package/node_modules/@posthog/core/package.json +8 -8
  284. package/node_modules/@posthog/core/src/error-tracking/coercers/promise-rejection-event.spec.ts +4 -4
  285. package/node_modules/@posthog/core/src/error-tracking/error-properties-builder.parse.spec.ts +1 -1
  286. package/node_modules/@posthog/core/src/error-tracking/parsers/base.spec.ts +21 -2
  287. package/node_modules/@posthog/core/src/error-tracking/parsers/base.ts +6 -2
  288. package/node_modules/@posthog/core/src/featureFlagUtils.ts +4 -4
  289. package/node_modules/@posthog/core/src/logs/index.spec.ts +89 -89
  290. package/node_modules/@posthog/core/src/metrics/index.spec.ts +24 -24
  291. package/node_modules/@posthog/core/src/posthog-core.ts +0 -1
  292. package/node_modules/@posthog/core/src/surveys/activation.spec.ts +1 -1
  293. package/node_modules/@posthog/core/src/surveys/events.spec.ts +1 -1
  294. package/node_modules/@posthog/core/src/surveys/keys.spec.ts +1 -1
  295. package/node_modules/@posthog/core/src/surveys/translations.spec.ts +8 -8
  296. package/node_modules/@posthog/core/src/testing/PostHogCoreTestClient.ts +6 -6
  297. package/node_modules/@posthog/core/src/testing/test-utils.ts +7 -12
  298. package/node_modules/@posthog/core/src/utils/bucketed-rate-limiter.spec.ts +13 -13
  299. package/node_modules/@posthog/core/src/utils/json-utils.spec.ts +5 -5
  300. package/node_modules/@posthog/core/src/utils/number-utils.spec.ts +20 -0
  301. package/node_modules/@posthog/core/src/utils/number-utils.ts +3 -1
  302. package/node_modules/@posthog/core/src/utils/otlp-any-value.spec.ts +3 -3
  303. package/node_modules/@posthog/core/src/utils/promise-queue.spec.ts +3 -3
  304. package/node_modules/@posthog/types/dist/capture-log.js +2 -2
  305. package/node_modules/@posthog/types/dist/capture-log.mjs +1 -0
  306. package/node_modules/@posthog/types/dist/capture-metric.js +15 -11
  307. package/node_modules/@posthog/types/dist/capture.js +2 -2
  308. package/node_modules/@posthog/types/dist/capture.mjs +1 -0
  309. package/node_modules/@posthog/types/dist/common.js +2 -2
  310. package/node_modules/@posthog/types/dist/common.mjs +1 -0
  311. package/node_modules/@posthog/types/dist/feature-flags.js +2 -2
  312. package/node_modules/@posthog/types/dist/feature-flags.mjs +1 -0
  313. package/node_modules/@posthog/types/dist/index.js +12 -8
  314. package/node_modules/@posthog/types/dist/index.mjs +1 -2
  315. package/node_modules/@posthog/types/dist/posthog-config.d.ts +19 -0
  316. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  317. package/node_modules/@posthog/types/dist/posthog-config.js +2 -2
  318. package/node_modules/@posthog/types/dist/posthog-config.mjs +1 -0
  319. package/node_modules/@posthog/types/dist/posthog.d.ts +2 -2
  320. package/node_modules/@posthog/types/dist/posthog.d.ts.map +1 -1
  321. package/node_modules/@posthog/types/dist/posthog.js +2 -2
  322. package/node_modules/@posthog/types/dist/posthog.mjs +1 -0
  323. package/node_modules/@posthog/types/dist/request.js +2 -2
  324. package/node_modules/@posthog/types/dist/request.mjs +1 -0
  325. package/node_modules/@posthog/types/dist/segment.js +2 -2
  326. package/node_modules/@posthog/types/dist/segment.mjs +1 -0
  327. package/node_modules/@posthog/types/dist/session-recording.js +2 -2
  328. package/node_modules/@posthog/types/dist/session-recording.mjs +1 -0
  329. package/node_modules/@posthog/types/dist/survey.js +2 -2
  330. package/node_modules/@posthog/types/dist/survey.mjs +1 -0
  331. package/node_modules/@posthog/types/dist/toolbar.js +2 -2
  332. package/node_modules/@posthog/types/dist/toolbar.mjs +1 -0
  333. package/node_modules/@posthog/types/dist/tree-shakeable.js +2 -2
  334. package/node_modules/@posthog/types/dist/tree-shakeable.mjs +1 -0
  335. package/node_modules/@posthog/types/package.json +6 -8
  336. package/node_modules/@posthog/types/src/posthog-config.ts +18 -0
  337. package/node_modules/@posthog/types/src/posthog.ts +2 -2
  338. package/node_modules/@zuplo/core/package.json +1 -1
  339. package/node_modules/@zuplo/graphql/package.json +1 -1
  340. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  341. package/node_modules/@zuplo/otel/package.json +1 -1
  342. package/node_modules/@zuplo/runtime/out/esm/{chunk-ZZCZZHOD.js → chunk-Z3IKCP3N.js} +93 -93
  343. package/node_modules/@zuplo/runtime/out/esm/chunk-Z3IKCP3N.js.map +1 -0
  344. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  345. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  346. package/node_modules/@zuplo/runtime/out/types/index.d.ts +69 -19
  347. package/node_modules/@zuplo/runtime/package.json +1 -1
  348. package/node_modules/fast-copy/README.md +3 -2
  349. package/node_modules/fast-copy/dist/cjs/index.cjs +19 -4
  350. package/node_modules/fast-copy/dist/cjs/index.cjs.map +1 -1
  351. package/node_modules/fast-copy/dist/es/index.mjs +19 -4
  352. package/node_modules/fast-copy/dist/es/index.mjs.map +1 -1
  353. package/node_modules/fast-copy/dist/umd/index.js +19 -4
  354. package/node_modules/fast-copy/dist/umd/index.js.map +1 -1
  355. package/node_modules/fast-copy/package.json +17 -16
  356. package/node_modules/fast-uri/index.js +20 -5
  357. package/node_modules/fast-uri/lib/utils.js +8 -1
  358. package/node_modules/fast-uri/package.json +1 -1
  359. package/node_modules/fast-uri/test/component-safe-serialization.test.js +58 -0
  360. package/node_modules/fast-uri/test/ipv6-validation.test.js +34 -0
  361. package/node_modules/hono/dist/cjs/client/client.js +4 -4
  362. package/node_modules/hono/dist/cjs/hono-base.js +7 -6
  363. package/node_modules/hono/dist/cjs/jsx/base.js +18 -1
  364. package/node_modules/hono/dist/cjs/jsx/components.js +25 -26
  365. package/node_modules/hono/dist/cjs/jsx/context.js +5 -5
  366. package/node_modules/hono/dist/cjs/jsx/dom/server.js +5 -1
  367. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +2 -2
  368. package/node_modules/hono/dist/cjs/jsx/streaming.js +4 -5
  369. package/node_modules/hono/dist/client/client.js +4 -4
  370. package/node_modules/hono/dist/hono-base.js +7 -6
  371. package/node_modules/hono/dist/jsx/base.js +15 -1
  372. package/node_modules/hono/dist/jsx/components.js +26 -27
  373. package/node_modules/hono/dist/jsx/context.js +6 -6
  374. package/node_modules/hono/dist/jsx/dom/server.js +5 -1
  375. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +3 -3
  376. package/node_modules/hono/dist/jsx/streaming.js +5 -6
  377. package/node_modules/hono/dist/types/context.d.ts +2 -2
  378. package/node_modules/hono/dist/types/jsx/base.d.ts +3 -0
  379. package/node_modules/hono/package.json +2 -2
  380. package/package.json +11 -11
  381. package/node_modules/@zuplo/runtime/out/esm/chunk-ZZCZZHOD.js.map +0 -1
  382. /package/node_modules/@zuplo/runtime/out/esm/{chunk-ZZCZZHOD.js.LEGAL.txt → chunk-Z3IKCP3N.js.LEGAL.txt} +0 -0
@@ -1302,7 +1302,14 @@ export declare type AiRequestBody =
1302
1302
  }
1303
1303
  | {
1304
1304
  format: "anthropic-messages";
1305
- body: AnthropicMessagesRequest;
1305
+ /**
1306
+ * `/v1/messages` bodies carry a required `max_tokens`;
1307
+ * `/v1/messages/count_tokens` bodies never do, and both classify as
1308
+ * `anthropic-messages` because they are the same schema dialect. The union
1309
+ * keeps a policy from reading `max_tokens` as if it were always present —
1310
+ * narrow on it (or on `getFormat`'s endpoint) before relying on it.
1311
+ */
1312
+ body: AnthropicMessagesRequest | AnthropicCountTokensRequest;
1306
1313
  };
1307
1314
 
1308
1315
  /**
@@ -1749,6 +1756,19 @@ declare interface AndRule {
1749
1756
  and: [NestedRule, ...NestedRule[]];
1750
1757
  }
1751
1758
 
1759
+ /**
1760
+ * A request to Anthropic's token-counting operation
1761
+ * (`/v1/messages/count_tokens`).
1762
+ *
1763
+ * The request uses the Messages body shape but does not require `max_tokens`.
1764
+ * The index signature preserves evolving Anthropic fields verbatim.
1765
+ */
1766
+ declare interface AnthropicCountTokensRequest {
1767
+ model: string;
1768
+ messages: AnthropicMessage[];
1769
+ [key: string]: unknown;
1770
+ }
1771
+
1752
1772
  declare interface AnthropicMessage {
1753
1773
  role: "user" | "assistant";
1754
1774
  content:
@@ -2439,7 +2459,7 @@ export declare interface Auth0JwtInboundPolicyOptions {
2439
2459
  */
2440
2460
  allowUnauthenticatedRequests?: boolean;
2441
2461
  /**
2442
- * Flag that determines whether OAuth protected resource metadata is enabled.
2462
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
2443
2463
  */
2444
2464
  oAuthResourceMetadataEnabled?: boolean;
2445
2465
  }
@@ -3748,25 +3768,25 @@ declare type ClaimCheck = EqualsRule | InRule | StartsWithRule;
3748
3768
  declare type ClassifierAppAPIKey = string;
3749
3769
 
3750
3770
  /**
3751
- * The AI Gateway application id whose `/v1/chat/completions` route runs the classifier. The policy calls `/{classifierAppID}/v1/chat/completions` via `context.invokeRoute`.
3771
+ * The AI Gateway application id used to run the classifier prompt and evaluate the user's request.
3752
3772
  * @public
3753
3773
  */
3754
3774
  declare type ClassifierAppID = string;
3755
3775
 
3756
3776
  /**
3757
- * The `providerName/model` reference the classifier chat/completions request should use.
3777
+ * The model (`providerName/model`) the classifier uses to evaluate the user's request. E.g. `openai/gpt-4o-mini`.
3758
3778
  * @public
3759
3779
  */
3760
3780
  declare type ClassifierModel = string;
3761
3781
 
3762
3782
  /**
3763
- * System prompt for the classifier. If it includes `{{intents}}`, that placeholder is replaced with the configured intent id/description list. A string or an array of lines (joined with newlines). Omit to use the built-in classifier prompt.
3783
+ * Prompt used to analyze and classify the user message. Omit to use the built-in classifier prompt.
3764
3784
  * @public
3765
3785
  */
3766
3786
  declare type ClassifierPrompt = string | [string, ...string[]];
3767
3787
 
3768
3788
  /**
3769
- * How long to wait for the classifier `invokeRoute` call before skipping classification and forwarding the original request.
3789
+ * Timeout configured for the classifier task. When exceeded, the request is forwarded without classification to the original model.
3770
3790
  * @public
3771
3791
  */
3772
3792
  declare type ClassifierTimeoutMs = number;
@@ -3849,7 +3869,7 @@ export declare interface ClerkJwtInboundPolicyOptions {
3849
3869
  */
3850
3870
  allowUnauthenticatedRequests?: boolean;
3851
3871
  /**
3852
- * Flag that determines whether OAuth protected resource metadata is enabled.
3872
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
3853
3873
  */
3854
3874
  oAuthResourceMetadataEnabled?: boolean;
3855
3875
  }
@@ -3934,7 +3954,7 @@ export declare interface CognitoJwtInboundPolicyOptions {
3934
3954
  */
3935
3955
  allowUnauthenticatedRequests?: boolean;
3936
3956
  /**
3937
- * Flag that determines whether OAuth protected resource metadata is enabled.
3957
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
3938
3958
  */
3939
3959
  oAuthResourceMetadataEnabled?: boolean;
3940
3960
  }
@@ -5462,7 +5482,7 @@ export declare interface FirebaseJwtInboundPolicyOptions {
5462
5482
  */
5463
5483
  allowUnauthenticatedRequests?: boolean;
5464
5484
  /**
5465
- * Flag that determines whether OAuth protected resource metadata is enabled.
5485
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
5466
5486
  */
5467
5487
  oAuthResourceMetadataEnabled?: boolean;
5468
5488
  }
@@ -7843,19 +7863,19 @@ declare interface InRule {
7843
7863
  }
7844
7864
 
7845
7865
  /**
7846
- * Short description shown to the classifier for this intent.
7866
+ * Short description of the intent label.
7847
7867
  * @public
7848
7868
  */
7849
7869
  declare type IntentDescription = string;
7850
7870
 
7851
7871
  /**
7852
- * Stable intent identifier written into the classifier JSON schema enum.
7872
+ * Label used to classify the intent of the user message being evaluated.
7853
7873
  * @public
7854
7874
  */
7855
7875
  declare type IntentID = string;
7856
7876
 
7857
7877
  /**
7858
- * Labels the classifier may assign. Used to build the JSON schema enum and injected into `classifierPrompt` at `{{intents}}`. Omit to use the built-in taxonomy (code, summarization, translation, qa, conversation, classification, creative_writing, agentic, document_qa, other).
7878
+ * Dictionary of intents used to classify the user message being evaluated. Omit to use the built-in dictionary (code, summarization, translation, qa, conversation, classification, creative_writing, agentic, document_qa, other).
7859
7879
  *
7860
7880
  * @minItems 1
7861
7881
  * @public
@@ -8528,7 +8548,7 @@ declare type LowComplexityModel = string;
8528
8548
  declare type MaxConversationLength = number;
8529
8549
 
8530
8550
  /**
8531
- * Maximum characters of user prompt sent to the classifier. Longer prompts are truncated.
8551
+ * Maximum characters of user message sent to the classifier. Longer messages get truncated.
8532
8552
  * @public
8533
8553
  */
8534
8554
  declare type MaxPromptCharacters = number;
@@ -10584,7 +10604,7 @@ declare interface Models {
10584
10604
  }
10585
10605
 
10586
10606
  /**
10587
- * `providerName/model` routing by classified complexity. All of `low`, `medium`, and `high` are required. Used only when `smartRoutingEnabled` is true.
10607
+ * Enables which model will be used based on the classifier results (`low`, `medium` and `high`). This configuration is applied only when `smartRoutingEnabled` is true and confidence score meets the `minConfidenceForRouting` threshold.
10588
10608
  * @public
10589
10609
  */
10590
10610
  declare interface ModelsByComplexity {
@@ -10981,7 +11001,14 @@ declare type OAuthClientCredentialsLocation = "body" | "header";
10981
11001
  */
10982
11002
  export declare class OAuthProtectedResourcePlugin extends OAuthProtectedResourceBasePlugin {
10983
11003
  private options;
11004
+ private readonly scopes;
10984
11005
  constructor(options: OAuthProtectedResourcePluginOptions);
11006
+ /**
11007
+ * The scope values configured through `scopesSupported`, or `undefined` when
11008
+ * the option was not set. OAuth policies read this to populate the `scope`
11009
+ * parameter of their `WWW-Authenticate` challenge.
11010
+ */
11011
+ get scopesSupported(): readonly string[] | undefined;
10985
11012
  protected getMetadataOptions(
10986
11013
  _request: ZuploRequest,
10987
11014
  _context: ZuploContext
@@ -11005,6 +11032,29 @@ export declare interface OAuthProtectedResourcePluginOptions {
11005
11032
  * This field is recommended by RFC 9728.
11006
11033
  */
11007
11034
  resourceName?: string;
11035
+ /**
11036
+ * Scope values that clients should request when obtaining an access token for
11037
+ * this protected resource. Emitted as `scopes_supported` in the metadata
11038
+ * document (RFC 9728) and, when an OAuth policy on the route has
11039
+ * `oAuthResourceMetadataEnabled` set, as the `scope` parameter of the
11040
+ * `WWW-Authenticate` challenge on 401 responses. MCP clients use these values
11041
+ * to build their authorization request instead of asking for every scope the
11042
+ * authorization server advertises.
11043
+ *
11044
+ * Each entry must be a single OAuth scope token (RFC 6749 §3.3): printable
11045
+ * ASCII with no spaces, double quotes, or backslashes. The list must not be
11046
+ * empty; omit the option to advertise no scopes.
11047
+ *
11048
+ * @example
11049
+ * ```ts
11050
+ * new OAuthProtectedResourcePlugin({
11051
+ * authorizationServers: ["https://acme.okta.com/oauth2/aus1a2b3c"],
11052
+ * resourceName: "Acme MCP",
11053
+ * scopesSupported: ["mcp:access", "openid", "offline_access"],
11054
+ * });
11055
+ * ```
11056
+ */
11057
+ scopesSupported?: string[];
11008
11058
  }
11009
11059
 
11010
11060
  /**
@@ -11091,7 +11141,7 @@ export declare interface OktaJwtInboundPolicyOptions {
11091
11141
  */
11092
11142
  allowUnauthenticatedRequests?: boolean;
11093
11143
  /**
11094
- * Flag that determines whether OAuth protected resource metadata is enabled.
11144
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
11095
11145
  */
11096
11146
  oAuthResourceMetadataEnabled?: boolean;
11097
11147
  }
@@ -11897,7 +11947,7 @@ export declare interface OpenIdJwtInboundPolicyOptions {
11897
11947
  [k: string]: string;
11898
11948
  };
11899
11949
  /**
11900
- * Flag that determines whether OAuth protected resource metadata is enabled.
11950
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
11901
11951
  */
11902
11952
  oAuthResourceMetadataEnabled?: boolean;
11903
11953
  }
@@ -12482,7 +12532,7 @@ export declare interface PropelAuthJwtInboundPolicyOptions {
12482
12532
  */
12483
12533
  allowUnauthenticatedRequests?: boolean;
12484
12534
  /**
12485
- * Flag that determines whether OAuth protected resource metadata is enabled.
12535
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
12486
12536
  */
12487
12537
  oAuthResourceMetadataEnabled?: boolean;
12488
12538
  }
@@ -14179,7 +14229,7 @@ export declare interface SleepInboundPolicyOptions {
14179
14229
  }
14180
14230
 
14181
14231
  /**
14182
- * When true, apply model routing from `modelsByComplexity` when confidence is high enough and the intent is known. Classification still runs when false.
14232
+ * When true, apply model routing based on the models set in `modelsByComplexity` when confidence score meets the `minConfidenceForRouting` threshold. When set to false, classification still runs but model routing is not applied, useful for debugging or testing the classifier prompt.
14183
14233
  * @public
14184
14234
  */
14185
14235
  declare type SmartRoutingEnabled = boolean;
@@ -14442,7 +14492,7 @@ export declare interface SupabaseJwtInboundPolicyOptions {
14442
14492
  */
14443
14493
  allowUnauthenticatedRequests?: boolean;
14444
14494
  /**
14445
- * Flag that determines whether OAuth protected resource metadata is enabled.
14495
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
14446
14496
  */
14447
14497
  oAuthResourceMetadataEnabled?: boolean;
14448
14498
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.6.7",
4
+ "version": "7.6.9",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -328,8 +328,9 @@ implementation does not expect cloning:
328
328
  - `WeakMap`
329
329
  - `WeakSet`
330
330
 
331
- Circular objects are supported out of the box. By default, a cache based on `WeakSet` is used, but if `WeakSet` is not
332
- available then a fallback is used. The benchmarks quoted below are based on use of `WeakSet`.
331
+ Circular objects are supported out of the box. By default, the cache used to track values already copied is a `WeakMap`,
332
+ which can be replaced with any object satisfying the same `has` / `get` / `set` contract via
333
+ [`createCache`](#createcache). The benchmarks quoted below are based on the default.
333
334
 
334
335
  ## Aspects of default copiers
335
336
 
@@ -53,6 +53,15 @@ function getTag(value) {
53
53
 
54
54
  // eslint-disable-next-line @typescript-eslint/unbound-method
55
55
  const { propertyIsEnumerable } = Object.prototype;
56
+ /**
57
+ * The shared `%TypedArray%.prototype.slice`, which every typed array inherits.
58
+ *
59
+ * @note
60
+ * This is used instead of the `slice` found on the value itself because subclasses can
61
+ * override it with one that does not copy. `Buffer` is the notable case: its `slice`
62
+ * returns a view over the same memory, so copying through it would alias the original.
63
+ */
64
+ const sliceTypedArray = Object.getPrototypeOf(Int8Array.prototype).slice;
56
65
  function copyOwnDescriptor(original, clone, property, state) {
57
66
  const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {
58
67
  configurable: true,
@@ -110,10 +119,12 @@ function copyArrayStrict(array, state) {
110
119
  return copyOwnPropertiesStrict(array, clone, state);
111
120
  }
112
121
  /**
113
- * Copy the contents of the ArrayBuffer.
122
+ * Copy the contents of the ArrayBuffer, or of the typed array viewing one.
114
123
  */
115
124
  function copyArrayBuffer(arrayBuffer, _state) {
116
- return arrayBuffer.slice(0);
125
+ return ArrayBuffer.isView(arrayBuffer)
126
+ ? sliceTypedArray.call(arrayBuffer, 0)
127
+ : arrayBuffer.slice(0);
117
128
  }
118
129
  /**
119
130
  * Create a new Blob with the contents of the original.
@@ -268,7 +279,11 @@ function getOptions({ createCache: createCacheOverride, maxDepth, methods: metho
268
279
  * Get the copiers used for each specific object tag.
269
280
  */
270
281
  function getTagSpecificCopiers(methods) {
271
- return {
282
+ // A `null` prototype is used so that a value carrying a custom `Symbol.toStringTag`
283
+ // cannot resolve to an inherited `Object.prototype` member as its copier. Without it,
284
+ // a tag such as `toString` or `valueOf` finds a function on the prototype chain and
285
+ // that function is invoked in place of a real copier.
286
+ return Object.assign(Object.create(null), {
272
287
  Arguments: methods.object,
273
288
  Array: methods.array,
274
289
  ArrayBuffer: methods.arrayBuffer,
@@ -299,7 +314,7 @@ function getTagSpecificCopiers(methods) {
299
314
  Uint8ClampedArray: methods.arrayBuffer,
300
315
  Uint16Array: methods.arrayBuffer,
301
316
  Uint32Array: methods.arrayBuffer,
302
- };
317
+ });
303
318
  }
304
319
 
305
320
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n/**\n * Error thrown when the copier traverses deeper than the configured `maxDepth`.\n *\n * @note\n * Extends `RangeError` for backwards compatibility, since exceeding the maximum depth\n * previously surfaced as a native `RangeError` from stack exhaustion.\n */\nexport class MaxDepthExceededError extends RangeError {\n readonly maxDepth: number;\n\n constructor(maxDepth: number) {\n super(`Maximum copy depth of ${String(maxDepth)} exceeded; the value copied is nested too deeply.`);\n\n this.maxDepth = maxDepth;\n this.name = 'MaxDepthExceededError';\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n if (Constructor && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n /**\n * The constructor of the value currently being copied, derived from its `prototype`.\n * Used to construct the clone for values that are not plain objects, such as subclasses\n * of `Array` or custom classes.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n Constructor: any;\n /**\n * The cache of values already copied, mapping each original to its clone. Copiers should\n * populate it with the clone _before_ copying that value's contents, so that circular\n * references resolve to the clone rather than recursing infinitely.\n */\n cache: Cache;\n /**\n * The copier used for nested values. Call it as `state.copier(value, state)` to deeply\n * copy the contents of the value being copied.\n */\n copier: InternalCopier<any>;\n /**\n * The number of nested objects currently being copied, used to bound traversal of\n * deeply-nested values before the call stack is exhausted.\n *\n * @note\n * This is maintained by the copier itself; custom methods should not modify it.\n */\n depth: number;\n /**\n * The prototype of the value currently being copied, used to create a clone that\n * maintains the original's prototype chain.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n prototype: any;\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { propertyIsEnumerable } = Object.prototype;\n\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Strictly copy all properties contained on the object.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(value: Value, clone: Value, state: State): Value {\n for (const name of Object.getOwnPropertyNames(value)) {\n copyOwnDescriptor(value, clone, name, state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(value)) {\n copyOwnDescriptor(value, clone, symbol, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArrayLoose(array: any[], state: State) {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(array[index], state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array, as well as any custom properties.\n */\nexport function copyArrayStrict<Value extends any[]>(array: Value, state: State) {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n return copyOwnPropertiesStrict(array, clone, state);\n}\n\n/**\n * Copy the contents of the ArrayBuffer.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike>(arrayBuffer: Value, _state: State): Value {\n return arrayBuffer.slice(0) as Value;\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(copyArrayBuffer(dataView.buffer, state));\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(map, clone);\n\n for (const [key, value] of map) {\n clone.set(key, state.copier(value, state));\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the keys and values of the original, as well as any custom properties.\n */\nexport function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State) {\n return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n */\nexport function copyObjectLoose<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key of Object.keys(object)) {\n clone[key] = state.copier(object[key], state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(object)) {\n if (propertyIsEnumerable.call(object, symbol)) {\n clone[symbol] = state.copier((object as any)[symbol], state);\n }\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original, as well\n * as any hidden or non-enumerable properties.\n */\nexport function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(set, clone);\n\n for (const value of set) {\n clone.add(state.copier(value, state));\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the values of the original, as well as any custom properties.\n */\nexport function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);\n}\n","import {\n copyArrayBuffer,\n copyArrayLoose,\n copyArrayStrict,\n copyBlob,\n copyDataView,\n copyDate,\n copyMapLoose,\n copyMapStrict,\n copyObjectLoose,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyRegExp,\n copySelf,\n copySetLoose,\n copySetStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n /**\n * Creates the cache used to track values already copied, which is what allows circular\n * references to resolve to their clone instead of recursing infinitely. A new cache is\n * created for each top-level copy. Since it only needs to satisfy the `has` / `get` /\n * `set` contract, a bounded implementation such as an LRU cache can be used to trade\n * circular reference handling for a smaller memory footprint.\n *\n * @default () => new WeakMap()\n */\n createCache?: () => Cache;\n /**\n * The maximum number of nested objects to traverse before throwing a\n * `MaxDepthExceededError`. Pass `Infinity` to traverse without a limit.\n *\n * @default 1000\n */\n maxDepth?: number;\n /**\n * Overrides of the copiers used for specific object types, allowing custom copy\n * semantics for those types. Any type not overridden uses its default copier. Each\n * method receives the value to copy and the current `State`, and is responsible for\n * populating `state.cache` and recursing via `state.copier` if it wants circular\n * reference handling and deep copies respectively.\n */\n methods?: CopierMethods;\n /**\n * Copies all own properties with their original property descriptors, including\n * non-enumerable properties, symbols, and non-index properties on arrays.\n *\n * @note\n * This is significantly slower than the default \"loose\" copy, so it should only be used\n * when the exact shape of the original must be replicated.\n *\n * @default false\n */\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\n/**\n * The maximum depth traversed when none is provided.\n *\n * @note\n * This is deliberately below the depth at which the native call stack is exhausted\n * (~1875 for strict copies in node), so that untrusted, deeply-nested values fail with a\n * catchable, descriptive error instead of a raw `RangeError`.\n */\nexport const DEFAULT_MAX_DEPTH = 1000;\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n maxDepth,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArrayLoose,\n arrayBuffer: copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: copyBlob,\n dataView: copyDataView,\n date: copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMapLoose,\n object: strict ? copyObjectStrict : copyObjectLoose,\n regExp: copyRegExp,\n set: strict ? copySetStrict : copySetLoose,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return {\n createCache,\n copiers,\n maxDepth: maxDepth == null ? DEFAULT_MAX_DEPTH : maxDepth,\n methods,\n strict: Boolean(strict),\n };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>): Copiers {\n return {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitiveWrapper,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitiveWrapper,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n String: copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n };\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag, MaxDepthExceededError } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\nexport { MaxDepthExceededError } from './utils.js';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers, maxDepth } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n // Bound the traversal of nested objects, so that values nested more deeply than the\n // call stack can handle fail with a descriptive error instead of a raw `RangeError`.\n if (++state.depth > maxDepth) {\n throw new MaxDepthExceededError(maxDepth);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n let clone: any;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n clone = copyObject(value as Record<string, any>, state);\n } else if (Array.isArray(value)) {\n // arrays\n clone = copyArray(value, state);\n } else {\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n clone = tagSpecificCopier(value, state);\n } else {\n clone = typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n }\n\n --state.depth;\n\n return clone;\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n depth: 0,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"mappings":";;AAMA;;;;;;AAMG;AACG,MAAO,qBAAsB,SAAQ,UAAU,CAAA;AAGnD,IAAA,WAAA,CAAY,QAAgB,EAAA;QAC1B,KAAK,CAAC,yBAAyB,MAAM,CAAC,QAAQ,CAAC,CAAA,iDAAA,CAAmD,CAAC;AAEnG,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,IAAI,CAAC,IAAI,GAAG,uBAAuB;IACrC;AACD;AAED;AACA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ;AACpD;AACA,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ;AAEhD;;AAEG;AACG,SAAU,aAAa,CAAC,SAAc,EAAA;IAC1C,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAC5B;AAEA,IAAA,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW;AAEzC,IAAA,IAAI,WAAW,KAAK,MAAM,EAAE;AA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AAK,EAAE,CAAC;AACR,YAAA,SAAS,EAAE,SAAS;AACrB,SAAA,CAAC;AACJ,IAAA,CAAC;AACH;AAEA;;;;AAIG;AACI,MAAM,UAAU,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;AAEvD;;AAEG;AACI,MAAM,IAAI,GAAG,YAAY;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n/**\n * Error thrown when the copier traverses deeper than the configured `maxDepth`.\n *\n * @note\n * Extends `RangeError` for backwards compatibility, since exceeding the maximum depth\n * previously surfaced as a native `RangeError` from stack exhaustion.\n */\nexport class MaxDepthExceededError extends RangeError {\n readonly maxDepth: number;\n\n constructor(maxDepth: number) {\n super(`Maximum copy depth of ${String(maxDepth)} exceeded; the value copied is nested too deeply.`);\n\n this.maxDepth = maxDepth;\n this.name = 'MaxDepthExceededError';\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n if (Constructor && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n /**\n * The constructor of the value currently being copied, derived from its `prototype`.\n * Used to construct the clone for values that are not plain objects, such as subclasses\n * of `Array` or custom classes.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n Constructor: any;\n /**\n * The cache of values already copied, mapping each original to its clone. Copiers should\n * populate it with the clone _before_ copying that value's contents, so that circular\n * references resolve to the clone rather than recursing infinitely.\n */\n cache: Cache;\n /**\n * The copier used for nested values. Call it as `state.copier(value, state)` to deeply\n * copy the contents of the value being copied.\n */\n copier: InternalCopier<any>;\n /**\n * The number of nested objects currently being copied, used to bound traversal of\n * deeply-nested values before the call stack is exhausted.\n *\n * @note\n * This is maintained by the copier itself; custom methods should not modify it.\n */\n depth: number;\n /**\n * The prototype of the value currently being copied, used to create a clone that\n * maintains the original's prototype chain.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n prototype: any;\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { propertyIsEnumerable } = Object.prototype;\n\n/**\n * The shared `%TypedArray%.prototype.slice`, which every typed array inherits.\n *\n * @note\n * This is used instead of the `slice` found on the value itself because subclasses can\n * override it with one that does not copy. `Buffer` is the notable case: its `slice`\n * returns a view over the same memory, so copying through it would alias the original.\n */\nconst sliceTypedArray = Object.getPrototypeOf(Int8Array.prototype).slice as (\n this: ArrayBufferView,\n start: number,\n) => ArrayBufferView;\n\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Strictly copy all properties contained on the object.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(value: Value, clone: Value, state: State): Value {\n for (const name of Object.getOwnPropertyNames(value)) {\n copyOwnDescriptor(value, clone, name, state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(value)) {\n copyOwnDescriptor(value, clone, symbol, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArrayLoose(array: any[], state: State) {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(array[index], state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array, as well as any custom properties.\n */\nexport function copyArrayStrict<Value extends any[]>(array: Value, state: State) {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n return copyOwnPropertiesStrict(array, clone, state);\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n _state: State,\n): Value {\n return ArrayBuffer.isView(arrayBuffer)\n ? (sliceTypedArray.call(arrayBuffer, 0) as Value)\n : (arrayBuffer.slice(0) as Value);\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(copyArrayBuffer(dataView.buffer, state));\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(map, clone);\n\n for (const [key, value] of map) {\n clone.set(key, state.copier(value, state));\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the keys and values of the original, as well as any custom properties.\n */\nexport function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State) {\n return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n */\nexport function copyObjectLoose<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key of Object.keys(object)) {\n clone[key] = state.copier(object[key], state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(object)) {\n if (propertyIsEnumerable.call(object, symbol)) {\n clone[symbol] = state.copier((object as any)[symbol], state);\n }\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original, as well\n * as any hidden or non-enumerable properties.\n */\nexport function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(set, clone);\n\n for (const value of set) {\n clone.add(state.copier(value, state));\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the values of the original, as well as any custom properties.\n */\nexport function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);\n}\n","import {\n copyArrayBuffer,\n copyArrayLoose,\n copyArrayStrict,\n copyBlob,\n copyDataView,\n copyDate,\n copyMapLoose,\n copyMapStrict,\n copyObjectLoose,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyRegExp,\n copySelf,\n copySetLoose,\n copySetStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n /**\n * Creates the cache used to track values already copied, which is what allows circular\n * references to resolve to their clone instead of recursing infinitely. A new cache is\n * created for each top-level copy. Since it only needs to satisfy the `has` / `get` /\n * `set` contract, a bounded implementation such as an LRU cache can be used to trade\n * circular reference handling for a smaller memory footprint.\n *\n * @default () => new WeakMap()\n */\n createCache?: () => Cache;\n /**\n * The maximum number of nested objects to traverse before throwing a\n * `MaxDepthExceededError`. Pass `Infinity` to traverse without a limit.\n *\n * @default 1000\n */\n maxDepth?: number;\n /**\n * Overrides of the copiers used for specific object types, allowing custom copy\n * semantics for those types. Any type not overridden uses its default copier. Each\n * method receives the value to copy and the current `State`, and is responsible for\n * populating `state.cache` and recursing via `state.copier` if it wants circular\n * reference handling and deep copies respectively.\n */\n methods?: CopierMethods;\n /**\n * Copies all own properties with their original property descriptors, including\n * non-enumerable properties, symbols, and non-index properties on arrays.\n *\n * @note\n * This is significantly slower than the default \"loose\" copy, so it should only be used\n * when the exact shape of the original must be replicated.\n *\n * @default false\n */\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\n/**\n * The maximum depth traversed when none is provided.\n *\n * @note\n * This is deliberately below the depth at which the native call stack is exhausted\n * (~1875 for strict copies in node), so that untrusted, deeply-nested values fail with a\n * catchable, descriptive error instead of a raw `RangeError`.\n */\nexport const DEFAULT_MAX_DEPTH = 1000;\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n maxDepth,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArrayLoose,\n arrayBuffer: copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: copyBlob,\n dataView: copyDataView,\n date: copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMapLoose,\n object: strict ? copyObjectStrict : copyObjectLoose,\n regExp: copyRegExp,\n set: strict ? copySetStrict : copySetLoose,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return {\n createCache,\n copiers,\n maxDepth: maxDepth == null ? DEFAULT_MAX_DEPTH : maxDepth,\n methods,\n strict: Boolean(strict),\n };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>): Copiers {\n // A `null` prototype is used so that a value carrying a custom `Symbol.toStringTag`\n // cannot resolve to an inherited `Object.prototype` member as its copier. Without it,\n // a tag such as `toString` or `valueOf` finds a function on the prototype chain and\n // that function is invoked in place of a real copier.\n return Object.assign(Object.create(null) as Copiers, {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitiveWrapper,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitiveWrapper,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n String: copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n });\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag, MaxDepthExceededError } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\nexport { MaxDepthExceededError } from './utils.js';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers, maxDepth } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n // Bound the traversal of nested objects, so that values nested more deeply than the\n // call stack can handle fail with a descriptive error instead of a raw `RangeError`.\n if (++state.depth > maxDepth) {\n throw new MaxDepthExceededError(maxDepth);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n let clone: any;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n clone = copyObject(value as Record<string, any>, state);\n } else if (Array.isArray(value)) {\n // arrays\n clone = copyArray(value, state);\n } else {\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n clone = tagSpecificCopier(value, state);\n } else {\n clone = typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n }\n\n --state.depth;\n\n return clone;\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n depth: 0,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"mappings":";;AAMA;;;;;;AAMG;AACG,MAAO,qBAAsB,SAAQ,UAAU,CAAA;AAGnD,IAAA,WAAA,CAAY,QAAgB,EAAA;QAC1B,KAAK,CAAC,yBAAyB,MAAM,CAAC,QAAQ,CAAC,CAAA,iDAAA,CAAmD,CAAC;AAEnG,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,IAAI,CAAC,IAAI,GAAG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AC;QACzD;AAAO,aAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;AAE/B,YAAA,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;QACjC;aAAO;YACL,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAEhD,IAAI,iBAAiB,EAAE;AACrB,gBAAA,KAAK,GAAG,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC;YACzC;iBAAO;gBACL,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,GAAG,KAAK,GAAG,UAAU,CAAC,KAA4B,EAAE,KAAK,CAAC;YACpG;QACF;QAEA,EAAE,KAAK,CAAC,KAAK;AAEb,QAAA,OAAO,KAAK;IACd;IAEA,OAAO,SAAS,IAAI,CAAQ,KAAY,EAAA;QACtC,OAAO,MAAM,CAAC,KAAK,EAAE;AACnB,YAAA,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,WAAW,EAAE;YACpB,MAAM;AACN,YAAA,KAAK,EAAE,CAAC;AACR,YAAA,SAAS,EAAE,SAAS;AACrB,SAAA,CAAC;AACJ,IAAA,CAAC;AACH;AAEA;;;;AAIG;AACI,MAAM,UAAU,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;AAEvD;;AAEG;AACI,MAAM,IAAI,GAAG,YAAY;;;;;"}
@@ -51,6 +51,15 @@ function getTag(value) {
51
51
 
52
52
  // eslint-disable-next-line @typescript-eslint/unbound-method
53
53
  const { propertyIsEnumerable } = Object.prototype;
54
+ /**
55
+ * The shared `%TypedArray%.prototype.slice`, which every typed array inherits.
56
+ *
57
+ * @note
58
+ * This is used instead of the `slice` found on the value itself because subclasses can
59
+ * override it with one that does not copy. `Buffer` is the notable case: its `slice`
60
+ * returns a view over the same memory, so copying through it would alias the original.
61
+ */
62
+ const sliceTypedArray = Object.getPrototypeOf(Int8Array.prototype).slice;
54
63
  function copyOwnDescriptor(original, clone, property, state) {
55
64
  const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {
56
65
  configurable: true,
@@ -108,10 +117,12 @@ function copyArrayStrict(array, state) {
108
117
  return copyOwnPropertiesStrict(array, clone, state);
109
118
  }
110
119
  /**
111
- * Copy the contents of the ArrayBuffer.
120
+ * Copy the contents of the ArrayBuffer, or of the typed array viewing one.
112
121
  */
113
122
  function copyArrayBuffer(arrayBuffer, _state) {
114
- return arrayBuffer.slice(0);
123
+ return ArrayBuffer.isView(arrayBuffer)
124
+ ? sliceTypedArray.call(arrayBuffer, 0)
125
+ : arrayBuffer.slice(0);
115
126
  }
116
127
  /**
117
128
  * Create a new Blob with the contents of the original.
@@ -266,7 +277,11 @@ function getOptions({ createCache: createCacheOverride, maxDepth, methods: metho
266
277
  * Get the copiers used for each specific object tag.
267
278
  */
268
279
  function getTagSpecificCopiers(methods) {
269
- return {
280
+ // A `null` prototype is used so that a value carrying a custom `Symbol.toStringTag`
281
+ // cannot resolve to an inherited `Object.prototype` member as its copier. Without it,
282
+ // a tag such as `toString` or `valueOf` finds a function on the prototype chain and
283
+ // that function is invoked in place of a real copier.
284
+ return Object.assign(Object.create(null), {
270
285
  Arguments: methods.object,
271
286
  Array: methods.array,
272
287
  ArrayBuffer: methods.arrayBuffer,
@@ -297,7 +312,7 @@ function getTagSpecificCopiers(methods) {
297
312
  Uint8ClampedArray: methods.arrayBuffer,
298
313
  Uint16Array: methods.arrayBuffer,
299
314
  Uint32Array: methods.arrayBuffer,
300
- };
315
+ });
301
316
  }
302
317
 
303
318
  /**