@rippling/rippling-sdk 0.2.0-alpha.108 → 0.2.0-alpha.110

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 (366) hide show
  1. package/client.d.mts +14 -0
  2. package/client.d.mts.map +1 -1
  3. package/client.d.ts +14 -0
  4. package/client.d.ts.map +1 -1
  5. package/client.js +18 -0
  6. package/client.js.map +1 -1
  7. package/client.mjs +18 -0
  8. package/client.mjs.map +1 -1
  9. package/index.d.mts +5 -0
  10. package/index.d.mts.map +1 -1
  11. package/index.d.ts +5 -0
  12. package/index.d.ts.map +1 -1
  13. package/index.js +11 -1
  14. package/index.js.map +1 -1
  15. package/index.mjs +5 -0
  16. package/index.mjs.map +1 -1
  17. package/lib/charts/builders.d.mts +18 -19
  18. package/lib/charts/builders.d.mts.map +1 -1
  19. package/lib/charts/builders.d.ts +18 -19
  20. package/lib/charts/builders.d.ts.map +1 -1
  21. package/lib/charts/builders.js +35 -28
  22. package/lib/charts/builders.js.map +1 -1
  23. package/lib/charts/builders.mjs +35 -28
  24. package/lib/charts/builders.mjs.map +1 -1
  25. package/lib/charts/describe.d.mts +6 -7
  26. package/lib/charts/describe.d.mts.map +1 -1
  27. package/lib/charts/describe.d.ts +6 -7
  28. package/lib/charts/describe.d.ts.map +1 -1
  29. package/lib/charts/describe.js +26 -27
  30. package/lib/charts/describe.js.map +1 -1
  31. package/lib/charts/describe.mjs +27 -28
  32. package/lib/charts/describe.mjs.map +1 -1
  33. package/lib/charts/errors.d.mts +2 -6
  34. package/lib/charts/errors.d.mts.map +1 -1
  35. package/lib/charts/errors.d.ts +2 -6
  36. package/lib/charts/errors.d.ts.map +1 -1
  37. package/lib/charts/errors.js +2 -6
  38. package/lib/charts/errors.js.map +1 -1
  39. package/lib/charts/errors.mjs +2 -6
  40. package/lib/charts/errors.mjs.map +1 -1
  41. package/lib/charts/evaluate.d.mts +5 -7
  42. package/lib/charts/evaluate.d.mts.map +1 -1
  43. package/lib/charts/evaluate.d.ts +5 -7
  44. package/lib/charts/evaluate.d.ts.map +1 -1
  45. package/lib/charts/evaluate.js +21 -35
  46. package/lib/charts/evaluate.js.map +1 -1
  47. package/lib/charts/evaluate.mjs +22 -36
  48. package/lib/charts/evaluate.mjs.map +1 -1
  49. package/lib/charts/schema.d.mts +8 -97
  50. package/lib/charts/schema.d.mts.map +1 -1
  51. package/lib/charts/schema.d.ts +8 -97
  52. package/lib/charts/schema.d.ts.map +1 -1
  53. package/lib/charts/schema.js +186 -65
  54. package/lib/charts/schema.js.map +1 -1
  55. package/lib/charts/schema.mjs +185 -65
  56. package/lib/charts/schema.mjs.map +1 -1
  57. package/lib/charts/types.d.mts +40 -25
  58. package/lib/charts/types.d.mts.map +1 -1
  59. package/lib/charts/types.d.ts +40 -25
  60. package/lib/charts/types.d.ts.map +1 -1
  61. package/lib/charts/types.js +8 -10
  62. package/lib/charts/types.js.map +1 -1
  63. package/lib/charts/types.mjs +8 -10
  64. package/lib/charts/types.mjs.map +1 -1
  65. package/lib/charts/visualization-grammar.d.mts +66 -0
  66. package/lib/charts/visualization-grammar.d.mts.map +1 -0
  67. package/lib/charts/visualization-grammar.d.ts +66 -0
  68. package/lib/charts/visualization-grammar.d.ts.map +1 -0
  69. package/lib/charts/visualization-grammar.js +70 -0
  70. package/lib/charts/visualization-grammar.js.map +1 -0
  71. package/lib/charts/visualization-grammar.mjs +67 -0
  72. package/lib/charts/visualization-grammar.mjs.map +1 -0
  73. package/lib/charts/vocabulary.d.mts +7 -0
  74. package/lib/charts/vocabulary.d.mts.map +1 -0
  75. package/lib/charts/vocabulary.d.ts +7 -0
  76. package/lib/charts/vocabulary.d.ts.map +1 -0
  77. package/lib/charts/vocabulary.js +10 -0
  78. package/lib/charts/vocabulary.js.map +1 -0
  79. package/lib/charts/vocabulary.mjs +7 -0
  80. package/lib/charts/vocabulary.mjs.map +1 -0
  81. package/lib/charts.d.mts +3 -3
  82. package/lib/charts.d.mts.map +1 -1
  83. package/lib/charts.d.ts +3 -3
  84. package/lib/charts.d.ts.map +1 -1
  85. package/lib/charts.js +2 -1
  86. package/lib/charts.js.map +1 -1
  87. package/lib/charts.mjs +1 -1
  88. package/lib/charts.mjs.map +1 -1
  89. package/lib/manifest/composition.d.mts +21 -0
  90. package/lib/manifest/composition.d.mts.map +1 -0
  91. package/lib/manifest/composition.d.ts +21 -0
  92. package/lib/manifest/composition.d.ts.map +1 -0
  93. package/lib/manifest/composition.js +103 -0
  94. package/lib/manifest/composition.js.map +1 -0
  95. package/lib/manifest/composition.mjs +99 -0
  96. package/lib/manifest/composition.mjs.map +1 -0
  97. package/lib/manifest/definitions/_object-records.d.mts +23 -0
  98. package/lib/manifest/definitions/_object-records.d.mts.map +1 -0
  99. package/lib/manifest/definitions/_object-records.d.ts +23 -0
  100. package/lib/manifest/definitions/_object-records.d.ts.map +1 -0
  101. package/lib/manifest/definitions/_object-records.js +151 -0
  102. package/lib/manifest/definitions/_object-records.js.map +1 -0
  103. package/lib/manifest/definitions/_object-records.mjs +147 -0
  104. package/lib/manifest/definitions/_object-records.mjs.map +1 -0
  105. package/lib/manifest/definitions/action.d.mts +7 -0
  106. package/lib/manifest/definitions/action.d.mts.map +1 -0
  107. package/lib/manifest/definitions/action.d.ts +7 -0
  108. package/lib/manifest/definitions/action.d.ts.map +1 -0
  109. package/lib/manifest/definitions/action.js +25 -0
  110. package/lib/manifest/definitions/action.js.map +1 -0
  111. package/lib/manifest/definitions/action.mjs +22 -0
  112. package/lib/manifest/definitions/action.mjs.map +1 -0
  113. package/lib/manifest/definitions/agent.d.mts +51 -0
  114. package/lib/manifest/definitions/agent.d.mts.map +1 -0
  115. package/lib/manifest/definitions/agent.d.ts +51 -0
  116. package/lib/manifest/definitions/agent.d.ts.map +1 -0
  117. package/lib/manifest/definitions/agent.js +65 -0
  118. package/lib/manifest/definitions/agent.js.map +1 -0
  119. package/lib/manifest/definitions/agent.mjs +59 -0
  120. package/lib/manifest/definitions/agent.mjs.map +1 -0
  121. package/lib/manifest/definitions/app.d.mts +3 -0
  122. package/lib/manifest/definitions/app.d.mts.map +1 -0
  123. package/lib/manifest/definitions/app.d.ts +3 -0
  124. package/lib/manifest/definitions/app.d.ts.map +1 -0
  125. package/lib/manifest/definitions/app.js +14 -0
  126. package/lib/manifest/definitions/app.js.map +1 -0
  127. package/lib/manifest/definitions/app.mjs +11 -0
  128. package/lib/manifest/definitions/app.mjs.map +1 -0
  129. package/lib/manifest/definitions/category.d.mts +9 -0
  130. package/lib/manifest/definitions/category.d.mts.map +1 -0
  131. package/lib/manifest/definitions/category.d.ts +9 -0
  132. package/lib/manifest/definitions/category.d.ts.map +1 -0
  133. package/lib/manifest/definitions/category.js +27 -0
  134. package/lib/manifest/definitions/category.js.map +1 -0
  135. package/lib/manifest/definitions/category.mjs +23 -0
  136. package/lib/manifest/definitions/category.mjs.map +1 -0
  137. package/lib/manifest/definitions/component.d.mts +101 -0
  138. package/lib/manifest/definitions/component.d.mts.map +1 -0
  139. package/lib/manifest/definitions/component.d.ts +101 -0
  140. package/lib/manifest/definitions/component.d.ts.map +1 -0
  141. package/lib/manifest/definitions/component.js +106 -0
  142. package/lib/manifest/definitions/component.js.map +1 -0
  143. package/lib/manifest/definitions/component.mjs +97 -0
  144. package/lib/manifest/definitions/component.mjs.map +1 -0
  145. package/lib/manifest/definitions/custom-field-section.d.mts +13 -0
  146. package/lib/manifest/definitions/custom-field-section.d.mts.map +1 -0
  147. package/lib/manifest/definitions/custom-field-section.d.ts +13 -0
  148. package/lib/manifest/definitions/custom-field-section.d.ts.map +1 -0
  149. package/lib/manifest/definitions/custom-field-section.js +15 -0
  150. package/lib/manifest/definitions/custom-field-section.js.map +1 -0
  151. package/lib/manifest/definitions/custom-field-section.mjs +12 -0
  152. package/lib/manifest/definitions/custom-field-section.mjs.map +1 -0
  153. package/lib/manifest/definitions/custom-field.d.mts +10 -0
  154. package/lib/manifest/definitions/custom-field.d.mts.map +1 -0
  155. package/lib/manifest/definitions/custom-field.d.ts +10 -0
  156. package/lib/manifest/definitions/custom-field.d.ts.map +1 -0
  157. package/lib/manifest/definitions/custom-field.js +18 -0
  158. package/lib/manifest/definitions/custom-field.js.map +1 -0
  159. package/lib/manifest/definitions/custom-field.mjs +15 -0
  160. package/lib/manifest/definitions/custom-field.mjs.map +1 -0
  161. package/lib/manifest/definitions/custom-object.d.mts +162 -0
  162. package/lib/manifest/definitions/custom-object.d.mts.map +1 -0
  163. package/lib/manifest/definitions/custom-object.d.ts +162 -0
  164. package/lib/manifest/definitions/custom-object.d.ts.map +1 -0
  165. package/lib/manifest/definitions/custom-object.js +412 -0
  166. package/lib/manifest/definitions/custom-object.js.map +1 -0
  167. package/lib/manifest/definitions/custom-object.mjs +386 -0
  168. package/lib/manifest/definitions/custom-object.mjs.map +1 -0
  169. package/lib/manifest/definitions/custom-skill.d.mts +8 -0
  170. package/lib/manifest/definitions/custom-skill.d.mts.map +1 -0
  171. package/lib/manifest/definitions/custom-skill.d.ts +8 -0
  172. package/lib/manifest/definitions/custom-skill.d.ts.map +1 -0
  173. package/lib/manifest/definitions/custom-skill.js +15 -0
  174. package/lib/manifest/definitions/custom-skill.js.map +1 -0
  175. package/lib/manifest/definitions/custom-skill.mjs +12 -0
  176. package/lib/manifest/definitions/custom-skill.mjs.map +1 -0
  177. package/lib/manifest/definitions/field-section.d.mts +7 -0
  178. package/lib/manifest/definitions/field-section.d.mts.map +1 -0
  179. package/lib/manifest/definitions/field-section.d.ts +7 -0
  180. package/lib/manifest/definitions/field-section.d.ts.map +1 -0
  181. package/lib/manifest/definitions/field-section.js +16 -0
  182. package/lib/manifest/definitions/field-section.js.map +1 -0
  183. package/lib/manifest/definitions/field-section.mjs +13 -0
  184. package/lib/manifest/definitions/field-section.mjs.map +1 -0
  185. package/lib/manifest/definitions/field.d.mts +38 -0
  186. package/lib/manifest/definitions/field.d.mts.map +1 -0
  187. package/lib/manifest/definitions/field.d.ts +38 -0
  188. package/lib/manifest/definitions/field.d.ts.map +1 -0
  189. package/lib/manifest/definitions/field.js +50 -0
  190. package/lib/manifest/definitions/field.js.map +1 -0
  191. package/lib/manifest/definitions/field.mjs +45 -0
  192. package/lib/manifest/definitions/field.mjs.map +1 -0
  193. package/lib/manifest/definitions/function.d.mts +61 -0
  194. package/lib/manifest/definitions/function.d.mts.map +1 -0
  195. package/lib/manifest/definitions/function.d.ts +61 -0
  196. package/lib/manifest/definitions/function.d.ts.map +1 -0
  197. package/lib/manifest/definitions/function.js +79 -0
  198. package/lib/manifest/definitions/function.js.map +1 -0
  199. package/lib/manifest/definitions/function.mjs +73 -0
  200. package/lib/manifest/definitions/function.mjs.map +1 -0
  201. package/lib/manifest/definitions/index.d.mts +22 -0
  202. package/lib/manifest/definitions/index.d.mts.map +1 -0
  203. package/lib/manifest/definitions/index.d.ts +22 -0
  204. package/lib/manifest/definitions/index.d.ts.map +1 -0
  205. package/lib/manifest/definitions/index.js +64 -0
  206. package/lib/manifest/definitions/index.js.map +1 -0
  207. package/lib/manifest/definitions/index.mjs +22 -0
  208. package/lib/manifest/definitions/index.mjs.map +1 -0
  209. package/lib/manifest/definitions/list-view.d.mts +9 -0
  210. package/lib/manifest/definitions/list-view.d.mts.map +1 -0
  211. package/lib/manifest/definitions/list-view.d.ts +9 -0
  212. package/lib/manifest/definitions/list-view.d.ts.map +1 -0
  213. package/lib/manifest/definitions/list-view.js +25 -0
  214. package/lib/manifest/definitions/list-view.js.map +1 -0
  215. package/lib/manifest/definitions/list-view.mjs +22 -0
  216. package/lib/manifest/definitions/list-view.mjs.map +1 -0
  217. package/lib/manifest/definitions/object-search-config.d.mts +13 -0
  218. package/lib/manifest/definitions/object-search-config.d.mts.map +1 -0
  219. package/lib/manifest/definitions/object-search-config.d.ts +13 -0
  220. package/lib/manifest/definitions/object-search-config.d.ts.map +1 -0
  221. package/lib/manifest/definitions/object-search-config.js +25 -0
  222. package/lib/manifest/definitions/object-search-config.js.map +1 -0
  223. package/lib/manifest/definitions/object-search-config.mjs +22 -0
  224. package/lib/manifest/definitions/object-search-config.mjs.map +1 -0
  225. package/lib/manifest/definitions/object-settings.d.mts +24 -0
  226. package/lib/manifest/definitions/object-settings.d.mts.map +1 -0
  227. package/lib/manifest/definitions/object-settings.d.ts +24 -0
  228. package/lib/manifest/definitions/object-settings.d.ts.map +1 -0
  229. package/lib/manifest/definitions/object-settings.js +32 -0
  230. package/lib/manifest/definitions/object-settings.js.map +1 -0
  231. package/lib/manifest/definitions/object-settings.mjs +29 -0
  232. package/lib/manifest/definitions/object-settings.mjs.map +1 -0
  233. package/lib/manifest/definitions/page-layout.d.mts +21 -0
  234. package/lib/manifest/definitions/page-layout.d.mts.map +1 -0
  235. package/lib/manifest/definitions/page-layout.d.ts +21 -0
  236. package/lib/manifest/definitions/page-layout.d.ts.map +1 -0
  237. package/lib/manifest/definitions/page-layout.js +155 -0
  238. package/lib/manifest/definitions/page-layout.js.map +1 -0
  239. package/lib/manifest/definitions/page-layout.mjs +152 -0
  240. package/lib/manifest/definitions/page-layout.mjs.map +1 -0
  241. package/lib/manifest/definitions/page.d.mts +8 -0
  242. package/lib/manifest/definitions/page.d.mts.map +1 -0
  243. package/lib/manifest/definitions/page.d.ts +8 -0
  244. package/lib/manifest/definitions/page.d.ts.map +1 -0
  245. package/lib/manifest/definitions/page.js +15 -0
  246. package/lib/manifest/definitions/page.js.map +1 -0
  247. package/lib/manifest/definitions/page.mjs +12 -0
  248. package/lib/manifest/definitions/page.mjs.map +1 -0
  249. package/lib/manifest/definitions/record-triggered-flow.d.mts +24 -0
  250. package/lib/manifest/definitions/record-triggered-flow.d.mts.map +1 -0
  251. package/lib/manifest/definitions/record-triggered-flow.d.ts +24 -0
  252. package/lib/manifest/definitions/record-triggered-flow.d.ts.map +1 -0
  253. package/lib/manifest/definitions/record-triggered-flow.js +28 -0
  254. package/lib/manifest/definitions/record-triggered-flow.js.map +1 -0
  255. package/lib/manifest/definitions/record-triggered-flow.mjs +25 -0
  256. package/lib/manifest/definitions/record-triggered-flow.mjs.map +1 -0
  257. package/lib/manifest/definitions/validation.d.mts +8 -0
  258. package/lib/manifest/definitions/validation.d.mts.map +1 -0
  259. package/lib/manifest/definitions/validation.d.ts +8 -0
  260. package/lib/manifest/definitions/validation.d.ts.map +1 -0
  261. package/lib/manifest/definitions/validation.js +24 -0
  262. package/lib/manifest/definitions/validation.js.map +1 -0
  263. package/lib/manifest/definitions/validation.mjs +21 -0
  264. package/lib/manifest/definitions/validation.mjs.map +1 -0
  265. package/lib/manifest/definitions/workflow.d.mts +10 -0
  266. package/lib/manifest/definitions/workflow.d.mts.map +1 -0
  267. package/lib/manifest/definitions/workflow.d.ts +10 -0
  268. package/lib/manifest/definitions/workflow.d.ts.map +1 -0
  269. package/lib/manifest/definitions/workflow.js +33 -0
  270. package/lib/manifest/definitions/workflow.js.map +1 -0
  271. package/lib/manifest/definitions/workflow.mjs +29 -0
  272. package/lib/manifest/definitions/workflow.mjs.map +1 -0
  273. package/lib/manifest/index.d.mts +3 -0
  274. package/lib/manifest/index.d.mts.map +1 -1
  275. package/lib/manifest/index.d.ts +3 -0
  276. package/lib/manifest/index.d.ts.map +1 -1
  277. package/lib/manifest/index.js +4 -0
  278. package/lib/manifest/index.js.map +1 -1
  279. package/lib/manifest/index.mjs +3 -0
  280. package/lib/manifest/index.mjs.map +1 -1
  281. package/lib/manifest/package-manifest.d.mts +17 -0
  282. package/lib/manifest/package-manifest.d.mts.map +1 -0
  283. package/lib/manifest/package-manifest.d.ts +17 -0
  284. package/lib/manifest/package-manifest.d.ts.map +1 -0
  285. package/lib/manifest/package-manifest.js +26 -0
  286. package/lib/manifest/package-manifest.js.map +1 -0
  287. package/lib/manifest/package-manifest.mjs +23 -0
  288. package/lib/manifest/package-manifest.mjs.map +1 -0
  289. package/package.json +4 -2
  290. package/resources/index.d.mts +1 -0
  291. package/resources/index.d.mts.map +1 -1
  292. package/resources/index.d.ts +1 -0
  293. package/resources/index.d.ts.map +1 -1
  294. package/resources/index.js +4 -2
  295. package/resources/index.js.map +1 -1
  296. package/resources/index.mjs +1 -0
  297. package/resources/index.mjs.map +1 -1
  298. package/resources/reimbursements.d.mts +1 -1
  299. package/resources/reimbursements.d.ts +1 -1
  300. package/resources/reimbursements.js +1 -1
  301. package/resources/reimbursements.mjs +1 -1
  302. package/resources/spend-categories.d.mts +140 -0
  303. package/resources/spend-categories.d.mts.map +1 -0
  304. package/resources/spend-categories.d.ts +140 -0
  305. package/resources/spend-categories.d.ts.map +1 -0
  306. package/resources/spend-categories.js +83 -0
  307. package/resources/spend-categories.js.map +1 -0
  308. package/resources/spend-categories.mjs +79 -0
  309. package/resources/spend-categories.mjs.map +1 -0
  310. package/src/client.ts +41 -0
  311. package/src/index.ts +17 -0
  312. package/src/lib/charts/README.md +35 -28
  313. package/src/lib/charts/agent-reference.md +73 -0
  314. package/src/lib/charts/builders.ts +51 -35
  315. package/src/lib/charts/capabilities.json +96 -0
  316. package/src/lib/charts/describe.ts +31 -29
  317. package/src/lib/charts/errors.ts +2 -6
  318. package/src/lib/charts/evaluate.ts +25 -38
  319. package/src/lib/charts/schema.ts +232 -66
  320. package/src/lib/charts/types.ts +42 -31
  321. package/src/lib/charts/visualization-grammar.ts +67 -0
  322. package/src/lib/charts/vocabulary.ts +7 -0
  323. package/src/lib/charts.ts +8 -1
  324. package/src/lib/manifest/composition.ts +133 -0
  325. package/src/lib/manifest/definitions/README.md +89 -0
  326. package/src/lib/manifest/definitions/_object-records.ts +218 -0
  327. package/src/lib/manifest/definitions/action.ts +31 -0
  328. package/src/lib/manifest/definitions/agent.ts +149 -0
  329. package/src/lib/manifest/definitions/app.ts +12 -0
  330. package/src/lib/manifest/definitions/category.ts +35 -0
  331. package/src/lib/manifest/definitions/component.ts +241 -0
  332. package/src/lib/manifest/definitions/custom-field-section.ts +39 -0
  333. package/src/lib/manifest/definitions/custom-field.ts +32 -0
  334. package/src/lib/manifest/definitions/custom-object.ts +786 -0
  335. package/src/lib/manifest/definitions/custom-skill.ts +28 -0
  336. package/src/lib/manifest/definitions/field-section.ts +31 -0
  337. package/src/lib/manifest/definitions/field.ts +119 -0
  338. package/src/lib/manifest/definitions/function.ts +198 -0
  339. package/src/lib/manifest/definitions/index.ts +91 -0
  340. package/src/lib/manifest/definitions/list-view.ts +48 -0
  341. package/src/lib/manifest/definitions/object-search-config.ts +44 -0
  342. package/src/lib/manifest/definitions/object-settings.ts +61 -0
  343. package/src/lib/manifest/definitions/page-layout.ts +218 -0
  344. package/src/lib/manifest/definitions/page.ts +28 -0
  345. package/src/lib/manifest/definitions/record-triggered-flow.ts +71 -0
  346. package/src/lib/manifest/definitions/validation.ts +46 -0
  347. package/src/lib/manifest/definitions/workflow.ts +62 -0
  348. package/src/lib/manifest/index.ts +4 -0
  349. package/src/lib/manifest/package-manifest.ts +40 -0
  350. package/src/resources/index.ts +7 -0
  351. package/src/resources/reimbursements.ts +1 -1
  352. package/src/resources/spend-categories.ts +175 -0
  353. package/src/version.ts +1 -1
  354. package/version.d.mts +1 -1
  355. package/version.d.ts +1 -1
  356. package/version.js +1 -1
  357. package/version.mjs +1 -1
  358. package/lib/charts/guards.d.mts +0 -15
  359. package/lib/charts/guards.d.mts.map +0 -1
  360. package/lib/charts/guards.d.ts +0 -15
  361. package/lib/charts/guards.d.ts.map +0 -1
  362. package/lib/charts/guards.js +0 -38
  363. package/lib/charts/guards.js.map +0 -1
  364. package/lib/charts/guards.mjs +0 -34
  365. package/lib/charts/guards.mjs.map +0 -1
  366. package/src/lib/charts/guards.ts +0 -42
