@casys/mcp-server 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG.md +1779 -0
  2. package/LICENSE +21 -0
  3. package/README.md +19 -5
  4. package/esm/_dnt.polyfills.d.ts +12 -0
  5. package/esm/_dnt.polyfills.d.ts.map +1 -0
  6. package/esm/_dnt.polyfills.js +15 -0
  7. package/esm/_dnt.shims.d.ts +2 -0
  8. package/esm/_dnt.shims.d.ts.map +1 -0
  9. package/esm/_dnt.shims.js +57 -0
  10. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts +33 -0
  11. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts.map +1 -0
  12. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.js +48 -0
  13. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts +106 -0
  14. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.js +636 -0
  16. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts +67 -0
  17. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts.map +1 -0
  18. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.js +1393 -0
  19. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts +44 -0
  20. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts.map +1 -0
  21. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.js +117 -0
  22. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts +3 -0
  23. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.js +103 -0
  25. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts +3 -0
  26. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.js +32 -0
  28. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts +3 -0
  29. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts.map +1 -0
  30. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.js +96 -0
  31. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts +3 -0
  32. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts.map +1 -0
  33. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.js +159 -0
  34. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts +3 -0
  35. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.js +14 -0
  37. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts +3 -0
  38. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.js +10 -0
  40. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts +3 -0
  41. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.js +22 -0
  43. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts +3 -0
  44. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.js +29 -0
  46. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts +3 -0
  47. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.js +19 -0
  49. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts +3 -0
  50. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.js +30 -0
  52. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts +3 -0
  53. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.js +10 -0
  55. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts +3 -0
  56. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.js +14 -0
  58. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts +3 -0
  59. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.js +9 -0
  61. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts +3 -0
  62. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.js +81 -0
  64. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts +3 -0
  65. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.js +20 -0
  67. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts +32 -0
  68. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts.map +1 -0
  69. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.js +6 -0
  70. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts +4 -0
  71. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.js +13 -0
  73. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts +51 -0
  74. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.js +53 -0
  76. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts +79 -0
  77. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts.map +1 -0
  78. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.js +91 -0
  79. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts +100 -0
  80. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts.map +1 -0
  81. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.js +33 -0
  82. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts +111 -0
  83. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts.map +1 -0
  84. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.js +104 -0
  85. package/esm/mod.d.ts +102 -0
  86. package/esm/mod.d.ts.map +1 -0
  87. package/esm/mod.js +103 -0
  88. package/esm/package.json +3 -0
  89. package/esm/src/auth/as-metadata-proxy.d.ts +112 -0
  90. package/esm/src/auth/as-metadata-proxy.d.ts.map +1 -0
  91. package/esm/src/auth/as-metadata-proxy.js +171 -0
  92. package/esm/src/auth/config.d.ts +117 -0
  93. package/esm/src/auth/config.d.ts.map +1 -0
  94. package/esm/src/auth/config.js +219 -0
  95. package/esm/src/auth/jwt-provider.d.ts +157 -0
  96. package/esm/src/auth/jwt-provider.d.ts.map +1 -0
  97. package/esm/src/auth/jwt-provider.js +187 -0
  98. package/esm/src/auth/middleware.d.ts +61 -0
  99. package/esm/src/auth/middleware.d.ts.map +1 -0
  100. package/esm/src/auth/middleware.js +209 -0
  101. package/esm/src/auth/mod.d.ts +23 -0
  102. package/esm/src/auth/mod.d.ts.map +1 -0
  103. package/esm/src/auth/mod.js +27 -0
  104. package/esm/src/auth/multi-tenant-middleware.d.ts +131 -0
  105. package/esm/src/auth/multi-tenant-middleware.d.ts.map +1 -0
  106. package/esm/src/auth/multi-tenant-middleware.js +128 -0
  107. package/esm/src/auth/presets.d.ts +231 -0
  108. package/esm/src/auth/presets.d.ts.map +1 -0
  109. package/esm/src/auth/presets.js +223 -0
  110. package/{src/auth/provider.ts → esm/src/auth/provider.d.ts} +13 -15
  111. package/esm/src/auth/provider.d.ts.map +1 -0
  112. package/esm/src/auth/provider.js +34 -0
  113. package/esm/src/auth/scope-middleware.d.ts +30 -0
  114. package/esm/src/auth/scope-middleware.d.ts.map +1 -0
  115. package/esm/src/auth/scope-middleware.js +48 -0
  116. package/esm/src/auth/static-token-provider.d.ts +155 -0
  117. package/esm/src/auth/static-token-provider.d.ts.map +1 -0
  118. package/esm/src/auth/static-token-provider.js +256 -0
  119. package/esm/src/auth/types.d.ts +151 -0
  120. package/esm/src/auth/types.d.ts.map +1 -0
  121. package/esm/src/auth/types.js +64 -0
  122. package/esm/src/client-auth/callback-server.d.ts +34 -0
  123. package/esm/src/client-auth/callback-server.d.ts.map +1 -0
  124. package/esm/src/client-auth/callback-server.js +141 -0
  125. package/esm/src/client-auth/client-id-metadata.d.ts +29 -0
  126. package/esm/src/client-auth/client-id-metadata.d.ts.map +1 -0
  127. package/esm/src/client-auth/client-id-metadata.js +149 -0
  128. package/esm/src/client-auth/connect.d.ts +32 -0
  129. package/esm/src/client-auth/connect.d.ts.map +1 -0
  130. package/esm/src/client-auth/connect.js +47 -0
  131. package/esm/src/client-auth/mod.d.ts +19 -0
  132. package/esm/src/client-auth/mod.d.ts.map +1 -0
  133. package/{src/client-auth/mod.ts → esm/src/client-auth/mod.js} +1 -26
  134. package/esm/src/client-auth/provider.d.ts +78 -0
  135. package/esm/src/client-auth/provider.d.ts.map +1 -0
  136. package/esm/src/client-auth/provider.js +246 -0
  137. package/esm/src/client-auth/token-store/file-store.d.ts +20 -0
  138. package/esm/src/client-auth/token-store/file-store.d.ts.map +1 -0
  139. package/esm/src/client-auth/token-store/file-store.js +62 -0
  140. package/esm/src/client-auth/token-store/memory-store.d.ts +14 -0
  141. package/esm/src/client-auth/token-store/memory-store.d.ts.map +1 -0
  142. package/esm/src/client-auth/token-store/memory-store.js +25 -0
  143. package/esm/src/client-auth/types.d.ts +89 -0
  144. package/esm/src/client-auth/types.d.ts.map +1 -0
  145. package/esm/src/client-auth/types.js +10 -0
  146. package/esm/src/concurrency/rate-limiter.d.ts +87 -0
  147. package/esm/src/concurrency/rate-limiter.d.ts.map +1 -0
  148. package/esm/src/concurrency/rate-limiter.js +165 -0
  149. package/esm/src/concurrency/request-queue.d.ts +71 -0
  150. package/esm/src/concurrency/request-queue.d.ts.map +1 -0
  151. package/esm/src/concurrency/request-queue.js +128 -0
  152. package/esm/src/http/body.d.ts +20 -0
  153. package/esm/src/http/body.d.ts.map +1 -0
  154. package/esm/src/http/body.js +63 -0
  155. package/esm/src/http/request-guards.d.ts +54 -0
  156. package/esm/src/http/request-guards.d.ts.map +1 -0
  157. package/esm/src/http/request-guards.js +114 -0
  158. package/esm/src/http/wire.d.ts +26 -0
  159. package/esm/src/http/wire.d.ts.map +1 -0
  160. package/{src/http/wire.ts → esm/src/http/wire.js} +13 -19
  161. package/esm/src/inspector/launcher.d.ts +48 -0
  162. package/esm/src/inspector/launcher.d.ts.map +1 -0
  163. package/esm/src/inspector/launcher.js +100 -0
  164. package/esm/src/mcp-app.d.ts +728 -0
  165. package/esm/src/mcp-app.d.ts.map +1 -0
  166. package/esm/src/mcp-app.js +3530 -0
  167. package/{src/middleware/backpressure.ts → esm/src/middleware/backpressure.d.ts} +2 -14
  168. package/esm/src/middleware/backpressure.d.ts.map +1 -0
  169. package/esm/src/middleware/backpressure.js +31 -0
  170. package/esm/src/middleware/mod.d.ts +11 -0
  171. package/esm/src/middleware/mod.d.ts.map +1 -0
  172. package/{src/middleware/mod.ts → esm/src/middleware/mod.js} +0 -10
  173. package/{src/middleware/rate-limit.ts → esm/src/middleware/rate-limit.d.ts} +2 -25
  174. package/esm/src/middleware/rate-limit.d.ts.map +1 -0
  175. package/esm/src/middleware/rate-limit.js +33 -0
  176. package/esm/src/middleware/runner.d.ts +32 -0
  177. package/esm/src/middleware/runner.d.ts.map +1 -0
  178. package/esm/src/middleware/runner.js +49 -0
  179. package/esm/src/middleware/types.d.ts +76 -0
  180. package/esm/src/middleware/types.d.ts.map +1 -0
  181. package/esm/src/middleware/types.js +9 -0
  182. package/esm/src/middleware/validation.d.ts +24 -0
  183. package/esm/src/middleware/validation.d.ts.map +1 -0
  184. package/esm/src/middleware/validation.js +30 -0
  185. package/esm/src/mrtr/capability-check.d.ts +75 -0
  186. package/esm/src/mrtr/capability-check.d.ts.map +1 -0
  187. package/esm/src/mrtr/capability-check.js +233 -0
  188. package/esm/src/mrtr/mod.d.ts +18 -0
  189. package/esm/src/mrtr/mod.d.ts.map +1 -0
  190. package/esm/src/mrtr/mod.js +12 -0
  191. package/esm/src/mrtr/replay-store.d.ts +50 -0
  192. package/esm/src/mrtr/replay-store.d.ts.map +1 -0
  193. package/esm/src/mrtr/replay-store.js +61 -0
  194. package/esm/src/mrtr/request-state.d.ts +181 -0
  195. package/esm/src/mrtr/request-state.d.ts.map +1 -0
  196. package/esm/src/mrtr/request-state.js +313 -0
  197. package/esm/src/mrtr/retry-guard.d.ts +61 -0
  198. package/esm/src/mrtr/retry-guard.d.ts.map +1 -0
  199. package/esm/src/mrtr/retry-guard.js +53 -0
  200. package/esm/src/mrtr/types.d.ts +99 -0
  201. package/esm/src/mrtr/types.d.ts.map +1 -0
  202. package/esm/src/mrtr/types.js +14 -0
  203. package/esm/src/observability/metrics.d.ts +104 -0
  204. package/esm/src/observability/metrics.d.ts.map +1 -0
  205. package/esm/src/observability/metrics.js +207 -0
  206. package/{src/observability/mod.ts → esm/src/observability/mod.d.ts} +2 -11
  207. package/esm/src/observability/mod.d.ts.map +1 -0
  208. package/esm/src/observability/mod.js +11 -0
  209. package/esm/src/observability/otel.d.ts +73 -0
  210. package/esm/src/observability/otel.d.ts.map +1 -0
  211. package/esm/src/observability/otel.js +260 -0
  212. package/esm/src/runtime/runtime.d.ts +10 -0
  213. package/esm/src/runtime/runtime.d.ts.map +1 -0
  214. package/esm/src/runtime/runtime.deno.d.ts +50 -0
  215. package/esm/src/runtime/runtime.deno.d.ts.map +1 -0
  216. package/esm/src/runtime/runtime.deno.js +120 -0
  217. package/{src/runtime/runtime.ts → esm/src/runtime/runtime.js} +5 -14
  218. package/esm/src/runtime/runtime.node.d.ts +51 -0
  219. package/esm/src/runtime/runtime.node.d.ts.map +1 -0
  220. package/esm/src/runtime/runtime.node.js +268 -0
  221. package/{src/runtime/types.ts → esm/src/runtime/types.d.ts} +28 -51
  222. package/esm/src/runtime/types.d.ts.map +1 -0
  223. package/esm/src/runtime/types.js +12 -0
  224. package/esm/src/security/channel-hmac.d.ts +43 -0
  225. package/esm/src/security/channel-hmac.d.ts.map +1 -0
  226. package/{src/security/channel-hmac.ts → esm/src/security/channel-hmac.js} +12 -17
  227. package/esm/src/security/csp.d.ts +50 -0
  228. package/esm/src/security/csp.d.ts.map +1 -0
  229. package/esm/src/security/csp.js +63 -0
  230. package/esm/src/security/message-signer.d.ts +88 -0
  231. package/esm/src/security/message-signer.d.ts.map +1 -0
  232. package/esm/src/security/message-signer.js +166 -0
  233. package/esm/src/subscriptions/subscription-registry.d.ts +256 -0
  234. package/esm/src/subscriptions/subscription-registry.d.ts.map +1 -0
  235. package/esm/src/subscriptions/subscription-registry.js +406 -0
  236. package/{src/tasks/mod.ts → esm/src/tasks/mod.d.ts} +3 -23
  237. package/esm/src/tasks/mod.d.ts.map +1 -0
  238. package/esm/src/tasks/mod.js +11 -0
  239. package/esm/src/tasks/task-store.d.ts +342 -0
  240. package/esm/src/tasks/task-store.d.ts.map +1 -0
  241. package/esm/src/tasks/task-store.js +649 -0
  242. package/esm/src/transport/request-headers.d.ts +145 -0
  243. package/esm/src/transport/request-headers.d.ts.map +1 -0
  244. package/esm/src/transport/request-headers.js +525 -0
  245. package/esm/src/types.d.ts +776 -0
  246. package/esm/src/types.d.ts.map +1 -0
  247. package/esm/src/types.js +92 -0
  248. package/esm/src/ui/viewer-utils.d.ts +45 -0
  249. package/esm/src/ui/viewer-utils.d.ts.map +1 -0
  250. package/esm/src/ui/viewer-utils.js +97 -0
  251. package/esm/src/validation/schema-validator.d.ts +115 -0
  252. package/esm/src/validation/schema-validator.d.ts.map +1 -0
  253. package/esm/src/validation/schema-validator.js +249 -0
  254. package/package.json +35 -23
  255. package/mod.ts +0 -302
  256. package/src/auth/as-metadata-proxy.ts +0 -288
  257. package/src/auth/config.ts +0 -368
  258. package/src/auth/jwt-provider.ts +0 -327
  259. package/src/auth/middleware.ts +0 -257
  260. package/src/auth/mod.ts +0 -89
  261. package/src/auth/multi-tenant-middleware.ts +0 -236
  262. package/src/auth/presets.ts +0 -351
  263. package/src/auth/scope-middleware.ts +0 -59
  264. package/src/auth/static-token-provider.ts +0 -197
  265. package/src/auth/types.ts +0 -207
  266. package/src/client-auth/callback-server.ts +0 -166
  267. package/src/client-auth/client-id-metadata.ts +0 -260
  268. package/src/client-auth/connect.ts +0 -72
  269. package/src/client-auth/provider.ts +0 -300
  270. package/src/client-auth/token-store/file-store.ts +0 -73
  271. package/src/client-auth/token-store/memory-store.ts +0 -32
  272. package/src/client-auth/types.ts +0 -95
  273. package/src/concurrency/rate-limiter.ts +0 -190
  274. package/src/concurrency/request-queue.ts +0 -140
  275. package/src/http/body.ts +0 -72
  276. package/src/http/request-guards.ts +0 -137
  277. package/src/inspector/launcher.ts +0 -131
  278. package/src/mcp-app.ts +0 -4426
  279. package/src/middleware/runner.ts +0 -63
  280. package/src/middleware/types.ts +0 -104
  281. package/src/middleware/validation.ts +0 -28
  282. package/src/mrtr/capability-check.ts +0 -303
  283. package/src/mrtr/mod.ts +0 -46
  284. package/src/mrtr/replay-store.ts +0 -103
  285. package/src/mrtr/request-state.ts +0 -435
  286. package/src/mrtr/types.ts +0 -107
  287. package/src/observability/metrics.ts +0 -336
  288. package/src/observability/otel.ts +0 -330
  289. package/src/runtime/runtime.deno.ts +0 -149
  290. package/src/runtime/runtime.node.ts +0 -324
  291. package/src/security/csp.ts +0 -89
  292. package/src/security/message-signer.ts +0 -223
  293. package/src/subscriptions/subscription-registry.ts +0 -558
  294. package/src/tasks/task-store.ts +0 -1014
  295. package/src/testdata/stdio-e2e-server.ts +0 -110
  296. package/src/transport/request-headers.ts +0 -661
  297. package/src/types.ts +0 -907
  298. package/src/ui/viewer-utils.ts +0 -117
  299. package/src/validation/schema-validator.ts +0 -307
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const omap: Type<"sequence", Record<PropertyKey, unknown>[]>;
3
+ //# sourceMappingURL=omap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omap.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/omap.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAiBxC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAOjE,CAAC"}
@@ -0,0 +1,29 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ import { isPlainObject } from "../_utils.js";
6
+ function resolveYamlOmap(data) {
7
+ const objectKeys = new Set();
8
+ for (const object of data) {
9
+ if (!isPlainObject(object))
10
+ return false;
11
+ const keys = Object.keys(object);
12
+ if (keys.length !== 1)
13
+ return false;
14
+ for (const key of keys) {
15
+ if (objectKeys.has(key))
16
+ return false;
17
+ objectKeys.add(key);
18
+ }
19
+ }
20
+ return true;
21
+ }
22
+ export const omap = {
23
+ tag: "tag:yaml.org,2002:omap",
24
+ kind: "sequence",
25
+ resolve: resolveYamlOmap,
26
+ construct(data) {
27
+ return data;
28
+ },
29
+ };
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const pairs: Type<"sequence">;
3
+ //# sourceMappingURL=pairs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pairs.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAQxC,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,UAAU,CAQlC,CAAC"}
@@ -0,0 +1,19 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ import { isPlainObject } from "../_utils.js";
6
+ function resolveYamlPairs(data) {
7
+ if (data === null)
8
+ return true;
9
+ return data.every((it) => isPlainObject(it) && Object.keys(it).length === 1);
10
+ }
11
+ export const pairs = {
12
+ tag: "tag:yaml.org,2002:pairs",
13
+ construct(data) {
14
+ // Converts an array of objects into an array of key-value pairs.
15
+ return data?.flatMap(Object.entries) ?? [];
16
+ },
17
+ kind: "sequence",
18
+ resolve: resolveYamlPairs,
19
+ };
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const regexp: Type<"scalar", RegExp>;
3
+ //# sourceMappingURL=regexp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regexp.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAuBzC,CAAC"}
@@ -0,0 +1,30 @@
1
+ // Ported and adapted from js-yaml-js-types v1.0.0:
2
+ // https://github.com/nodeca/js-yaml-js-types/tree/ac537e7bbdd3c2cbbd9882ca3919c520c2dc022b
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ const REGEXP = /^\/(?<regexp>[\s\S]+)\/(?<modifiers>[gismuy]*)$/;
6
+ export const regexp = {
7
+ tag: "tag:yaml.org,2002:js/regexp",
8
+ kind: "scalar",
9
+ resolve(data) {
10
+ if (data === null || !data.length)
11
+ return false;
12
+ if (data.charAt(0) === "/") {
13
+ // Ensure regex is properly terminated
14
+ const groups = data.match(REGEXP)?.groups;
15
+ if (!groups)
16
+ return false;
17
+ // Check no duplicate modifiers
18
+ const modifiers = groups.modifiers ?? "";
19
+ if (new Set(modifiers).size < modifiers.length)
20
+ return false;
21
+ }
22
+ return true;
23
+ },
24
+ construct(data) {
25
+ const { regexp = data, modifiers = "" } = data.match(REGEXP)?.groups ?? {};
26
+ return new RegExp(regexp, modifiers);
27
+ },
28
+ predicate: (object) => object instanceof RegExp,
29
+ represent: (object) => object.toString(),
30
+ };
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const seq: Type<"sequence", unknown[]>;
3
+ //# sourceMappingURL=seq.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seq.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/seq.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,CAK3C,CAAC"}
@@ -0,0 +1,10 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ export const seq = {
6
+ tag: "tag:yaml.org,2002:seq",
7
+ kind: "sequence",
8
+ resolve: () => true,
9
+ construct: (data) => data !== null ? data : [],
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const set: Type<"mapping", Record<PropertyKey, unknown>>;
3
+ //# sourceMappingURL=set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/set.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAS7D,CAAC"}
@@ -0,0 +1,14 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ export const set = {
6
+ tag: "tag:yaml.org,2002:set",
7
+ kind: "mapping",
8
+ construct: (data) => data !== null ? data : {},
9
+ resolve: (data) => {
10
+ if (data === null)
11
+ return true;
12
+ return Object.values(data).every((it) => it === null);
13
+ },
14
+ };
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const str: Type<"scalar", string>;
3
+ //# sourceMappingURL=str.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"str.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/str.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAKtC,CAAC"}
@@ -0,0 +1,9 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2018-2026 the Deno authors. MIT license.
4
+ export const str = {
5
+ tag: "tag:yaml.org,2002:str",
6
+ kind: "scalar",
7
+ resolve: () => true,
8
+ construct: (data) => data !== null ? data : "",
9
+ };
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const timestamp: Type<"scalar", Date>;
3
+ //# sourceMappingURL=timestamp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timestamp.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAsFxC,eAAO,MAAM,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAS1C,CAAC"}
@@ -0,0 +1,81 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ const YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + // [1] year
6
+ "-([0-9][0-9])" + // [2] month
7
+ "-([0-9][0-9])$");
8
+ const YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + // [1] year
9
+ "-([0-9][0-9]?)" + // [2] month
10
+ "-([0-9][0-9]?)" + // [3] day
11
+ "(?:[Tt]|[ \\t]+)" + // ...
12
+ "([0-9][0-9]?)" + // [4] hour
13
+ ":([0-9][0-9])" + // [5] minute
14
+ ":([0-9][0-9])" + // [6] second
15
+ "(?:\\.([0-9]*))?" + // [7] fraction
16
+ "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + // [8] tz [9] tz_sign [10] tz_hour
17
+ "(?::([0-9][0-9]))?))?$");
18
+ function resolveYamlTimestamp(data) {
19
+ if (data === null)
20
+ return false;
21
+ if (YAML_DATE_REGEXP.exec(data) !== null)
22
+ return true;
23
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
24
+ return true;
25
+ return false;
26
+ }
27
+ function constructYamlTimestamp(data) {
28
+ let match = YAML_DATE_REGEXP.exec(data);
29
+ if (match === null)
30
+ match = YAML_TIMESTAMP_REGEXP.exec(data);
31
+ if (match === null) {
32
+ throw new Error("Cannot construct YAML timestamp: date resolve error");
33
+ }
34
+ // match: [1] year [2] month [3] day
35
+ const year = +match[1];
36
+ const month = +match[2] - 1; // JS month starts with 0
37
+ const day = +match[3];
38
+ if (!match[4]) {
39
+ // no hour
40
+ return new Date(Date.UTC(year, month, day));
41
+ }
42
+ // match: [4] hour [5] minute [6] second [7] fraction
43
+ const hour = +match[4];
44
+ const minute = +match[5];
45
+ const second = +match[6];
46
+ let fraction = 0;
47
+ if (match[7]) {
48
+ let partFraction = match[7].slice(0, 3);
49
+ while (partFraction.length < 3) {
50
+ // milli-seconds
51
+ partFraction += "0";
52
+ }
53
+ fraction = +partFraction;
54
+ }
55
+ // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
56
+ let delta = null;
57
+ if (match[9] && match[10]) {
58
+ const tzHour = +match[10];
59
+ const tzMinute = +(match[11] || 0);
60
+ delta = (tzHour * 60 + tzMinute) * 60000; // delta in milli-seconds
61
+ if (match[9] === "-")
62
+ delta = -delta;
63
+ }
64
+ const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
65
+ if (delta)
66
+ date.setTime(date.getTime() - delta);
67
+ return date;
68
+ }
69
+ function representYamlTimestamp(date) {
70
+ return date.toISOString();
71
+ }
72
+ export const timestamp = {
73
+ tag: "tag:yaml.org,2002:timestamp",
74
+ construct: constructYamlTimestamp,
75
+ predicate(object) {
76
+ return object instanceof Date;
77
+ },
78
+ kind: "scalar",
79
+ represent: representYamlTimestamp,
80
+ resolve: resolveYamlTimestamp,
81
+ };
@@ -0,0 +1,3 @@
1
+ import type { Type } from "../_type.js";
2
+ export declare const undefinedType: Type<"scalar", undefined>;
3
+ //# sourceMappingURL=undefined.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undefined.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAenD,CAAC"}
@@ -0,0 +1,20 @@
1
+ // Ported and adapted from js-yaml-js-types v1.0.0:
2
+ // https://github.com/nodeca/js-yaml-js-types/tree/ac537e7bbdd3c2cbbd9882ca3919c520c2dc022b
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ export const undefinedType = {
6
+ tag: "tag:yaml.org,2002:js/undefined",
7
+ kind: "scalar",
8
+ resolve() {
9
+ return true;
10
+ },
11
+ construct() {
12
+ return undefined;
13
+ },
14
+ predicate(object) {
15
+ return typeof object === "undefined";
16
+ },
17
+ represent() {
18
+ return "";
19
+ },
20
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The kind of YAML node.
3
+ */
4
+ export type KindType = "sequence" | "scalar" | "mapping";
5
+ /**
6
+ * The style variation for `styles` option of {@linkcode stringify}
7
+ */
8
+ export type StyleVariant = "lowercase" | "uppercase" | "camelcase" | "decimal" | "binary" | "octal" | "hexadecimal";
9
+ /**
10
+ * Function to convert data to a string for YAML serialization.
11
+ */
12
+ export type RepresentFn<D> = (data: D, style?: StyleVariant) => string;
13
+ /**
14
+ * A type definition for a YAML node.
15
+ */
16
+ export interface Type<K extends KindType, D = any> {
17
+ /** Tag to identify the type */
18
+ tag: string;
19
+ /** Kind of type */
20
+ kind: K;
21
+ /** Cast the type. Used to stringify */
22
+ predicate?: (data: unknown) => data is D;
23
+ /** Function to represent data. Used to stringify */
24
+ represent?: RepresentFn<D> | Record<string, RepresentFn<D>>;
25
+ /** Default style for the type. Used to stringify */
26
+ defaultStyle?: StyleVariant;
27
+ /** Function to test whether data can be resolved by this type. Used to parse */
28
+ resolve: (data: any) => boolean;
29
+ /** Function to construct data from string. Used to parse */
30
+ construct: (data: any) => D;
31
+ }
32
+ //# sourceMappingURL=_type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_type.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_type.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AACzD;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,QAAQ,GACR,OAAO,GACP,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,YAAY,KAAK,MAAM,CAAC;AAEvE;;GAEG;AAEH,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,GAAG,GAAG;IAC/C,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,mBAAmB;IACnB,IAAI,EAAE,CAAC,CAAC;IACR,uCAAuC;IACvC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC;IACzC,oDAAoD;IACpD,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,oDAAoD;IACpD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gFAAgF;IAEhF,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;IAChC,4DAA4D;IAE5D,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC;CAC7B"}
@@ -0,0 +1,6 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ // This module is browser compatible.
6
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
2
+ export declare function isNegativeZero(i: number): boolean;
3
+ export declare function isPlainObject(object: unknown): object is object;
4
+ //# sourceMappingURL=_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_utils.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/_utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE/D"}
@@ -0,0 +1,13 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ export function isObject(value) {
6
+ return value !== null && typeof value === "object";
7
+ }
8
+ export function isNegativeZero(i) {
9
+ return i === 0 && Number.NEGATIVE_INFINITY === 1 / i;
10
+ }
11
+ export function isPlainObject(object) {
12
+ return Object.prototype.toString.call(object) === "[object Object]";
13
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * {@linkcode parse} and {@linkcode stringify} for handling
3
+ * {@link https://yaml.org/ | YAML} encoded data.
4
+ *
5
+ * Ported from
6
+ * {@link https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da | js-yaml v3.13.1}.
7
+ *
8
+ * Use {@linkcode parseAll} for parsing multiple documents in a single YAML
9
+ * string.
10
+ *
11
+ * This package generally supports
12
+ * {@link https://yaml.org/spec/1.2.2/ | YAML 1.2.x} (latest) and some
13
+ * {@link https://yaml.org/spec/1.1/current.html | YAML 1.1} features that are
14
+ * commonly used in the wild.
15
+ *
16
+ * Supported YAML 1.1 features include:
17
+ * - {@link https://yaml.org/type/merge.html | Merge} type (`<<` symbol)
18
+ *
19
+ * Unsupported YAML 1.1 features include:
20
+ * - Yes, No, On, Off literals for bool type
21
+ * - Sexagesimal numbers (e.g. `3:25:45`)
22
+ *
23
+ * ```ts
24
+ * import { parse, stringify } from "@std/yaml";
25
+ * import { assertEquals } from "@std/assert";
26
+ *
27
+ * const data = parse(`
28
+ * foo: bar
29
+ * baz:
30
+ * - qux
31
+ * - quux
32
+ * `);
33
+ * assertEquals(data, { foo: "bar", baz: [ "qux", "quux" ] });
34
+ *
35
+ * const yaml = stringify({ foo: "bar", baz: ["qux", "quux"] });
36
+ * assertEquals(yaml, `foo: bar
37
+ * baz:
38
+ * - qux
39
+ * - quux
40
+ * `);
41
+ * ```
42
+ *
43
+ * ## Limitations
44
+ * - `binary` type is currently not stable.
45
+ *
46
+ * @module
47
+ */
48
+ export * from "./parse.js";
49
+ export * from "./stringify.js";
50
+ export * from "./types.js";
51
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/mod.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,53 @@
1
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
2
+ // Copyright 2018-2026 the Deno authors. MIT license.
3
+ // This module is browser compatible.
4
+ /**
5
+ * {@linkcode parse} and {@linkcode stringify} for handling
6
+ * {@link https://yaml.org/ | YAML} encoded data.
7
+ *
8
+ * Ported from
9
+ * {@link https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da | js-yaml v3.13.1}.
10
+ *
11
+ * Use {@linkcode parseAll} for parsing multiple documents in a single YAML
12
+ * string.
13
+ *
14
+ * This package generally supports
15
+ * {@link https://yaml.org/spec/1.2.2/ | YAML 1.2.x} (latest) and some
16
+ * {@link https://yaml.org/spec/1.1/current.html | YAML 1.1} features that are
17
+ * commonly used in the wild.
18
+ *
19
+ * Supported YAML 1.1 features include:
20
+ * - {@link https://yaml.org/type/merge.html | Merge} type (`<<` symbol)
21
+ *
22
+ * Unsupported YAML 1.1 features include:
23
+ * - Yes, No, On, Off literals for bool type
24
+ * - Sexagesimal numbers (e.g. `3:25:45`)
25
+ *
26
+ * ```ts
27
+ * import { parse, stringify } from "@std/yaml";
28
+ * import { assertEquals } from "@std/assert";
29
+ *
30
+ * const data = parse(`
31
+ * foo: bar
32
+ * baz:
33
+ * - qux
34
+ * - quux
35
+ * `);
36
+ * assertEquals(data, { foo: "bar", baz: [ "qux", "quux" ] });
37
+ *
38
+ * const yaml = stringify({ foo: "bar", baz: ["qux", "quux"] });
39
+ * assertEquals(yaml, `foo: bar
40
+ * baz:
41
+ * - qux
42
+ * - quux
43
+ * `);
44
+ * ```
45
+ *
46
+ * ## Limitations
47
+ * - `binary` type is currently not stable.
48
+ *
49
+ * @module
50
+ */
51
+ export * from "./parse.js";
52
+ export * from "./stringify.js";
53
+ export * from "./types.js";
@@ -0,0 +1,79 @@
1
+ import { type SchemaType } from "./_schema.js";
2
+ import type { YamlSyntaxError } from "./types.js";
3
+ export type { SchemaType };
4
+ /** Options for {@linkcode parse}. */
5
+ export interface ParseOptions {
6
+ /**
7
+ * Name of the schema to use.
8
+ *
9
+ * @default {"default"}
10
+ */
11
+ schema?: SchemaType;
12
+ /**
13
+ * If `true`, duplicate keys will overwrite previous values. Otherwise,
14
+ * duplicate keys will throw a {@linkcode YamlSyntaxError}.
15
+ *
16
+ * @default {false}
17
+ */
18
+ allowDuplicateKeys?: boolean;
19
+ /**
20
+ * If defined, a function to call on warning messages taking a
21
+ * {@linkcode YamlSyntaxError} as its only argument.
22
+ */
23
+ onWarning?(error: YamlSyntaxError): void;
24
+ }
25
+ /**
26
+ * Parse and return a YAML string as a parsed YAML document object.
27
+ *
28
+ * Note: This does not support functions. Untrusted data is safe to parse.
29
+ *
30
+ * @example Usage
31
+ * ```ts
32
+ * import { parse } from "@std/yaml/parse";
33
+ * import { assertEquals } from "@std/assert";
34
+ *
35
+ * const data = parse(`
36
+ * id: 1
37
+ * name: Alice
38
+ * `);
39
+ *
40
+ * assertEquals(data, { id: 1, name: "Alice" });
41
+ * ```
42
+ *
43
+ * @throws {YamlSyntaxError} Throws if the YAML is invalid or contains more
44
+ * than one document.
45
+ * @param content YAML string to parse.
46
+ * @param options Parsing options.
47
+ * @returns Parsed document.
48
+ */
49
+ export declare function parse(content: string, options?: ParseOptions): unknown;
50
+ /**
51
+ * Same as {@linkcode parse}, but understands multi-document YAML sources, and
52
+ * returns multiple parsed YAML document objects.
53
+ *
54
+ * @example Usage
55
+ * ```ts
56
+ * import { parseAll } from "@std/yaml/parse";
57
+ * import { assertEquals } from "@std/assert";
58
+ *
59
+ * const data = parseAll(`
60
+ * ---
61
+ * id: 1
62
+ * name: Alice
63
+ * ---
64
+ * id: 2
65
+ * name: Bob
66
+ * ---
67
+ * id: 3
68
+ * name: Eve
69
+ * `);
70
+ * assertEquals(data, [ { id: 1, name: "Alice" }, { id: 2, name: "Bob" }, { id: 3, name: "Eve" }]);
71
+ * ```
72
+ *
73
+ * @throws {YamlSyntaxError} Throws if the YAML is invalid.
74
+ * @param content YAML string to parse.
75
+ * @param options Parsing options.
76
+ * @returns Array of parsed documents.
77
+ */
78
+ export declare function parseAll(content: string, options?: ParseOptions): unknown[];
79
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/parse.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CAC1C;AAgBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,KAAK,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,OAAO,CAUT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,OAAO,EAAE,CAOX"}
@@ -0,0 +1,91 @@
1
+ // Ported from js-yaml v3.13.1:
2
+ // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
+ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
+ // Copyright 2018-2026 the Deno authors. MIT license.
5
+ // This module is browser compatible.
6
+ import { isEOL } from "./_chars.js";
7
+ import { LoaderState } from "./_loader_state.js";
8
+ import { SCHEMA_MAP } from "./_schema.js";
9
+ function sanitizeInput(input) {
10
+ input = String(input);
11
+ if (input.length > 0) {
12
+ // Add trailing `\n` if not exists
13
+ if (!isEOL(input.charCodeAt(input.length - 1)))
14
+ input += "\n";
15
+ // Strip BOM
16
+ if (input.charCodeAt(0) === 0xfeff)
17
+ input = input.slice(1);
18
+ }
19
+ return input;
20
+ }
21
+ /**
22
+ * Parse and return a YAML string as a parsed YAML document object.
23
+ *
24
+ * Note: This does not support functions. Untrusted data is safe to parse.
25
+ *
26
+ * @example Usage
27
+ * ```ts
28
+ * import { parse } from "@std/yaml/parse";
29
+ * import { assertEquals } from "@std/assert";
30
+ *
31
+ * const data = parse(`
32
+ * id: 1
33
+ * name: Alice
34
+ * `);
35
+ *
36
+ * assertEquals(data, { id: 1, name: "Alice" });
37
+ * ```
38
+ *
39
+ * @throws {YamlSyntaxError} Throws if the YAML is invalid or contains more
40
+ * than one document.
41
+ * @param content YAML string to parse.
42
+ * @param options Parsing options.
43
+ * @returns Parsed document.
44
+ */
45
+ export function parse(content, options = {}) {
46
+ content = sanitizeInput(content);
47
+ const state = new LoaderState(content, {
48
+ ...options,
49
+ schema: SCHEMA_MAP.get(options.schema),
50
+ });
51
+ const documents = state.readDocuments({ singleDocument: true });
52
+ const document = documents.next().value;
53
+ documents.next();
54
+ return document ?? null;
55
+ }
56
+ /**
57
+ * Same as {@linkcode parse}, but understands multi-document YAML sources, and
58
+ * returns multiple parsed YAML document objects.
59
+ *
60
+ * @example Usage
61
+ * ```ts
62
+ * import { parseAll } from "@std/yaml/parse";
63
+ * import { assertEquals } from "@std/assert";
64
+ *
65
+ * const data = parseAll(`
66
+ * ---
67
+ * id: 1
68
+ * name: Alice
69
+ * ---
70
+ * id: 2
71
+ * name: Bob
72
+ * ---
73
+ * id: 3
74
+ * name: Eve
75
+ * `);
76
+ * assertEquals(data, [ { id: 1, name: "Alice" }, { id: 2, name: "Bob" }, { id: 3, name: "Eve" }]);
77
+ * ```
78
+ *
79
+ * @throws {YamlSyntaxError} Throws if the YAML is invalid.
80
+ * @param content YAML string to parse.
81
+ * @param options Parsing options.
82
+ * @returns Array of parsed documents.
83
+ */
84
+ export function parseAll(content, options = {}) {
85
+ content = sanitizeInput(content);
86
+ const state = new LoaderState(content, {
87
+ ...options,
88
+ schema: SCHEMA_MAP.get(options.schema),
89
+ });
90
+ return [...state.readDocuments()];
91
+ }