@ggts-sh/spec 0.43.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 (679) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -0
  3. package/dist/artifact.d.ts +11 -0
  4. package/dist/artifact.d.ts.map +1 -0
  5. package/dist/artifact.js +71 -0
  6. package/dist/artifact.js.map +1 -0
  7. package/dist/builder-core.d.ts +100 -0
  8. package/dist/builder-core.d.ts.map +1 -0
  9. package/dist/builder-core.js +176 -0
  10. package/dist/builder-core.js.map +1 -0
  11. package/dist/builder-data.d.ts +36 -0
  12. package/dist/builder-data.d.ts.map +1 -0
  13. package/dist/builder-data.js +123 -0
  14. package/dist/builder-data.js.map +1 -0
  15. package/dist/builder-geoms.d.ts +128 -0
  16. package/dist/builder-geoms.d.ts.map +1 -0
  17. package/dist/builder-geoms.js +221 -0
  18. package/dist/builder-geoms.js.map +1 -0
  19. package/dist/builder-options.d.ts +323 -0
  20. package/dist/builder-options.d.ts.map +1 -0
  21. package/dist/builder-options.js +2 -0
  22. package/dist/builder-options.js.map +1 -0
  23. package/dist/builder-scales.d.ts +160 -0
  24. package/dist/builder-scales.d.ts.map +1 -0
  25. package/dist/builder-scales.js +322 -0
  26. package/dist/builder-scales.js.map +1 -0
  27. package/dist/builder.d.ts +242 -0
  28. package/dist/builder.d.ts.map +1 -0
  29. package/dist/builder.js +42 -0
  30. package/dist/builder.js.map +1 -0
  31. package/dist/capabilities-data.d.ts +72 -0
  32. package/dist/capabilities-data.d.ts.map +1 -0
  33. package/dist/capabilities-data.js +337 -0
  34. package/dist/capabilities-data.js.map +1 -0
  35. package/dist/capabilities-helpers.d.ts +31 -0
  36. package/dist/capabilities-helpers.d.ts.map +1 -0
  37. package/dist/capabilities-helpers.js +41 -0
  38. package/dist/capabilities-helpers.js.map +1 -0
  39. package/dist/capabilities.d.ts +22 -0
  40. package/dist/capabilities.d.ts.map +1 -0
  41. package/dist/capabilities.js +154 -0
  42. package/dist/capabilities.js.map +1 -0
  43. package/dist/coord-helpers.d.ts +102 -0
  44. package/dist/coord-helpers.d.ts.map +1 -0
  45. package/dist/coord-helpers.js +90 -0
  46. package/dist/coord-helpers.js.map +1 -0
  47. package/dist/coord-reference-build.d.ts +50 -0
  48. package/dist/coord-reference-build.d.ts.map +1 -0
  49. package/dist/coord-reference-build.js +211 -0
  50. package/dist/coord-reference-build.js.map +1 -0
  51. package/dist/coord-reference.d.ts +52 -0
  52. package/dist/coord-reference.d.ts.map +1 -0
  53. package/dist/coord-reference.js +27 -0
  54. package/dist/coord-reference.js.map +1 -0
  55. package/dist/error-catalog.d.ts +258 -0
  56. package/dist/error-catalog.d.ts.map +1 -0
  57. package/dist/error-catalog.js +235 -0
  58. package/dist/error-catalog.js.map +1 -0
  59. package/dist/error-prose-shared.d.ts +100 -0
  60. package/dist/error-prose-shared.d.ts.map +1 -0
  61. package/dist/error-prose-shared.js +95 -0
  62. package/dist/error-prose-shared.js.map +1 -0
  63. package/dist/errors.d.ts +39 -0
  64. package/dist/errors.d.ts.map +1 -0
  65. package/dist/errors.js +52 -0
  66. package/dist/errors.js.map +1 -0
  67. package/dist/generated/coord-reference-data.d.ts +189 -0
  68. package/dist/generated/coord-reference-data.d.ts.map +1 -0
  69. package/dist/generated/coord-reference-data.js +212 -0
  70. package/dist/generated/coord-reference-data.js.map +1 -0
  71. package/dist/generated/geom-param-keys.d.ts +58 -0
  72. package/dist/generated/geom-param-keys.d.ts.map +1 -0
  73. package/dist/generated/geom-param-keys.js +223 -0
  74. package/dist/generated/geom-param-keys.js.map +1 -0
  75. package/dist/generated/geom-reference-data.d.ts +2377 -0
  76. package/dist/generated/geom-reference-data.d.ts.map +1 -0
  77. package/dist/generated/geom-reference-data.js +2790 -0
  78. package/dist/generated/geom-reference-data.js.map +1 -0
  79. package/dist/generated/guide-reference-data.d.ts +219 -0
  80. package/dist/generated/guide-reference-data.d.ts.map +1 -0
  81. package/dist/generated/guide-reference-data.js +253 -0
  82. package/dist/generated/guide-reference-data.js.map +1 -0
  83. package/dist/generated/plot-spec-validator.d.ts +2 -0
  84. package/dist/generated/plot-spec-validator.d.ts.map +1 -0
  85. package/dist/generated/plot-spec-validator.js +6274 -0
  86. package/dist/generated/plot-spec-validator.js.map +1 -0
  87. package/dist/generated/position-reference-data.d.ts +82 -0
  88. package/dist/generated/position-reference-data.d.ts.map +1 -0
  89. package/dist/generated/position-reference-data.js +181 -0
  90. package/dist/generated/position-reference-data.js.map +1 -0
  91. package/dist/generated/scale-reference-data.d.ts +8366 -0
  92. package/dist/generated/scale-reference-data.d.ts.map +1 -0
  93. package/dist/generated/scale-reference-data.js +9821 -0
  94. package/dist/generated/scale-reference-data.js.map +1 -0
  95. package/dist/generated/stat-reference-data.d.ts +241 -0
  96. package/dist/generated/stat-reference-data.d.ts.map +1 -0
  97. package/dist/generated/stat-reference-data.js +311 -0
  98. package/dist/generated/stat-reference-data.js.map +1 -0
  99. package/dist/geom-params-build.d.ts +3 -0
  100. package/dist/geom-params-build.d.ts.map +1 -0
  101. package/dist/geom-params-build.js +80 -0
  102. package/dist/geom-params-build.js.map +1 -0
  103. package/dist/geom-params.d.ts +13 -0
  104. package/dist/geom-params.d.ts.map +1 -0
  105. package/dist/geom-params.js +7 -0
  106. package/dist/geom-params.js.map +1 -0
  107. package/dist/geom-reference-build.d.ts +29 -0
  108. package/dist/geom-reference-build.d.ts.map +1 -0
  109. package/dist/geom-reference-build.js +221 -0
  110. package/dist/geom-reference-build.js.map +1 -0
  111. package/dist/geom-reference.d.ts +52 -0
  112. package/dist/geom-reference.d.ts.map +1 -0
  113. package/dist/geom-reference.js +72 -0
  114. package/dist/geom-reference.js.map +1 -0
  115. package/dist/guide-helpers.d.ts +20 -0
  116. package/dist/guide-helpers.d.ts.map +1 -0
  117. package/dist/guide-helpers.js +25 -0
  118. package/dist/guide-helpers.js.map +1 -0
  119. package/dist/guide-reference-build.d.ts +42 -0
  120. package/dist/guide-reference-build.d.ts.map +1 -0
  121. package/dist/guide-reference-build.js +180 -0
  122. package/dist/guide-reference-build.js.map +1 -0
  123. package/dist/guide-reference.d.ts +48 -0
  124. package/dist/guide-reference.d.ts.map +1 -0
  125. package/dist/guide-reference.js +32 -0
  126. package/dist/guide-reference.js.map +1 -0
  127. package/dist/hue-grey-palettes.d.ts +15 -0
  128. package/dist/hue-grey-palettes.d.ts.map +1 -0
  129. package/dist/hue-grey-palettes.js +77 -0
  130. package/dist/hue-grey-palettes.js.map +1 -0
  131. package/dist/index.d.ts +364 -0
  132. package/dist/index.d.ts.map +1 -0
  133. package/dist/index.js +225 -0
  134. package/dist/index.js.map +1 -0
  135. package/dist/lint-catalog.d.ts +47 -0
  136. package/dist/lint-catalog.d.ts.map +1 -0
  137. package/dist/lint-catalog.js +39 -0
  138. package/dist/lint-catalog.js.map +1 -0
  139. package/dist/lint-layer-rules.d.ts +18 -0
  140. package/dist/lint-layer-rules.d.ts.map +1 -0
  141. package/dist/lint-layer-rules.js +145 -0
  142. package/dist/lint-layer-rules.js.map +1 -0
  143. package/dist/lint-scale-rules.d.ts +8 -0
  144. package/dist/lint-scale-rules.d.ts.map +1 -0
  145. package/dist/lint-scale-rules.js +254 -0
  146. package/dist/lint-scale-rules.js.map +1 -0
  147. package/dist/lint.d.ts +62 -0
  148. package/dist/lint.d.ts.map +1 -0
  149. package/dist/lint.js +57 -0
  150. package/dist/lint.js.map +1 -0
  151. package/dist/normalize-coord.d.ts +8 -0
  152. package/dist/normalize-coord.d.ts.map +1 -0
  153. package/dist/normalize-coord.js +123 -0
  154. package/dist/normalize-coord.js.map +1 -0
  155. package/dist/normalize-input-layers-marks.d.ts +208 -0
  156. package/dist/normalize-input-layers-marks.d.ts.map +1 -0
  157. package/dist/normalize-input-layers-marks.js +2 -0
  158. package/dist/normalize-input-layers-marks.js.map +1 -0
  159. package/dist/normalize-input-layers-special.d.ts +131 -0
  160. package/dist/normalize-input-layers-special.d.ts.map +1 -0
  161. package/dist/normalize-input-layers-special.js +2 -0
  162. package/dist/normalize-input-layers-special.js.map +1 -0
  163. package/dist/normalize-input.d.ts +81 -0
  164. package/dist/normalize-input.d.ts.map +1 -0
  165. package/dist/normalize-input.js +2 -0
  166. package/dist/normalize-input.js.map +1 -0
  167. package/dist/normalize-paint.d.ts +8 -0
  168. package/dist/normalize-paint.d.ts.map +1 -0
  169. package/dist/normalize-paint.js +83 -0
  170. package/dist/normalize-paint.js.map +1 -0
  171. package/dist/normalize-scales.d.ts +7 -0
  172. package/dist/normalize-scales.d.ts.map +1 -0
  173. package/dist/normalize-scales.js +90 -0
  174. package/dist/normalize-scales.js.map +1 -0
  175. package/dist/normalize.d.ts +46 -0
  176. package/dist/normalize.d.ts.map +1 -0
  177. package/dist/normalize.js +279 -0
  178. package/dist/normalize.js.map +1 -0
  179. package/dist/paint-helpers.d.ts +45 -0
  180. package/dist/paint-helpers.d.ts.map +1 -0
  181. package/dist/paint-helpers.js +48 -0
  182. package/dist/paint-helpers.js.map +1 -0
  183. package/dist/pipeline-error-catalog.d.ts +319 -0
  184. package/dist/pipeline-error-catalog.d.ts.map +1 -0
  185. package/dist/pipeline-error-catalog.js +260 -0
  186. package/dist/pipeline-error-catalog.js.map +1 -0
  187. package/dist/portability-check.d.ts +35 -0
  188. package/dist/portability-check.d.ts.map +1 -0
  189. package/dist/portability-check.js +121 -0
  190. package/dist/portability-check.js.map +1 -0
  191. package/dist/portability-lossy.d.ts +19 -0
  192. package/dist/portability-lossy.d.ts.map +1 -0
  193. package/dist/portability-lossy.js +65 -0
  194. package/dist/portability-lossy.js.map +1 -0
  195. package/dist/portability.d.ts +23 -0
  196. package/dist/portability.d.ts.map +1 -0
  197. package/dist/portability.js +23 -0
  198. package/dist/portability.js.map +1 -0
  199. package/dist/portable-builder.d.ts +215 -0
  200. package/dist/portable-builder.d.ts.map +1 -0
  201. package/dist/portable-builder.js +27 -0
  202. package/dist/portable-builder.js.map +1 -0
  203. package/dist/portable-entry.d.ts +16 -0
  204. package/dist/portable-entry.d.ts.map +1 -0
  205. package/dist/portable-entry.js +14 -0
  206. package/dist/portable-entry.js.map +1 -0
  207. package/dist/position-reference-build.d.ts +29 -0
  208. package/dist/position-reference-build.d.ts.map +1 -0
  209. package/dist/position-reference-build.js +115 -0
  210. package/dist/position-reference-build.js.map +1 -0
  211. package/dist/position-reference.d.ts +34 -0
  212. package/dist/position-reference.d.ts.map +1 -0
  213. package/dist/position-reference.js +19 -0
  214. package/dist/position-reference.js.map +1 -0
  215. package/dist/runtime.d.ts +139 -0
  216. package/dist/runtime.d.ts.map +1 -0
  217. package/dist/runtime.js +2 -0
  218. package/dist/runtime.js.map +1 -0
  219. package/dist/scale-color-helpers.d.ts +121 -0
  220. package/dist/scale-color-helpers.d.ts.map +1 -0
  221. package/dist/scale-color-helpers.js +188 -0
  222. package/dist/scale-color-helpers.js.map +1 -0
  223. package/dist/scale-color-hue-grey.d.ts +52 -0
  224. package/dist/scale-color-hue-grey.d.ts.map +1 -0
  225. package/dist/scale-color-hue-grey.js +60 -0
  226. package/dist/scale-color-hue-grey.js.map +1 -0
  227. package/dist/scale-color-stops.d.ts +85 -0
  228. package/dist/scale-color-stops.d.ts.map +1 -0
  229. package/dist/scale-color-stops.js +87 -0
  230. package/dist/scale-color-stops.js.map +1 -0
  231. package/dist/scale-color-viridis.d.ts +52 -0
  232. package/dist/scale-color-viridis.d.ts.map +1 -0
  233. package/dist/scale-color-viridis.js +68 -0
  234. package/dist/scale-color-viridis.js.map +1 -0
  235. package/dist/scale-helpers.d.ts +20 -0
  236. package/dist/scale-helpers.d.ts.map +1 -0
  237. package/dist/scale-helpers.js +20 -0
  238. package/dist/scale-helpers.js.map +1 -0
  239. package/dist/scale-multi-helpers.d.ts +61 -0
  240. package/dist/scale-multi-helpers.d.ts.map +1 -0
  241. package/dist/scale-multi-helpers.js +147 -0
  242. package/dist/scale-multi-helpers.js.map +1 -0
  243. package/dist/scale-position-helpers.d.ts +81 -0
  244. package/dist/scale-position-helpers.d.ts.map +1 -0
  245. package/dist/scale-position-helpers.js +133 -0
  246. package/dist/scale-position-helpers.js.map +1 -0
  247. package/dist/scale-reference-build.d.ts +50 -0
  248. package/dist/scale-reference-build.d.ts.map +1 -0
  249. package/dist/scale-reference-build.js +147 -0
  250. package/dist/scale-reference-build.js.map +1 -0
  251. package/dist/scale-reference-classify-color.d.ts +11 -0
  252. package/dist/scale-reference-classify-color.d.ts.map +1 -0
  253. package/dist/scale-reference-classify-color.js +292 -0
  254. package/dist/scale-reference-classify-color.js.map +1 -0
  255. package/dist/scale-reference-classify-position.d.ts +10 -0
  256. package/dist/scale-reference-classify-position.d.ts.map +1 -0
  257. package/dist/scale-reference-classify-position.js +137 -0
  258. package/dist/scale-reference-classify-position.js.map +1 -0
  259. package/dist/scale-reference-classify-style.d.ts +10 -0
  260. package/dist/scale-reference-classify-style.d.ts.map +1 -0
  261. package/dist/scale-reference-classify-style.js +194 -0
  262. package/dist/scale-reference-classify-style.js.map +1 -0
  263. package/dist/scale-reference-classify-support.d.ts +37 -0
  264. package/dist/scale-reference-classify-support.d.ts.map +1 -0
  265. package/dist/scale-reference-classify-support.js +206 -0
  266. package/dist/scale-reference-classify-support.js.map +1 -0
  267. package/dist/scale-reference.d.ts +80 -0
  268. package/dist/scale-reference.d.ts.map +1 -0
  269. package/dist/scale-reference.js +85 -0
  270. package/dist/scale-reference.js.map +1 -0
  271. package/dist/scale-style-helpers.d.ts +158 -0
  272. package/dist/scale-style-helpers.d.ts.map +1 -0
  273. package/dist/scale-style-helpers.js +197 -0
  274. package/dist/scale-style-helpers.js.map +1 -0
  275. package/dist/schema-catalog.d.ts +62 -0
  276. package/dist/schema-catalog.d.ts.map +1 -0
  277. package/dist/schema-catalog.js +208 -0
  278. package/dist/schema-catalog.js.map +1 -0
  279. package/dist/schema-declarations.d.ts +1585 -0
  280. package/dist/schema-declarations.d.ts.map +1 -0
  281. package/dist/schema-declarations.js +51 -0
  282. package/dist/schema-declarations.js.map +1 -0
  283. package/dist/schema-decls-data.d.ts +58 -0
  284. package/dist/schema-decls-data.d.ts.map +1 -0
  285. package/dist/schema-decls-data.js +151 -0
  286. package/dist/schema-decls-data.js.map +1 -0
  287. package/dist/schema-decls-guides-theme.d.ts +166 -0
  288. package/dist/schema-decls-guides-theme.d.ts.map +1 -0
  289. package/dist/schema-decls-guides-theme.js +251 -0
  290. package/dist/schema-decls-guides-theme.js.map +1 -0
  291. package/dist/schema-decls-layers-col-boxplot.d.ts +118 -0
  292. package/dist/schema-decls-layers-col-boxplot.d.ts.map +1 -0
  293. package/dist/schema-decls-layers-col-boxplot.js +239 -0
  294. package/dist/schema-decls-layers-col-boxplot.js.map +1 -0
  295. package/dist/schema-decls-layers-count-pointrange.d.ts +89 -0
  296. package/dist/schema-decls-layers-count-pointrange.d.ts.map +1 -0
  297. package/dist/schema-decls-layers-count-pointrange.js +190 -0
  298. package/dist/schema-decls-layers-count-pointrange.js.map +1 -0
  299. package/dist/schema-decls-layers-crossbar-jitter.d.ts +129 -0
  300. package/dist/schema-decls-layers-crossbar-jitter.d.ts.map +1 -0
  301. package/dist/schema-decls-layers-crossbar-jitter.js +255 -0
  302. package/dist/schema-decls-layers-crossbar-jitter.js.map +1 -0
  303. package/dist/schema-decls-layers-point-path.d.ts +49 -0
  304. package/dist/schema-decls-layers-point-path.d.ts.map +1 -0
  305. package/dist/schema-decls-layers-point-path.js +156 -0
  306. package/dist/schema-decls-layers-point-path.js.map +1 -0
  307. package/dist/schema-decls-layers-sf-blank.d.ts +89 -0
  308. package/dist/schema-decls-layers-sf-blank.d.ts.map +1 -0
  309. package/dist/schema-decls-layers-sf-blank.js +254 -0
  310. package/dist/schema-decls-layers-sf-blank.js.map +1 -0
  311. package/dist/schema-decls-layers-text-map.d.ts +80 -0
  312. package/dist/schema-decls-layers-text-map.d.ts.map +1 -0
  313. package/dist/schema-decls-layers-text-map.js +151 -0
  314. package/dist/schema-decls-layers-text-map.js.map +1 -0
  315. package/dist/schema-decls-paint.d.ts +39 -0
  316. package/dist/schema-decls-paint.d.ts.map +1 -0
  317. package/dist/schema-decls-paint.js +95 -0
  318. package/dist/schema-decls-paint.js.map +1 -0
  319. package/dist/schema-decls-params-area-abline.d.ts +85 -0
  320. package/dist/schema-decls-params-area-abline.d.ts.map +1 -0
  321. package/dist/schema-decls-params-area-abline.js +259 -0
  322. package/dist/schema-decls-params-area-abline.js.map +1 -0
  323. package/dist/schema-decls-params-col-contour.d.ts +61 -0
  324. package/dist/schema-decls-params-col-contour.d.ts.map +1 -0
  325. package/dist/schema-decls-params-col-contour.js +202 -0
  326. package/dist/schema-decls-params-col-contour.js.map +1 -0
  327. package/dist/schema-decls-params-curve-label.d.ts +64 -0
  328. package/dist/schema-decls-params-curve-label.d.ts.map +1 -0
  329. package/dist/schema-decls-params-curve-label.js +204 -0
  330. package/dist/schema-decls-params-curve-label.js.map +1 -0
  331. package/dist/schema-decls-params-errorbar-position.d.ts +83 -0
  332. package/dist/schema-decls-params-errorbar-position.d.ts.map +1 -0
  333. package/dist/schema-decls-params-errorbar-position.js +264 -0
  334. package/dist/schema-decls-params-errorbar-position.js.map +1 -0
  335. package/dist/schema-decls-params-point-path.d.ts +61 -0
  336. package/dist/schema-decls-params-point-path.d.ts.map +1 -0
  337. package/dist/schema-decls-params-point-path.js +240 -0
  338. package/dist/schema-decls-params-point-path.js.map +1 -0
  339. package/dist/schema-decls-params-violin-summary.d.ts +78 -0
  340. package/dist/schema-decls-params-violin-summary.d.ts.map +1 -0
  341. package/dist/schema-decls-params-violin-summary.js +272 -0
  342. package/dist/schema-decls-params-violin-summary.js.map +1 -0
  343. package/dist/schema-decls-plot.d.ts +80 -0
  344. package/dist/schema-decls-plot.d.ts.map +1 -0
  345. package/dist/schema-decls-plot.js +222 -0
  346. package/dist/schema-decls-plot.js.map +1 -0
  347. package/dist/schema-decls-scales-guides.d.ts +291 -0
  348. package/dist/schema-decls-scales-guides.d.ts.map +1 -0
  349. package/dist/schema-decls-scales-guides.js +189 -0
  350. package/dist/schema-decls-scales-guides.js.map +1 -0
  351. package/dist/schema-decls-scales.d.ts +124 -0
  352. package/dist/schema-decls-scales.d.ts.map +1 -0
  353. package/dist/schema-decls-scales.js +279 -0
  354. package/dist/schema-decls-scales.js.map +1 -0
  355. package/dist/schema-imports.d.ts +1679 -0
  356. package/dist/schema-imports.d.ts.map +1 -0
  357. package/dist/schema-imports.js +104 -0
  358. package/dist/schema-imports.js.map +1 -0
  359. package/dist/schema-name-schemas.d.ts +18 -0
  360. package/dist/schema-name-schemas.d.ts.map +1 -0
  361. package/dist/schema-name-schemas.js +13 -0
  362. package/dist/schema-name-schemas.js.map +1 -0
  363. package/dist/schema-names.d.ts +53 -0
  364. package/dist/schema-names.d.ts.map +1 -0
  365. package/dist/schema-names.js +229 -0
  366. package/dist/schema-names.js.map +1 -0
  367. package/dist/schema-types.d.ts +336 -0
  368. package/dist/schema-types.d.ts.map +1 -0
  369. package/dist/schema-types.js +10 -0
  370. package/dist/schema-types.js.map +1 -0
  371. package/dist/schema.d.ts +38 -0
  372. package/dist/schema.d.ts.map +1 -0
  373. package/dist/schema.js +34 -0
  374. package/dist/schema.js.map +1 -0
  375. package/dist/stat-reference-build.d.ts +24 -0
  376. package/dist/stat-reference-build.d.ts.map +1 -0
  377. package/dist/stat-reference-build.js +86 -0
  378. package/dist/stat-reference-build.js.map +1 -0
  379. package/dist/stat-reference.d.ts +33 -0
  380. package/dist/stat-reference.d.ts.map +1 -0
  381. package/dist/stat-reference.js +19 -0
  382. package/dist/stat-reference.js.map +1 -0
  383. package/dist/structural-gate.d.ts +15 -0
  384. package/dist/structural-gate.d.ts.map +1 -0
  385. package/dist/structural-gate.js +34 -0
  386. package/dist/structural-gate.js.map +1 -0
  387. package/dist/temporal-column.d.ts +33 -0
  388. package/dist/temporal-column.d.ts.map +1 -0
  389. package/dist/temporal-column.js +247 -0
  390. package/dist/temporal-column.js.map +1 -0
  391. package/dist/temporal-guides.d.ts +11 -0
  392. package/dist/temporal-guides.d.ts.map +1 -0
  393. package/dist/temporal-guides.js +11 -0
  394. package/dist/temporal-guides.js.map +1 -0
  395. package/dist/temporal-interval-schema.d.ts +9 -0
  396. package/dist/temporal-interval-schema.d.ts.map +1 -0
  397. package/dist/temporal-interval-schema.js +25 -0
  398. package/dist/temporal-interval-schema.js.map +1 -0
  399. package/dist/temporal-interval.d.ts +29 -0
  400. package/dist/temporal-interval.d.ts.map +1 -0
  401. package/dist/temporal-interval.js +122 -0
  402. package/dist/temporal-interval.js.map +1 -0
  403. package/dist/temporal-parse-core.d.ts +96 -0
  404. package/dist/temporal-parse-core.d.ts.map +1 -0
  405. package/dist/temporal-parse-core.js +235 -0
  406. package/dist/temporal-parse-core.js.map +1 -0
  407. package/dist/temporal-parse-format.d.ts +13 -0
  408. package/dist/temporal-parse-format.d.ts.map +1 -0
  409. package/dist/temporal-parse-format.js +180 -0
  410. package/dist/temporal-parse-format.js.map +1 -0
  411. package/dist/temporal-parse-schema.d.ts +11 -0
  412. package/dist/temporal-parse-schema.d.ts.map +1 -0
  413. package/dist/temporal-parse-schema.js +23 -0
  414. package/dist/temporal-parse-schema.js.map +1 -0
  415. package/dist/temporal-parse.d.ts +18 -0
  416. package/dist/temporal-parse.d.ts.map +1 -0
  417. package/dist/temporal-parse.js +183 -0
  418. package/dist/temporal-parse.js.map +1 -0
  419. package/dist/temporal-polyfill.d.ts +3 -0
  420. package/dist/temporal-polyfill.d.ts.map +1 -0
  421. package/dist/temporal-polyfill.js +25 -0
  422. package/dist/temporal-polyfill.js.map +1 -0
  423. package/dist/temporal-ticks.d.ts +20 -0
  424. package/dist/temporal-ticks.d.ts.map +1 -0
  425. package/dist/temporal-ticks.js +246 -0
  426. package/dist/temporal-ticks.js.map +1 -0
  427. package/dist/temporal.d.ts +109 -0
  428. package/dist/temporal.d.ts.map +1 -0
  429. package/dist/temporal.js +73 -0
  430. package/dist/temporal.js.map +1 -0
  431. package/dist/validate-data-checks-color-temporal.d.ts +58 -0
  432. package/dist/validate-data-checks-color-temporal.d.ts.map +1 -0
  433. package/dist/validate-data-checks-color-temporal.js +168 -0
  434. package/dist/validate-data-checks-color-temporal.js.map +1 -0
  435. package/dist/validate-data-checks-color.d.ts +28 -0
  436. package/dist/validate-data-checks-color.d.ts.map +1 -0
  437. package/dist/validate-data-checks-color.js +296 -0
  438. package/dist/validate-data-checks-color.js.map +1 -0
  439. package/dist/validate-data-checks-layer.d.ts +37 -0
  440. package/dist/validate-data-checks-layer.d.ts.map +1 -0
  441. package/dist/validate-data-checks-layer.js +343 -0
  442. package/dist/validate-data-checks-layer.js.map +1 -0
  443. package/dist/validate-data-checks-position.d.ts +45 -0
  444. package/dist/validate-data-checks-position.d.ts.map +1 -0
  445. package/dist/validate-data-checks-position.js +204 -0
  446. package/dist/validate-data-checks-position.js.map +1 -0
  447. package/dist/validate-data-checks-style-finite.d.ts +24 -0
  448. package/dist/validate-data-checks-style-finite.d.ts.map +1 -0
  449. package/dist/validate-data-checks-style-finite.js +40 -0
  450. package/dist/validate-data-checks-style-finite.js.map +1 -0
  451. package/dist/validate-data-checks-style-numeric.d.ts +26 -0
  452. package/dist/validate-data-checks-style-numeric.d.ts.map +1 -0
  453. package/dist/validate-data-checks-style-numeric.js +327 -0
  454. package/dist/validate-data-checks-style-numeric.js.map +1 -0
  455. package/dist/validate-data-checks-style.d.ts +14 -0
  456. package/dist/validate-data-checks-style.d.ts.map +1 -0
  457. package/dist/validate-data-checks-style.js +14 -0
  458. package/dist/validate-data-checks-style.js.map +1 -0
  459. package/dist/validate-data-checks-temporal.d.ts +57 -0
  460. package/dist/validate-data-checks-temporal.d.ts.map +1 -0
  461. package/dist/validate-data-checks-temporal.js +83 -0
  462. package/dist/validate-data-checks-temporal.js.map +1 -0
  463. package/dist/validate-data-checks.d.ts +31 -0
  464. package/dist/validate-data-checks.d.ts.map +1 -0
  465. package/dist/validate-data-checks.js +110 -0
  466. package/dist/validate-data-checks.js.map +1 -0
  467. package/dist/validate-data-evidence.d.ts +69 -0
  468. package/dist/validate-data-evidence.d.ts.map +1 -0
  469. package/dist/validate-data-evidence.js +329 -0
  470. package/dist/validate-data-evidence.js.map +1 -0
  471. package/dist/validate-data.d.ts +73 -0
  472. package/dist/validate-data.d.ts.map +1 -0
  473. package/dist/validate-data.js +30 -0
  474. package/dist/validate-data.js.map +1 -0
  475. package/dist/validate-map-errors.d.ts +32 -0
  476. package/dist/validate-map-errors.d.ts.map +1 -0
  477. package/dist/validate-map-errors.js +76 -0
  478. package/dist/validate-map-errors.js.map +1 -0
  479. package/dist/validate-map-forms.d.ts +43 -0
  480. package/dist/validate-map-forms.d.ts.map +1 -0
  481. package/dist/validate-map-forms.js +125 -0
  482. package/dist/validate-map-forms.js.map +1 -0
  483. package/dist/validate-map-path-keywords.d.ts +11 -0
  484. package/dist/validate-map-path-keywords.d.ts.map +1 -0
  485. package/dist/validate-map-path-keywords.js +95 -0
  486. package/dist/validate-map-path-keywords.js.map +1 -0
  487. package/dist/validate-map-path-unions.d.ts +27 -0
  488. package/dist/validate-map-path-unions.d.ts.map +1 -0
  489. package/dist/validate-map-path-unions.js +200 -0
  490. package/dist/validate-map-path-unions.js.map +1 -0
  491. package/dist/validate-schema-shape.d.ts +69 -0
  492. package/dist/validate-schema-shape.d.ts.map +1 -0
  493. package/dist/validate-schema-shape.js +156 -0
  494. package/dist/validate-schema-shape.js.map +1 -0
  495. package/dist/validate-schema-walk.d.ts +34 -0
  496. package/dist/validate-schema-walk.d.ts.map +1 -0
  497. package/dist/validate-schema-walk.js +216 -0
  498. package/dist/validate-schema-walk.js.map +1 -0
  499. package/dist/validate-structure-facet.d.ts +8 -0
  500. package/dist/validate-structure-facet.d.ts.map +1 -0
  501. package/dist/validate-structure-facet.js +67 -0
  502. package/dist/validate-structure-facet.js.map +1 -0
  503. package/dist/validate-structure-layer-computed-y.d.ts +14 -0
  504. package/dist/validate-structure-layer-computed-y.d.ts.map +1 -0
  505. package/dist/validate-structure-layer-computed-y.js +70 -0
  506. package/dist/validate-structure-layer-computed-y.js.map +1 -0
  507. package/dist/validate-structure-layer-ribbon.d.ts +8 -0
  508. package/dist/validate-structure-layer-ribbon.d.ts.map +1 -0
  509. package/dist/validate-structure-layer-ribbon.js +36 -0
  510. package/dist/validate-structure-layer-ribbon.js.map +1 -0
  511. package/dist/validate-structure-layer-rule.d.ts +14 -0
  512. package/dist/validate-structure-layer-rule.d.ts.map +1 -0
  513. package/dist/validate-structure-layer-rule.js +90 -0
  514. package/dist/validate-structure-layer-rule.js.map +1 -0
  515. package/dist/validate-structure-layer-shared.d.ts +12 -0
  516. package/dist/validate-structure-layer-shared.d.ts.map +1 -0
  517. package/dist/validate-structure-layer-shared.js +17 -0
  518. package/dist/validate-structure-layer-shared.js.map +1 -0
  519. package/dist/validate-structure-layers.d.ts +12 -0
  520. package/dist/validate-structure-layers.d.ts.map +1 -0
  521. package/dist/validate-structure-layers.js +292 -0
  522. package/dist/validate-structure-layers.js.map +1 -0
  523. package/dist/validate-structure-paint.d.ts +12 -0
  524. package/dist/validate-structure-paint.d.ts.map +1 -0
  525. package/dist/validate-structure-paint.js +87 -0
  526. package/dist/validate-structure-paint.js.map +1 -0
  527. package/dist/validate-structure-scales.d.ts +10 -0
  528. package/dist/validate-structure-scales.d.ts.map +1 -0
  529. package/dist/validate-structure-scales.js +242 -0
  530. package/dist/validate-structure-scales.js.map +1 -0
  531. package/dist/validate-structure-style-bins.d.ts +17 -0
  532. package/dist/validate-structure-style-bins.d.ts.map +1 -0
  533. package/dist/validate-structure-style-bins.js +150 -0
  534. package/dist/validate-structure-style-bins.js.map +1 -0
  535. package/dist/validate-structure.d.ts +16 -0
  536. package/dist/validate-structure.d.ts.map +1 -0
  537. package/dist/validate-structure.js +16 -0
  538. package/dist/validate-structure.js.map +1 -0
  539. package/dist/validate.d.ts +24 -0
  540. package/dist/validate.d.ts.map +1 -0
  541. package/dist/validate.js +178 -0
  542. package/dist/validate.js.map +1 -0
  543. package/package.json +59 -0
  544. package/schema/v0.json +9618 -0
  545. package/src/artifact.ts +81 -0
  546. package/src/builder-core.ts +276 -0
  547. package/src/builder-data.ts +156 -0
  548. package/src/builder-geoms.ts +290 -0
  549. package/src/builder-options.ts +428 -0
  550. package/src/builder-scales.ts +443 -0
  551. package/src/builder.ts +125 -0
  552. package/src/capabilities-data.ts +336 -0
  553. package/src/capabilities-helpers.ts +54 -0
  554. package/src/capabilities.ts +159 -0
  555. package/src/coord-helpers.ts +177 -0
  556. package/src/coord-reference-build.ts +283 -0
  557. package/src/coord-reference.ts +75 -0
  558. package/src/error-catalog.ts +253 -0
  559. package/src/error-prose-shared.ts +106 -0
  560. package/src/errors.ts +87 -0
  561. package/src/generated/coord-reference-data.ts +235 -0
  562. package/src/generated/geom-param-keys.ts +222 -0
  563. package/src/generated/geom-reference-data.ts +3024 -0
  564. package/src/generated/guide-reference-data.ts +284 -0
  565. package/src/generated/plot-spec-validator.ts +7335 -0
  566. package/src/generated/position-reference-data.ts +191 -0
  567. package/src/generated/scale-reference-data.ts +10665 -0
  568. package/src/generated/stat-reference-data.ts +339 -0
  569. package/src/geom-params-build.ts +92 -0
  570. package/src/geom-params.ts +14 -0
  571. package/src/geom-reference-build.ts +292 -0
  572. package/src/geom-reference.ts +127 -0
  573. package/src/guide-helpers.ts +44 -0
  574. package/src/guide-reference-build.ts +249 -0
  575. package/src/guide-reference.ts +76 -0
  576. package/src/hue-grey-palettes.ts +82 -0
  577. package/src/index.ts +400 -0
  578. package/src/lint-catalog.ts +57 -0
  579. package/src/lint-layer-rules.ts +175 -0
  580. package/src/lint-scale-rules.ts +285 -0
  581. package/src/lint.ts +126 -0
  582. package/src/normalize-coord.ts +126 -0
  583. package/src/normalize-input-layers-marks.ts +276 -0
  584. package/src/normalize-input-layers-special.ts +252 -0
  585. package/src/normalize-input.ts +154 -0
  586. package/src/normalize-paint.ts +98 -0
  587. package/src/normalize-scales.ts +108 -0
  588. package/src/normalize.ts +403 -0
  589. package/src/paint-helpers.ts +98 -0
  590. package/src/pipeline-error-catalog.ts +278 -0
  591. package/src/portability-check.ts +155 -0
  592. package/src/portability-lossy.ts +81 -0
  593. package/src/portability.ts +31 -0
  594. package/src/portable-builder.ts +35 -0
  595. package/src/portable-entry.ts +37 -0
  596. package/src/position-reference-build.ts +164 -0
  597. package/src/position-reference.ts +41 -0
  598. package/src/runtime.ts +198 -0
  599. package/src/scale-color-helpers.ts +263 -0
  600. package/src/scale-color-hue-grey.ts +95 -0
  601. package/src/scale-color-stops.ts +177 -0
  602. package/src/scale-color-viridis.ts +99 -0
  603. package/src/scale-helpers.ts +264 -0
  604. package/src/scale-multi-helpers.ts +220 -0
  605. package/src/scale-position-helpers.ts +231 -0
  606. package/src/scale-reference-build.ts +222 -0
  607. package/src/scale-reference-classify-color.ts +334 -0
  608. package/src/scale-reference-classify-position.ts +164 -0
  609. package/src/scale-reference-classify-style.ts +229 -0
  610. package/src/scale-reference-classify-support.ts +298 -0
  611. package/src/scale-reference.ts +165 -0
  612. package/src/scale-style-helpers.ts +316 -0
  613. package/src/schema-catalog.ts +222 -0
  614. package/src/schema-declarations.ts +51 -0
  615. package/src/schema-decls-data.ts +272 -0
  616. package/src/schema-decls-guides-theme.ts +395 -0
  617. package/src/schema-decls-layers-col-boxplot.ts +410 -0
  618. package/src/schema-decls-layers-count-pointrange.ts +321 -0
  619. package/src/schema-decls-layers-crossbar-jitter.ts +443 -0
  620. package/src/schema-decls-layers-point-path.ts +246 -0
  621. package/src/schema-decls-layers-sf-blank.ts +408 -0
  622. package/src/schema-decls-layers-text-map.ts +259 -0
  623. package/src/schema-decls-paint.ts +124 -0
  624. package/src/schema-decls-params-area-abline.ts +440 -0
  625. package/src/schema-decls-params-col-contour.ts +333 -0
  626. package/src/schema-decls-params-curve-label.ts +343 -0
  627. package/src/schema-decls-params-errorbar-position.ts +446 -0
  628. package/src/schema-decls-params-point-path.ts +394 -0
  629. package/src/schema-decls-params-violin-summary.ts +447 -0
  630. package/src/schema-decls-plot.ts +385 -0
  631. package/src/schema-decls-scales-guides.ts +233 -0
  632. package/src/schema-decls-scales.ts +432 -0
  633. package/src/schema-imports.ts +116 -0
  634. package/src/schema-name-schemas.ts +37 -0
  635. package/src/schema-names.ts +243 -0
  636. package/src/schema-types.ts +400 -0
  637. package/src/schema.ts +287 -0
  638. package/src/stat-reference-build.ts +145 -0
  639. package/src/stat-reference.ts +38 -0
  640. package/src/structural-gate.ts +42 -0
  641. package/src/temporal-column.ts +323 -0
  642. package/src/temporal-guides.ts +32 -0
  643. package/src/temporal-interval-schema.ts +40 -0
  644. package/src/temporal-interval.ts +151 -0
  645. package/src/temporal-parse-core.ts +331 -0
  646. package/src/temporal-parse-format.ts +222 -0
  647. package/src/temporal-parse-schema.ts +38 -0
  648. package/src/temporal-parse.ts +259 -0
  649. package/src/temporal-polyfill.ts +27 -0
  650. package/src/temporal-ticks.ts +312 -0
  651. package/src/temporal.ts +112 -0
  652. package/src/validate-data-checks-color-temporal.ts +261 -0
  653. package/src/validate-data-checks-color.ts +395 -0
  654. package/src/validate-data-checks-layer.ts +492 -0
  655. package/src/validate-data-checks-position.ts +275 -0
  656. package/src/validate-data-checks-style-finite.ts +55 -0
  657. package/src/validate-data-checks-style-numeric.ts +455 -0
  658. package/src/validate-data-checks-style.ts +13 -0
  659. package/src/validate-data-checks-temporal.ts +129 -0
  660. package/src/validate-data-checks.ts +157 -0
  661. package/src/validate-data-evidence.ts +419 -0
  662. package/src/validate-data.ts +114 -0
  663. package/src/validate-map-errors.ts +126 -0
  664. package/src/validate-map-forms.ts +148 -0
  665. package/src/validate-map-path-keywords.ts +129 -0
  666. package/src/validate-map-path-unions.ts +281 -0
  667. package/src/validate-schema-shape.ts +232 -0
  668. package/src/validate-schema-walk.ts +219 -0
  669. package/src/validate-structure-facet.ts +76 -0
  670. package/src/validate-structure-layer-computed-y.ts +94 -0
  671. package/src/validate-structure-layer-ribbon.ts +61 -0
  672. package/src/validate-structure-layer-rule.ts +98 -0
  673. package/src/validate-structure-layer-shared.ts +29 -0
  674. package/src/validate-structure-layers.ts +395 -0
  675. package/src/validate-structure-paint.ts +101 -0
  676. package/src/validate-structure-scales.ts +278 -0
  677. package/src/validate-structure-style-bins.ts +167 -0
  678. package/src/validate-structure.ts +16 -0
  679. package/src/validate.ts +212 -0