@@ -1,16 +1,14 @@
1
- import { type Rule, type RuleContext, type RuleValue } from "./types.mjs";
1
+ import { type RuleContext, type RuleValue } from "./types.mjs";
2
2
  /**
3
3
  * Resolve a rule to a value against `ctx`. Accepts a `{$rule}` placeholder or a
4
- * bare tree. A malformed or unknown node throws a `ChartRuleError` (never a
4
+ * bare node. A malformed or unknown node throws a `ChartRuleError` (never a
5
5
  * native `TypeError`), so a caller reading an untrusted, deserialized rule can
6
6
  * catch every failure with one type. When the rule is a colour placeholder, the
7
7
  * result is checked to be a colour (`string | null`) — a rule that resolves to a
8
8
  * number or boolean is a `RuleTypeError`, not something the renderer paints.
9
9
  *
10
- * Pure: the only inputs are the node and the context. No clock, no randomness,
11
- * no I/O — which is what makes it safe to run on an untrusted, user-edited tree
12
- * and identical across the renderer, the panel readout, and a test. A tree
13
- * nested past `MAX_RULE_DEPTH` throws `RuleDepthError` rather than overflowing.
10
+ * Pure and non-recursive: the only inputs are the validated flat rule and the
11
+ * context. No clock, randomness, callbacks, or I/O.
14
12
  */
15
- export declare function evaluate(rule: Rule, ctx: RuleContext): RuleValue;
13
+ export declare function evaluate(rule: unknown, ctx: RuleContext): RuleValue;
16
14
  //# sourceMappingURL=evaluate.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.d.mts","sourceRoot":"","sources":["../../src/lib/charts/evaluate.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,IAAI,EAET,KAAK,WAAW,EAEhB,KAAK,SAAS,EACf,oBAAgB;AAEjB;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,GAAG,SAAS,CAKhE"}
1
+ {"version":3,"file":"evaluate.d.mts","sourceRoot":"","sources":["../../src/lib/charts/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,WAAW,EAEhB,KAAK,SAAS,EACf,oBAAgB;AAEjB;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,GAAG,SAAS,CAMnE"}
@@ -1,16 +1,14 @@
1
- import { type Rule, type RuleContext, type RuleValue } from "./types.js";
1
+ import { type RuleContext, type RuleValue } from "./types.js";
2
2
  /**
3
3
  * Resolve a rule to a value against `ctx`. Accepts a `{$rule}` placeholder or a
4
- * bare tree. A malformed or unknown node throws a `ChartRuleError` (never a
4
+ * bare node. A malformed or unknown node throws a `ChartRuleError` (never a
5
5
  * native `TypeError`), so a caller reading an untrusted, deserialized rule can
6
6
  * catch every failure with one type. When the rule is a colour placeholder, the
7
7
  * result is checked to be a colour (`string | null`) — a rule that resolves to a
8
8
  * number or boolean is a `RuleTypeError`, not something the renderer paints.
9
9
  *
10
- * Pure: the only inputs are the node and the context. No clock, no randomness,
11
- * no I/O — which is what makes it safe to run on an untrusted, user-edited tree
12
- * and identical across the renderer, the panel readout, and a test. A tree
13
- * nested past `MAX_RULE_DEPTH` throws `RuleDepthError` rather than overflowing.
10
+ * Pure and non-recursive: the only inputs are the validated flat rule and the
11
+ * context. No clock, randomness, callbacks, or I/O.
14
12
  */
15
- export declare function evaluate(rule: Rule, ctx: RuleContext): RuleValue;
13
+ export declare function evaluate(rule: unknown, ctx: RuleContext): RuleValue;
16
14
  //# sourceMappingURL=evaluate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/lib/charts/evaluate.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,IAAI,EAET,KAAK,WAAW,EAEhB,KAAK,SAAS,EACf,mBAAgB;AAEjB;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,GAAG,SAAS,CAKhE"}
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/lib/charts/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,WAAW,EAEhB,KAAK,SAAS,EACf,mBAAgB;AAEjB;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,GAAG,SAAS,CAMnE"}
@@ -1,54 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.evaluate = evaluate;
4
- const builders_1 = require("./builders.js");
5
4
  const errors_1 = require("./errors.js");
6
- const guards_1 = require("./guards.js");
7
- const types_1 = require("./types.js");
5
+ const schema_1 = require("./schema.js");
8
6
  /**
9
7
  * Resolve a rule to a value against `ctx`. Accepts a `{$rule}` placeholder or a
10
- * bare tree. A malformed or unknown node throws a `ChartRuleError` (never a
8
+ * bare node. A malformed or unknown node throws a `ChartRuleError` (never a
11
9
  * native `TypeError`), so a caller reading an untrusted, deserialized rule can
12
10
  * catch every failure with one type. When the rule is a colour placeholder, the
13
11
  * result is checked to be a colour (`string | null`) — a rule that resolves to a
14
12
  * number or boolean is a `RuleTypeError`, not something the renderer paints.
15
13
  *
16
- * Pure: the only inputs are the node and the context. No clock, no randomness,
17
- * no I/O — which is what makes it safe to run on an untrusted, user-edited tree
18
- * and identical across the renderer, the panel readout, and a test. A tree
19
- * nested past `MAX_RULE_DEPTH` throws `RuleDepthError` rather than overflowing.
14
+ * Pure and non-recursive: the only inputs are the validated flat rule and the
15
+ * context. No clock, randomness, callbacks, or I/O.
20
16
  */
21
17
  function evaluate(rule, ctx) {
22
- if ((0, builders_1.isRulePlaceholder)(rule)) {
23
- return coerceForChannel(rule.channel, visit(rule.$rule, ctx, 0));
18
+ const parsedRule = (0, schema_1.parseChartRule)(rule);
19
+ if ('$rule' in parsedRule) {
20
+ return coerceForChannel(parsedRule.channel, visit(parsedRule.$rule, ctx));
24
21
  }
25
- return visit(rule, ctx, 0);
22
+ return visit(parsedRule, ctx);
26
23
  }
27
- function visit(node, ctx, depth) {
28
- if (depth > types_1.MAX_RULE_DEPTH) {
29
- throw new errors_1.RuleDepthError(types_1.MAX_RULE_DEPTH);
30
- }
31
- (0, guards_1.assertRuleNode)(node);
32
- const next = depth + 1;
24
+ function visit(node, ctx) {
33
25
  switch (node.kind) {
34
26
  case 'value':
35
27
  return ctx.value;
36
28
  case 'literal':
37
- return (0, guards_1.literalValue)(node);
29
+ return node.value;
38
30
  case 'equals':
39
- return visit(node.left, ctx, next) === visit(node.right, ctx, next);
31
+ return operand(node.left, ctx) === operand(node.right, ctx);
40
32
  case 'isNot':
41
- return visit(node.left, ctx, next) !== visit(node.right, ctx, next);
33
+ return operand(node.left, ctx) !== operand(node.right, ctx);
42
34
  case 'lessThan':
43
- return num(visit(node.left, ctx, next)) < num(visit(node.right, ctx, next));
35
+ return numericOperand(node.left, ctx) < numericOperand(node.right, ctx);
44
36
  case 'greaterThan':
45
- return num(visit(node.left, ctx, next)) > num(visit(node.right, ctx, next));
37
+ return numericOperand(node.left, ctx) > numericOperand(node.right, ctx);
46
38
  case 'lessOrEqual':
47
- return num(visit(node.left, ctx, next)) <= num(visit(node.right, ctx, next));
39
+ return numericOperand(node.left, ctx) <= numericOperand(node.right, ctx);
48
40
  case 'greaterOrEqual':
49
- return num(visit(node.left, ctx, next)) >= num(visit(node.right, ctx, next));
41
+ return numericOperand(node.left, ctx) >= numericOperand(node.right, ctx);
50
42
  case 'ifElse':
51
- return bool(visit(node.cond, ctx, next)) ? visit(node.then, ctx, next) : visit(node.else, ctx, next);
43
+ return visit(node.cond, ctx) ? node.then.value : node.else.value;
52
44
  default:
53
45
  return unreachable(node);
54
46
  }
@@ -56,17 +48,11 @@ function visit(node, ctx, depth) {
56
48
  /* -------------------------------------------------------------------------- */
57
49
  /* Coercions — narrow a RuleValue, or throw a typed error. */
58
50
  /* -------------------------------------------------------------------------- */
59
- function num(value) {
60
- if (typeof value === 'number') {
61
- return value;
62
- }
63
- throw new errors_1.RuleTypeError(`expected a number, got ${typeName(value)}`);
51
+ function operand(node, ctx) {
52
+ return node.kind === 'value' ? ctx.value : node.value;
64
53
  }
65
- function bool(value) {
66
- if (typeof value === 'boolean') {
67
- return value;
68
- }
69
- throw new errors_1.RuleTypeError(`expected a boolean, got ${typeName(value)}`);
54
+ function numericOperand(node, ctx) {
55
+ return node.kind === 'value' ? ctx.value : node.value;
70
56
  }
71
57
  /** A colour channel must resolve to a colour string, or null for "no override". */
72
58
  function asColor(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../src/lib/charts/evaluate.ts"],"names":[],"mappings":";;A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AC,EAAE,CAAC,CAAC;IACtG,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgB;IAChC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;AAChD,CAAC;AAED,SAAS,WAAW,CAAC,IAAW;IAC9B,MAAM,IAAI,yBAAgB,CAAE,IAA0B,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC"}
@@ -1,51 +1,43 @@
1
- import { isRulePlaceholder } from "./builders.mjs";
2
- import { MalformedRuleError, RuleDepthError, RuleTypeError, UnknownNodeError } from "./errors.mjs";
3
- import { assertRuleNode, literalValue } from "./guards.mjs";
4
- import { MAX_RULE_DEPTH, } from "./types.mjs";
1
+ import { MalformedRuleError, RuleTypeError, UnknownNodeError } from "./errors.mjs";
2
+ import { parseChartRule } from "./schema.mjs";
5
3
  /**
6
4
  * Resolve a rule to a value against `ctx`. Accepts a `{$rule}` placeholder or a
7
- * bare tree. A malformed or unknown node throws a `ChartRuleError` (never a
5
+ * bare node. A malformed or unknown node throws a `ChartRuleError` (never a
8
6
  * native `TypeError`), so a caller reading an untrusted, deserialized rule can
9
7
  * catch every failure with one type. When the rule is a colour placeholder, the
10
8
  * result is checked to be a colour (`string | null`) — a rule that resolves to a
11
9
  * number or boolean is a `RuleTypeError`, not something the renderer paints.
12
10
  *
13
- * Pure: the only inputs are the node and the context. No clock, no randomness,
14
- * no I/O — which is what makes it safe to run on an untrusted, user-edited tree
15
- * and identical across the renderer, the panel readout, and a test. A tree
16
- * nested past `MAX_RULE_DEPTH` throws `RuleDepthError` rather than overflowing.
11
+ * Pure and non-recursive: the only inputs are the validated flat rule and the
12
+ * context. No clock, randomness, callbacks, or I/O.
17
13
  */
18
14
  export function evaluate(rule, ctx) {
19
- if (isRulePlaceholder(rule)) {
20
- return coerceForChannel(rule.channel, visit(rule.$rule, ctx, 0));
15
+ const parsedRule = parseChartRule(rule);
16
+ if ('$rule' in parsedRule) {
17
+ return coerceForChannel(parsedRule.channel, visit(parsedRule.$rule, ctx));
21
18
  }
22
- return visit(rule, ctx, 0);
19
+ return visit(parsedRule, ctx);
23
20
  }
24
- function visit(node, ctx, depth) {
25
- if (depth > MAX_RULE_DEPTH) {
26
- throw new RuleDepthError(MAX_RULE_DEPTH);
27
- }
28
- assertRuleNode(node);
29
- const next = depth + 1;
21
+ function visit(node, ctx) {
30
22
  switch (node.kind) {
31
23
  case 'value':
32
24
  return ctx.value;
33
25
  case 'literal':
34
- return literalValue(node);
26
+ return node.value;
35
27
  case 'equals':
36
- return visit(node.left, ctx, next) === visit(node.right, ctx, next);
28
+ return operand(node.left, ctx) === operand(node.right, ctx);
37
29
  case 'isNot':
38
- return visit(node.left, ctx, next) !== visit(node.right, ctx, next);
30
+ return operand(node.left, ctx) !== operand(node.right, ctx);
39
31
  case 'lessThan':
40
- return num(visit(node.left, ctx, next)) < num(visit(node.right, ctx, next));
32
+ return numericOperand(node.left, ctx) < numericOperand(node.right, ctx);
41
33
  case 'greaterThan':
42
- return num(visit(node.left, ctx, next)) > num(visit(node.right, ctx, next));
34
+ return numericOperand(node.left, ctx) > numericOperand(node.right, ctx);
43
35
  case 'lessOrEqual':
44
- return num(visit(node.left, ctx, next)) <= num(visit(node.right, ctx, next));
36
+ return numericOperand(node.left, ctx) <= numericOperand(node.right, ctx);
45
37
  case 'greaterOrEqual':
46
- return num(visit(node.left, ctx, next)) >= num(visit(node.right, ctx, next));
38
+ return numericOperand(node.left, ctx) >= numericOperand(node.right, ctx);
47
39
  case 'ifElse':
48
- return bool(visit(node.cond, ctx, next)) ? visit(node.then, ctx, next) : visit(node.else, ctx, next);
40
+ return visit(node.cond, ctx) ? node.then.value : node.else.value;
49
41
  default:
50
42
  return unreachable(node);
51
43
  }
@@ -53,17 +45,11 @@ function visit(node, ctx, depth) {
53
45
  /* -------------------------------------------------------------------------- */
54
46
  /* Coercions — narrow a RuleValue, or throw a typed error. */
55
47
  /* -------------------------------------------------------------------------- */
56
- function num(value) {
57
- if (typeof value === 'number') {
58
- return value;
59
- }
60
- throw new RuleTypeError(`expected a number, got ${typeName(value)}`);
48
+ function operand(node, ctx) {
49
+ return node.kind === 'value' ? ctx.value : node.value;
61
50
  }
62
- function bool(value) {
63
- if (typeof value === 'boolean') {
64
- return value;
65
- }
66
- throw new RuleTypeError(`expected a boolean, got ${typeName(value)}`);
51
+ function numericOperand(node, ctx) {
52
+ return node.kind === 'value' ? ctx.value : node.value;
67
53
  }
68
54
  /** A colour channel must resolve to a colour string, or null for "no override". */
69
55
  function asColor(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.mjs","sourceRoot":"","sources":["../../src/lib/charts/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAmB;AAC/C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAiB;AAC/F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,qBAAiB;AACxD,OAAO,EACL,cAAc,GAMf,oBAAgB;AAEjB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAU,EAAE,GAAgB;IACnD,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,KAAK,CAAC,IAAc,EAAE,GAAgB,EAAE,KAAa;IAC5D,IAAI,KAAK,GAAG,cAAc,EAAE,CAAC;QAC3B,MAAM,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;IACD,cAAc,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,IAAI,GAAG,KAAK,GAA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AC,IAAwB,EAAE,GAAgB;IAChE,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACxD,CAAC;AAED,mFAAmF;AACnF,SAAS,OAAO,CAAC,KAAgB;IAC/B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,aAAa,CAAC,8DAA8D,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC3G,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,OAAoB,EAAE,KAAgB;IAC9D,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;QACxB;YACE,MAAM,IAAI,kBAAkB,CAAC,kDAAkD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtG,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgB;IAChC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;AAChD,CAAC;AAED,SAAS,WAAW,CAAC,IAAW;IAC9B,MAAM,IAAI,gBAAgB,CAAE,IAA0B,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC"}
@@ -1,101 +1,12 @@
1
- /** Stable identifier for the published contract, versioned by the tag. */
1
+ import { type BaseIssue, type GenericSchema } from 'valibot';
2
+ import { type ParsedRule, type Rule } from "./types.mjs";
3
+ /** @deprecated Use `CHART_RULE_CONTRACT_VERSION` to identify the executable contract. */
2
4
  export declare const CHART_RULE_SCHEMA_ID: string;
3
5
  /**
4
- * JSON Schema (2020-12) for the `{$rule}` placeholder and its closed node set.
5
- *
6
- * This is the contract. A consumer that keeps its own rule evaluator (rather
7
- * than importing `evaluate`) can validate against this so the two never drift —
8
- * every kind and operand shape the builders can emit is described here.
6
+ * Runtime schema for either a bare rule node or a chart-option placeholder.
7
+ * Persisted and agent-authored JSON crosses this boundary as `unknown`.
9
8
  */
10
- export declare const chartRuleSchema: {
11
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
12
- readonly $id: string;
13
- readonly title: "Chart rule placeholder";
14
- readonly description: "A rule tree the chart agent emits into a chart option, marked with $rule.";
15
- readonly type: "object";
16
- readonly required: readonly ["$rule", "channel"];
17
- readonly additionalProperties: false;
18
- readonly properties: {
19
- readonly $rule: {
20
- readonly $ref: "#/$defs/ifElse";
21
- };
22
- readonly channel: {
23
- readonly const: "color";
24
- };
25
- };
26
- readonly $defs: {
27
- readonly scalar: {
28
- readonly type: readonly ["number", "string", "boolean", "null"];
29
- };
30
- readonly node: {
31
- readonly oneOf: readonly [{
32
- readonly $ref: "#/$defs/ref";
33
- }, {
34
- readonly $ref: "#/$defs/literal";
35
- }, {
36
- readonly $ref: "#/$defs/comparison";
37
- }, {
38
- readonly $ref: "#/$defs/ifElse";
39
- }];
40
- };
41
- readonly ref: {
42
- readonly type: "object";
43
- readonly required: readonly ["kind"];
44
- readonly additionalProperties: false;
45
- readonly properties: {
46
- readonly kind: {
47
- readonly const: "value";
48
- };
49
- };
50
- };
51
- readonly literal: {
52
- readonly type: "object";
53
- readonly required: readonly ["kind", "value"];
54
- readonly additionalProperties: false;
55
- readonly properties: {
56
- readonly kind: {
57
- readonly const: "literal";
58
- };
59
- readonly value: {
60
- readonly $ref: "#/$defs/scalar";
61
- };
62
- };
63
- };
64
- readonly comparison: {
65
- readonly type: "object";
66
- readonly required: readonly ["kind", "left", "right"];
67
- readonly additionalProperties: false;
68
- readonly properties: {
69
- readonly kind: {
70
- readonly enum: readonly ["equals", "isNot", "lessThan", "greaterThan", "lessOrEqual", "greaterOrEqual"];
71
- };
72
- readonly left: {
73
- readonly $ref: "#/$defs/node";
74
- };
75
- readonly right: {
76
- readonly $ref: "#/$defs/node";
77
- };
78
- };
79
- };
80
- readonly ifElse: {
81
- readonly type: "object";
82
- readonly required: readonly ["kind", "cond", "then", "else"];
83
- readonly additionalProperties: false;
84
- readonly properties: {
85
- readonly kind: {
86
- readonly const: "ifElse";
87
- };
88
- readonly cond: {
89
- readonly $ref: "#/$defs/node";
90
- };
91
- readonly then: {
92
- readonly $ref: "#/$defs/node";
93
- };
94
- readonly else: {
95
- readonly $ref: "#/$defs/node";
96
- };
97
- };
98
- };
99
- };
100
- };
9
+ export declare const chartRuleSchema: GenericSchema<unknown, Rule, BaseIssue<unknown>>;
10
+ /** Parse untrusted chart-rule JSON and return an immutable validated clone. */
11
+ export declare function parseChartRule(input: unknown): ParsedRule;
101
12
  //# sourceMappingURL=schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.mts","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,QAAqE,CAAC;AAEvG;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DlB,CAAC"}
1
+ {"version":3,"file":"schema.d.mts","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,aAAa,EAanB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAA+B,KAAK,UAAU,EAAE,KAAK,IAAI,EAA8B,oBAAgB;AAoB9G,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,QAAqE,CAAC;AAiEvG;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAG3E,CAAC;AAEH,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAUzD"}
@@ -1,101 +1,12 @@
1
- /** Stable identifier for the published contract, versioned by the tag. */
1
+ import { type BaseIssue, type GenericSchema } from 'valibot';
2
+ import { type ParsedRule, type Rule } from "./types.js";
3
+ /** @deprecated Use `CHART_RULE_CONTRACT_VERSION` to identify the executable contract. */
2
4
  export declare const CHART_RULE_SCHEMA_ID: string;
3
5
  /**
4
- * JSON Schema (2020-12) for the `{$rule}` placeholder and its closed node set.
5
- *
6
- * This is the contract. A consumer that keeps its own rule evaluator (rather
7
- * than importing `evaluate`) can validate against this so the two never drift —
8
- * every kind and operand shape the builders can emit is described here.
6
+ * Runtime schema for either a bare rule node or a chart-option placeholder.
7
+ * Persisted and agent-authored JSON crosses this boundary as `unknown`.
9
8
  */
10
- export declare const chartRuleSchema: {
11
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
12
- readonly $id: string;
13
- readonly title: "Chart rule placeholder";
14
- readonly description: "A rule tree the chart agent emits into a chart option, marked with $rule.";
15
- readonly type: "object";
16
- readonly required: readonly ["$rule", "channel"];
17
- readonly additionalProperties: false;
18
- readonly properties: {
19
- readonly $rule: {
20
- readonly $ref: "#/$defs/ifElse";
21
- };
22
- readonly channel: {
23
- readonly const: "color";
24
- };
25
- };
26
- readonly $defs: {
27
- readonly scalar: {
28
- readonly type: readonly ["number", "string", "boolean", "null"];
29
- };
30
- readonly node: {
31
- readonly oneOf: readonly [{
32
- readonly $ref: "#/$defs/ref";
33
- }, {
34
- readonly $ref: "#/$defs/literal";
35
- }, {
36
- readonly $ref: "#/$defs/comparison";
37
- }, {
38
- readonly $ref: "#/$defs/ifElse";
39
- }];
40
- };
41
- readonly ref: {
42
- readonly type: "object";
43
- readonly required: readonly ["kind"];
44
- readonly additionalProperties: false;
45
- readonly properties: {
46
- readonly kind: {
47
- readonly const: "value";
48
- };
49
- };
50
- };
51
- readonly literal: {
52
- readonly type: "object";
53
- readonly required: readonly ["kind", "value"];
54
- readonly additionalProperties: false;
55
- readonly properties: {
56
- readonly kind: {
57
- readonly const: "literal";
58
- };
59
- readonly value: {
60
- readonly $ref: "#/$defs/scalar";
61
- };
62
- };
63
- };
64
- readonly comparison: {
65
- readonly type: "object";
66
- readonly required: readonly ["kind", "left", "right"];
67
- readonly additionalProperties: false;
68
- readonly properties: {
69
- readonly kind: {
70
- readonly enum: readonly ["equals", "isNot", "lessThan", "greaterThan", "lessOrEqual", "greaterOrEqual"];
71
- };
72
- readonly left: {
73
- readonly $ref: "#/$defs/node";
74
- };
75
- readonly right: {
76
- readonly $ref: "#/$defs/node";
77
- };
78
- };
79
- };
80
- readonly ifElse: {
81
- readonly type: "object";
82
- readonly required: readonly ["kind", "cond", "then", "else"];
83
- readonly additionalProperties: false;
84
- readonly properties: {
85
- readonly kind: {
86
- readonly const: "ifElse";
87
- };
88
- readonly cond: {
89
- readonly $ref: "#/$defs/node";
90
- };
91
- readonly then: {
92
- readonly $ref: "#/$defs/node";
93
- };
94
- readonly else: {
95
- readonly $ref: "#/$defs/node";
96
- };
97
- };
98
- };
99
- };
100
- };
9
+ export declare const chartRuleSchema: GenericSchema<unknown, Rule, BaseIssue<unknown>>;
10
+ /** Parse untrusted chart-rule JSON and return an immutable validated clone. */
11
+ export declare function parseChartRule(input: unknown): ParsedRule;
101
12
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,QAAqE,CAAC;AAEvG;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DlB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,aAAa,EAanB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAA+B,KAAK,UAAU,EAAE,KAAK,IAAI,EAA8B,mBAAgB;AAoB9G,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,QAAqE,CAAC;AAiEvG;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAG3E,CAAC;AAEH,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAUzD"}