@@ -0,0 +1,126 @@
1
+ /**
2
+ * TypeBox 1.x validation errors → agent SpecError mapping (tier-1).
3
+ *
4
+ * TypeBox 1.x (`typebox`) reports JSON-Schema-style errors (`keyword`,
5
+ * `instancePath`, `params`) rather than 0.x `ValueErrorType` + embedded
6
+ * schema/value. Discriminator-aware union classification (channel forms,
7
+ * data refs, const enums) is reconstructed from keywords + schema lookup
8
+ * against the Cyclic root being validated.
9
+ *
10
+ * Schema / path inspection: validate-schema-walk.ts.
11
+ * Channel/data form classification: validate-map-forms.ts.
12
+ * Union path mapping: validate-map-path-unions.ts.
13
+ * Keyword path mapping: validate-map-path-keywords.ts.
14
+ * Used only by validate() — not part of the package public surface.
15
+ */
16
+ import type { TLocalizedValidationError } from "typebox/error";
17
+
18
+ import type { SpecError } from "./errors.js";
19
+ import { didYouMean } from "./errors.js";
20
+ import { KNOWN_GEOMS } from "./schema-catalog.js";
21
+ import { lastSegment, pointerGet } from "./validate-schema-walk.js";
22
+ import { mapKeywordPathGroup } from "./validate-map-path-keywords.js";
23
+ import { mapUnionPathGroup } from "./validate-map-path-unions.js";
24
+
25
+ export interface MapErrorsContext {
26
+ /** Schema root passed to Value.Errors (Cyclic `$defs`+`$ref`). */
27
+ schema: unknown;
28
+ /** Value that was validated (for reading failing values via instancePath). */
29
+ value: unknown;
30
+ /** Path prefix prepended to each instancePath (e.g. `/layers/0`). */
31
+ pathPrefix: string;
32
+ }
33
+
34
+ /**
35
+ * Map a batch of TypeBox 1.x validation errors into agent SpecErrors.
36
+ * Groups const/anyOf noise so enum and channel unions surface as one error.
37
+ */
38
+ export function mapValueErrors(
39
+ rawErrors: readonly TLocalizedValidationError[],
40
+ ctx: MapErrorsContext,
41
+ ): SpecError[] {
42
+ if (rawErrors.length === 0) return [];
43
+
44
+ // Group by instancePath so multi-const anyOf enums collapse.
45
+ const byPath = new Map<string, TLocalizedValidationError[]>();
46
+ for (const err of rawErrors) {
47
+ const list = byPath.get(err.instancePath) ?? [];
48
+ list.push(err);
49
+ byPath.set(err.instancePath, list);
50
+ }
51
+
52
+ const out: SpecError[] = [];
53
+ for (const [instancePath, group] of byPath) {
54
+ out.push(...mapPathGroup(instancePath, group, ctx));
55
+ }
56
+ return out;
57
+ }
58
+
59
+ function mapPathGroup(
60
+ instancePath: string,
61
+ group: readonly TLocalizedValidationError[],
62
+ ctx: MapErrorsContext,
63
+ ): SpecError[] {
64
+ const path = ctx.pathPrefix + instancePath;
65
+ const key = lastSegment(instancePath);
66
+ const valueAtPath = pointerGet(ctx.value, instancePath);
67
+
68
+ if (
69
+ group.some((error) => error.keyword === "pattern") &&
70
+ /^\/scales\/(?:color|fill)\/range\/\d+$/.test(path) &&
71
+ typeof valueAtPath === "string"
72
+ ) {
73
+ return [
74
+ {
75
+ code: "scale-range-color",
76
+ path,
77
+ message: `The color stop "${valueAtPath}" is not a supported hex color.`,
78
+ fix: {
79
+ description: "Use #rgb or #rrggbb syntax for custom color ranges.",
80
+ example: "#ff0000",
81
+ },
82
+ },
83
+ ];
84
+ }
85
+
86
+ const union = mapUnionPathGroup(instancePath, group, ctx, path, key, valueAtPath);
87
+ if (union.status === "done") return union.errors;
88
+
89
+ return mapKeywordPathGroup(
90
+ instancePath,
91
+ group,
92
+ ctx,
93
+ path,
94
+ key,
95
+ valueAtPath,
96
+ union.activeFormKeys,
97
+ );
98
+ }
99
+
100
+ export function unknownGeomError(geom: unknown, layerPath: string): SpecError {
101
+ const allowed = [...KNOWN_GEOMS];
102
+ if (typeof geom !== "string") {
103
+ return {
104
+ code: "missing-geom",
105
+ path: `${layerPath}/geom`,
106
+ message: `Every layer needs a "geom" discriminator. Allowed geoms: ${allowed.map((g) => `"${g}"`).join(", ")}.`,
107
+ allowed,
108
+ fix: {
109
+ description: "Add a geom to the layer.",
110
+ example: { geom: "point" },
111
+ },
112
+ };
113
+ }
114
+ const suggestion = didYouMean(geom, allowed);
115
+ return {
116
+ code: "unknown-geom",
117
+ path: `${layerPath}/geom`,
118
+ message:
119
+ `Unknown geom "${geom}". Allowed geoms: ${allowed.map((g) => `"${g}"`).join(", ")}.` +
120
+ (suggestion === undefined ? "" : ` Did you mean "${suggestion}"?`),
121
+ allowed,
122
+ ...(suggestion !== undefined && {
123
+ fix: { description: `Set geom to "${suggestion}".`, example: { geom: suggestion } },
124
+ }),
125
+ };
126
+ }
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Channel and DataRef form classification for TypeBox 1.x error mapping.
3
+ * Path/schema walk: validate-schema-walk.ts. SpecError mapping: validate-map-errors.ts.
4
+ */
5
+ import type { TLocalizedValidationError } from "typebox/error";
6
+
7
+ import { CHANNELS } from "./schema-catalog.js";
8
+ import { isRecord, pathSegments, type UnionMemberInfo } from "./validate-schema-walk.js";
9
+
10
+ export const CHANNEL_FIX_EXAMPLE = { field: "column_name" };
11
+
12
+ /**
13
+ * Channel names that live under aes (plot- or layer-level).
14
+ * Derived from CHANNELS so path classification cannot drift behind the catalog (#1078).
15
+ */
16
+ const AES_CHANNEL_KEYS = new Set<string>(CHANNELS);
17
+
18
+ /** True only for the channel node itself (`…/aes/<channel>`), not nested paths. */
19
+ export function isChannelPath(path: string): boolean {
20
+ const segs = pathSegments(path);
21
+ if (segs.length < 2) return false;
22
+ const i = segs.length - 2;
23
+ return segs[i] === "aes" && AES_CHANNEL_KEYS.has(segs[i + 1]!);
24
+ }
25
+
26
+ /**
27
+ * DataRef / InlineData union roots only:
28
+ * `/data`, `/datasets/<name>`, or `/layers/<n>/data`.
29
+ * Nested paths under a data container must keep their own diagnostics.
30
+ */
31
+ export function isDataUnionPath(path: string): boolean {
32
+ const segs = pathSegments(path);
33
+ if (segs.length === 1 && segs[0] === "data") return true;
34
+ if (segs.length === 2 && segs[0] === "datasets") return true;
35
+ // /layers/<index>/data
36
+ if (
37
+ segs.length === 3 &&
38
+ segs[0] === "layers" &&
39
+ /^\d+$/.test(segs[1] ?? "") &&
40
+ segs[2] === "data"
41
+ ) {
42
+ return true;
43
+ }
44
+ return false;
45
+ }
46
+
47
+ /** Canonical channel object form (or null); bare strings are handled separately. */
48
+ export function looksLikeChannelForm(v: unknown): boolean {
49
+ if (v === null) return true;
50
+ if (!isRecord(v)) return false;
51
+ return "field" in v || "value" in v || "stat" in v;
52
+ }
53
+
54
+ /** Already a data container shape — do not suggest re-wrapping as `{ values: [...] }`. */
55
+ export function looksLikeDataContainer(v: unknown): boolean {
56
+ if (!isRecord(v)) return false;
57
+ return "values" in v || "columns" in v || "name" in v;
58
+ }
59
+
60
+ export function isScalarValue(v: unknown): boolean {
61
+ return v === null || typeof v === "string" || typeof v === "number" || typeof v === "boolean";
62
+ }
63
+
64
+ /** Exclusive channel form discriminators (exactly one allowed per channel). */
65
+ const CHANNEL_DISCRIMINATORS = ["field", "value", "stat"] as const;
66
+ /** Exclusive data form discriminators (exactly one allowed per DataRef). */
67
+ const DATA_DISCRIMINATORS = ["values", "columns", "name"] as const;
68
+
69
+ /**
70
+ * True when an additionalProperties failure lists a key that is *not* in
71
+ * `ignoreKeys`. Used to ignore competing-branch noise (e.g. Columns rejecting
72
+ * `values`) while still surfacing typos and form-illegal keys.
73
+ */
74
+ export function additionalPropertyNames(
75
+ group: readonly TLocalizedValidationError[],
76
+ ignoreKeys: ReadonlySet<string> = new Set(),
77
+ ): string[] {
78
+ const names = new Set<string>();
79
+ for (const error of group) {
80
+ if (error.keyword !== "additionalProperties") continue;
81
+ const listed = Array.isArray(error.params.additionalProperties)
82
+ ? error.params.additionalProperties
83
+ : [];
84
+ for (const key of listed) {
85
+ if (!ignoreKeys.has(key)) names.add(key);
86
+ }
87
+ }
88
+ return [...names];
89
+ }
90
+
91
+ export function hasActionableAddlNoise(
92
+ group: readonly TLocalizedValidationError[],
93
+ ignoreKeys: ReadonlySet<string>,
94
+ ): boolean {
95
+ return additionalPropertyNames(group, ignoreKeys).length > 0;
96
+ }
97
+
98
+ export function channelDiscriminatorKeys(v: Record<string, unknown>): string[] {
99
+ return CHANNEL_DISCRIMINATORS.filter((k) => k in v);
100
+ }
101
+
102
+ export function dataDiscriminatorKeys(
103
+ v: Record<string, unknown>,
104
+ allowed: readonly (typeof DATA_DISCRIMINATORS)[number][] = DATA_DISCRIMINATORS,
105
+ ): string[] {
106
+ return allowed.filter((k) => k in v);
107
+ }
108
+
109
+ export function dataDiscriminatorsForUnion(
110
+ members: UnionMemberInfo,
111
+ path: string,
112
+ ): readonly (typeof DATA_DISCRIMINATORS)[number][] {
113
+ const allowed: (typeof DATA_DISCRIMINATORS)[number][] = [];
114
+ if (members.refs.some((ref) => ref.endsWith("DataValues"))) allowed.push("values");
115
+ if (members.refs.some((ref) => ref.endsWith("DataColumns"))) allowed.push("columns");
116
+ if (members.refs.some((ref) => ref.endsWith("DataName"))) allowed.push("name");
117
+ if (allowed.length > 0) return allowed;
118
+ return pathSegments(path)[0] === "datasets" ? ["values", "columns"] : DATA_DISCRIMINATORS;
119
+ }
120
+
121
+ /**
122
+ * Keys legal on the single present channel form, or null when forms are mixed
123
+ * / absent. FieldRef = {field}; ValueRef = {value, scale?}; StatRef = {stat}.
124
+ */
125
+ export function allowedKeysForPresentChannelForm(v: Record<string, unknown>): Set<string> | null {
126
+ const discs = channelDiscriminatorKeys(v);
127
+ if (discs.length !== 1) return null;
128
+ switch (discs[0]) {
129
+ case "field":
130
+ return new Set(["field"]);
131
+ case "value":
132
+ return new Set(["value", "scale"]);
133
+ case "stat":
134
+ return new Set(["stat"]);
135
+ default:
136
+ return null;
137
+ }
138
+ }
139
+
140
+ /** Keys legal on the single present data form, or null when forms are mixed. */
141
+ export function allowedKeysForPresentDataForm(
142
+ v: Record<string, unknown>,
143
+ allowedDiscriminators: readonly (typeof DATA_DISCRIMINATORS)[number][],
144
+ ): Set<string> | null {
145
+ const discs = dataDiscriminatorKeys(v, allowedDiscriminators);
146
+ if (discs.length !== 1) return null;
147
+ return new Set([discs[0]!]);
148
+ }
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Keyword path mapping for TypeBox 1.x errors: additionalProperties, required,
3
+ * numeric range, and default type normalization.
4
+ * Union classification: validate-map-path-unions.ts. Orchestrator: validate-map-errors.ts.
5
+ */
6
+ import type { TLocalizedValidationError } from "typebox/error";
7
+
8
+ import type { SpecError } from "./errors.js";
9
+ import { didYouMean } from "./errors.js";
10
+ import {
11
+ additionalPropertiesIsClosed,
12
+ numberBounds,
13
+ objectPropertyNames,
14
+ pointerGet,
15
+ schemaAtInstancePath,
16
+ schemaAtSchemaPath,
17
+ } from "./validate-schema-walk.js";
18
+ import { additionalPropertyNames } from "./validate-map-forms.js";
19
+ import type { MapErrorsContext } from "./validate-map-errors.js";
20
+
21
+ /** Map remaining keywords after union classification (or when no anyOf/const). */
22
+ export function mapKeywordPathGroup(
23
+ instancePath: string,
24
+ group: readonly TLocalizedValidationError[],
25
+ ctx: MapErrorsContext,
26
+ path: string,
27
+ key: string,
28
+ valueAtPath: unknown,
29
+ activeFormKeys: ReadonlySet<string> | null,
30
+ ): SpecError[] {
31
+ // additionalProperties: closed objects → unexpected keys; schema-valued
32
+ // additionalProperties (records / free-form rows) → value type failures.
33
+ const addl = group.find((e) => e.keyword === "additionalProperties");
34
+ if (addl !== undefined) {
35
+ const listed = additionalPropertyNames(group, activeFormKeys ?? new Set());
36
+ const objectSchema =
37
+ (typeof addl.schemaPath === "string"
38
+ ? schemaAtSchemaPath(ctx.schema, instancePath, addl.schemaPath)
39
+ : null) ?? schemaAtInstancePath(ctx.schema, instancePath);
40
+ if (!additionalPropertiesIsClosed(objectSchema)) {
41
+ return listed.map((prop) => {
42
+ const propPath = `${path}/${prop}`;
43
+ const propValue = pointerGet(ctx.value, `${instancePath}/${prop}`);
44
+ return {
45
+ code: "invalid-type" as const,
46
+ path: propPath,
47
+ message: `Invalid value for "${prop}" (got ${JSON.stringify(propValue)}).`,
48
+ };
49
+ });
50
+ }
51
+ const properties =
52
+ activeFormKeys === null ? objectPropertyNames(objectSchema) : [...activeFormKeys];
53
+ return listed.map((prop) => {
54
+ const propPath = `${path}/${prop}`;
55
+ const suggestion = didYouMean(prop, properties);
56
+ return {
57
+ code: "unexpected-property" as const,
58
+ path: propPath,
59
+ message:
60
+ `Unknown property "${prop}".` +
61
+ (suggestion === undefined ? "" : ` Did you mean "${suggestion}"?`),
62
+ allowed: properties,
63
+ ...(suggestion !== undefined && {
64
+ fix: { description: `Rename "${prop}" to "${suggestion}".` },
65
+ }),
66
+ };
67
+ });
68
+ }
69
+
70
+ // required: may list several missing keys.
71
+ const req = group.find((e) => e.keyword === "required");
72
+ if (req !== undefined) {
73
+ const missing = Array.isArray(req.params.requiredProperties)
74
+ ? req.params.requiredProperties
75
+ : [];
76
+ return missing.map((prop) => ({
77
+ code: "missing-property" as const,
78
+ path: `${path}/${prop}`,
79
+ message: `Missing required property "${prop}".`,
80
+ }));
81
+ }
82
+
83
+ // numeric range — use schema bounds when available for full min+max message.
84
+ const rangeErr = group.find((e) =>
85
+ ["minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum"].includes(e.keyword),
86
+ );
87
+ if (rangeErr !== undefined) {
88
+ const propSchema =
89
+ schemaAtInstancePath(ctx.schema, instancePath) ??
90
+ schemaAtSchemaPath(ctx.schema, instancePath, rangeErr.schemaPath);
91
+ let bounds = numberBounds(propSchema);
92
+ if (bounds.length === 0) {
93
+ const limit = (rangeErr.params as { limit?: number }).limit;
94
+ const comparison = (rangeErr.params as { comparison?: string }).comparison;
95
+ if (typeof limit === "number" && typeof comparison === "string") {
96
+ bounds = [`${comparison} ${limit}`];
97
+ }
98
+ }
99
+ return [
100
+ {
101
+ code: "value-out-of-range",
102
+ path,
103
+ message: `Value ${JSON.stringify(valueAtPath)} for "${key}" is out of range (must be ${bounds.join(" and ")}).`,
104
+ fix: { description: `Set "${key}" to a number ${bounds.join(" and ")}.` },
105
+ },
106
+ ];
107
+ }
108
+
109
+ // Lone const (Literal) without anyOf group — handled in union module when
110
+ // constErrs non-empty; fall through to default for remaining keywords (type, etc.).
111
+
112
+ // Normalize 1.x "must be X" wording toward the catalog's "Expected X" form.
113
+ const first = group[0]!;
114
+ let message = first.message;
115
+ if (first.keyword === "type") {
116
+ const t = (first.params as { type?: string | string[] }).type;
117
+ const expected = Array.isArray(t) ? t.join("|") : t;
118
+ if (typeof expected === "string") {
119
+ message = `Expected ${expected}`;
120
+ }
121
+ }
122
+ return [
123
+ {
124
+ code: "invalid-type",
125
+ path,
126
+ message: `${message}${path === "" ? "" : ` at "${key}"`} (got ${JSON.stringify(valueAtPath)}).`,
127
+ },
128
+ ];
129
+ }
@@ -0,0 +1,281 @@
1
+ /**
2
+ * anyOf/const union path mapping for TypeBox 1.x errors (channel forms, data
3
+ * refs, enums). Keyword handlers: validate-map-path-keywords.ts.
4
+ * Orchestrator: validate-map-errors.ts.
5
+ *
6
+ * Result contract:
7
+ * - `{ status: "done", errors }` — including `errors: []` meaning "suppress
8
+ * noisy union diagnostics; a nested path owns the real error"
9
+ * - `{ status: "continue", activeFormKeys }` — fall through to keyword handlers
10
+ * (activeFormKeys null when no near-canonical form keyed the fall-through)
11
+ */
12
+ import type { TLocalizedValidationError } from "typebox/error";
13
+
14
+ import type { SpecError } from "./errors.js";
15
+ import { didYouMean } from "./errors.js";
16
+ import {
17
+ isRecord,
18
+ schemaAtInstancePath,
19
+ schemaAtSchemaPath,
20
+ unionMembers,
21
+ } from "./validate-schema-walk.js";
22
+ import {
23
+ allowedKeysForPresentChannelForm,
24
+ allowedKeysForPresentDataForm,
25
+ channelDiscriminatorKeys,
26
+ CHANNEL_FIX_EXAMPLE,
27
+ dataDiscriminatorKeys,
28
+ dataDiscriminatorsForUnion,
29
+ hasActionableAddlNoise,
30
+ isChannelPath,
31
+ isDataUnionPath,
32
+ isScalarValue,
33
+ looksLikeChannelForm,
34
+ looksLikeDataContainer,
35
+ } from "./validate-map-forms.js";
36
+ import type { MapErrorsContext } from "./validate-map-errors.js";
37
+
38
+ export type UnionPathResult =
39
+ | { status: "done"; errors: SpecError[] }
40
+ | { status: "continue"; activeFormKeys: ReadonlySet<string> | null };
41
+
42
+ /**
43
+ * Classify anyOf/const group noise. When neither anyOf nor const is present,
44
+ * returns continue with null form keys so keyword handlers still run.
45
+ */
46
+ export function mapUnionPathGroup(
47
+ instancePath: string,
48
+ group: readonly TLocalizedValidationError[],
49
+ ctx: MapErrorsContext,
50
+ path: string,
51
+ key: string,
52
+ valueAtPath: unknown,
53
+ ): UnionPathResult {
54
+ const anyOfErr = group.find((e) => e.keyword === "anyOf");
55
+ const constErrs = group.filter((e) => e.keyword === "const");
56
+
57
+ if (anyOfErr === undefined && constErrs.length === 0) {
58
+ return { status: "continue", activeFormKeys: null };
59
+ }
60
+
61
+ // Object-branch noise in mixed unions (e.g. ThemeName | ThemeSpec): prefer
62
+ // required / additionalProperties over const-branch enum synthesis.
63
+ const hasObjectBranchNoise =
64
+ isRecord(valueAtPath) &&
65
+ group.some((e) => e.keyword === "additionalProperties" || e.keyword === "required");
66
+
67
+ // anyOf / const unions FIRST: 1.x fans out branch failures (required +
68
+ // additionalProperties + anyOf) for object unions. Prefer the anyOf signal
69
+ // so DataRef / ChannelValue surface catalog codes, not branch noise — except
70
+ // when the instance already matches a near-canonical form (nested paths own
71
+ // the real diagnostic) or an object branch reported concrete property noise.
72
+ const unionSchema =
73
+ (anyOfErr === undefined
74
+ ? null
75
+ : schemaAtSchemaPath(ctx.schema, instancePath, anyOfErr.schemaPath)) ??
76
+ schemaAtInstancePath(ctx.schema, instancePath);
77
+ const members = unionMembers(unionSchema);
78
+
79
+ const isChannel =
80
+ members.refs.includes("FieldRef") ||
81
+ members.refs.some((r) => r.endsWith("FieldRef")) ||
82
+ isChannelPath(path);
83
+
84
+ if (isChannel && !members.allConst) {
85
+ return mapChannelUnion(group, path, key, valueAtPath);
86
+ }
87
+
88
+ const isDataUnion =
89
+ members.refs.includes("DataValues") ||
90
+ members.refs.some((r) => r.includes("DataValues")) ||
91
+ (isDataUnionPath(path) && anyOfErr !== undefined);
92
+
93
+ if (isDataUnion) {
94
+ return mapDataUnion(group, members, path, valueAtPath);
95
+ }
96
+
97
+ return mapEnumUnion(anyOfErr, constErrs, members, hasObjectBranchNoise, valueAtPath, path, key);
98
+ }
99
+
100
+ function mapEnumUnion(
101
+ anyOfErr: TLocalizedValidationError | undefined,
102
+ constErrs: readonly TLocalizedValidationError[],
103
+ members: ReturnType<typeof unionMembers>,
104
+ hasObjectBranchNoise: boolean,
105
+ valueAtPath: unknown,
106
+ path: string,
107
+ key: string,
108
+ ): UnionPathResult {
109
+ let allowed: string[] = [];
110
+ if (constErrs.length > 0) {
111
+ allowed = constErrs
112
+ .map((e) => (e.params as { allowedValue?: unknown }).allowedValue)
113
+ .filter((v) => v !== undefined)
114
+ .map(String);
115
+ }
116
+ if (allowed.length === 0 && members.allConst && members.consts.length > 0) {
117
+ allowed = members.consts;
118
+ }
119
+ // Only promote const branch noise when the value could be an enum member.
120
+ // Mixed enum|object unions (theme) must not turn ThemeSpec property errors
121
+ // into "pick a theme name".
122
+ if (
123
+ allowed.length > 0 &&
124
+ (members.allConst || isScalarValue(valueAtPath)) &&
125
+ !hasObjectBranchNoise
126
+ ) {
127
+ if (allowed.length === 1 && constErrs.length <= 1 && anyOfErr === undefined) {
128
+ return {
129
+ status: "done",
130
+ errors: [
131
+ {
132
+ code: "invalid-enum-value",
133
+ path,
134
+ message: `Invalid value ${JSON.stringify(valueAtPath)} for "${key}"; the only supported value is ${allowed.map((a) => `"${a}"`).join(", ")}.`,
135
+ allowed,
136
+ },
137
+ ],
138
+ };
139
+ }
140
+ const suggestion =
141
+ typeof valueAtPath === "string" ? didYouMean(valueAtPath, allowed) : undefined;
142
+ return {
143
+ status: "done",
144
+ errors: [
145
+ {
146
+ code: "invalid-enum-value",
147
+ path,
148
+ message:
149
+ `Invalid value ${JSON.stringify(valueAtPath)} for "${key}"; allowed: ${allowed.map((c) => `"${c}"`).join(", ")}.` +
150
+ (suggestion === undefined ? "" : ` Did you mean "${suggestion}"?`),
151
+ allowed,
152
+ ...(suggestion !== undefined && {
153
+ fix: { description: `Set "${key}" to "${suggestion}".` },
154
+ }),
155
+ },
156
+ ],
157
+ };
158
+ }
159
+
160
+ if (anyOfErr !== undefined && !hasObjectBranchNoise) {
161
+ return {
162
+ status: "done",
163
+ errors: [
164
+ {
165
+ code: "invalid-type",
166
+ path,
167
+ message: `${anyOfErr.message} at "${key}".`,
168
+ },
169
+ ],
170
+ };
171
+ }
172
+ return { status: "continue", activeFormKeys: null };
173
+ }
174
+
175
+ function mapChannelUnion(
176
+ group: readonly TLocalizedValidationError[],
177
+ path: string,
178
+ key: string,
179
+ valueAtPath: unknown,
180
+ ): UnionPathResult {
181
+ if (isRecord(valueAtPath) && looksLikeChannelForm(valueAtPath)) {
182
+ const discs = channelDiscriminatorKeys(valueAtPath);
183
+ if (discs.length > 1) {
184
+ return {
185
+ status: "done",
186
+ errors: [
187
+ {
188
+ code: "invalid-channel-value",
189
+ path,
190
+ message: `Channel "${key}" mixes forms (${discs.map((disc) => `"${disc}"`).join(" and ")}); use exactly one of {"field": ...}, {"value": ...}, or {"stat": ...}.`,
191
+ fix: {
192
+ description: `Pick a single channel form for "${key}".`,
193
+ example: CHANNEL_FIX_EXAMPLE,
194
+ },
195
+ },
196
+ ],
197
+ };
198
+ }
199
+ const formKeys = allowedKeysForPresentChannelForm(valueAtPath);
200
+ if (formKeys !== null && hasActionableAddlNoise(group, formKeys)) {
201
+ return { status: "continue", activeFormKeys: formKeys };
202
+ }
203
+ return { status: "done", errors: [] };
204
+ }
205
+ const bareString = typeof valueAtPath === "string";
206
+ return {
207
+ status: "done",
208
+ errors: [
209
+ {
210
+ code: "invalid-channel-value",
211
+ path,
212
+ message: bareString
213
+ ? `Channel "${key}" is the bare string ${JSON.stringify(valueAtPath)}; portable specs require the canonical form {"field": ${JSON.stringify(valueAtPath)}}.`
214
+ : `Channel "${key}" must be {"field": ...}, {"value": ...}, {"stat": ...}, or null.`,
215
+ fix: {
216
+ description: `Use a canonical channel form, e.g. {"field": "column_name"} to map "${key}" to a data column.`,
217
+ example: bareString ? { field: valueAtPath } : CHANNEL_FIX_EXAMPLE,
218
+ },
219
+ },
220
+ ],
221
+ };
222
+ }
223
+
224
+ function mapDataUnion(
225
+ group: readonly TLocalizedValidationError[],
226
+ members: ReturnType<typeof unionMembers>,
227
+ path: string,
228
+ valueAtPath: unknown,
229
+ ): UnionPathResult {
230
+ const allowed = dataDiscriminatorsForUnion(members, path);
231
+ const forms = allowed.map((discriminator) => {
232
+ if (discriminator === "values") return '{"values": [...rows]}';
233
+ if (discriminator === "columns") return '{"columns": {...arrays}}';
234
+ return '{"name": "dataset"}';
235
+ });
236
+ const formsMessage =
237
+ forms.length === 2
238
+ ? `${forms[0]} or ${forms[1]}`
239
+ : `${forms.slice(0, -1).join(", ")}, or ${forms.at(-1)}`;
240
+ if (isRecord(valueAtPath) && looksLikeDataContainer(valueAtPath)) {
241
+ const discs = dataDiscriminatorKeys(valueAtPath, allowed);
242
+ if (discs.length > 1) {
243
+ return {
244
+ status: "done",
245
+ errors: [
246
+ {
247
+ code: "invalid-data",
248
+ path,
249
+ message: `Data mixes forms (${discs.map((disc) => `"${disc}"`).join(" and ")}); use exactly one of ${formsMessage}.`,
250
+ allowed: [...allowed],
251
+ fix: {
252
+ description: "Pick a single data form.",
253
+ example: { values: [{ x: 1, y: 2 }] },
254
+ },
255
+ },
256
+ ],
257
+ };
258
+ }
259
+ const presentFormKeys = allowedKeysForPresentDataForm(valueAtPath, allowed);
260
+ const formKeys = presentFormKeys ?? new Set(allowed);
261
+ if (hasActionableAddlNoise(group, formKeys)) {
262
+ return { status: "continue", activeFormKeys: formKeys };
263
+ }
264
+ return { status: "done", errors: [] };
265
+ }
266
+ return {
267
+ status: "done",
268
+ errors: [
269
+ {
270
+ code: "invalid-data",
271
+ path,
272
+ message: `Data must be one of ${formsMessage}.`,
273
+ allowed: [...allowed],
274
+ fix: {
275
+ description: 'Wrap inline rows as {"values": [...]}.',
276
+ example: { values: [{ x: 1, y: 2 }] },
277
+ },
278
+ },
279
+ ],
280
+ };
281
+ }