@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
@@ -0,0 +1,73 @@
1
+ # Visualization grammar authoring reference
2
+
3
+ Use these builders only when a chart property must change according to the
4
+ current data point's numeric value. They produce JSON-safe rule data; they do not
5
+ execute callbacks or render a chart.
6
+
7
+ ## Import
8
+
9
+ In the Deno TypeScript sandbox, import from the module specifier published in
10
+ `capabilities.json`:
11
+
12
+ ```ts
13
+ import { color, greaterThan, value, when } from 'npm:@rippling/rippling-sdk/lib/charts';
14
+ ```
15
+
16
+ ## Builders
17
+
18
+ - `value` reads the current data point's plotted numeric value.
19
+ - `literal(scalar)` explicitly creates a constant. Bare numbers, strings,
20
+ booleans, and `null` are converted to literals automatically.
21
+ - `equals(left, right)`, `isNot(left, right)`, `lessThan(left, right)`,
22
+ `greaterThan(left, right)`, `lessOrEqual(left, right)`, and
23
+ `greaterOrEqual(left, right)` return a condition.
24
+ - `when(condition, ifTrue, ifFalse?)` returns `ifTrue` when the condition is true
25
+ and `ifFalse` otherwise. Both results are colour strings; the omitted false
26
+ branch becomes `null` to preserve the chart's default colour.
27
+ - `color(when(...))` marks the conditional result as a color rule.
28
+
29
+ Example: highlight values over 20 and otherwise preserve the chart's default
30
+ color.
31
+
32
+ ```ts
33
+ const conditionalColor = color(when(greaterThan(value, 20), '$token:categorical.series-5'));
34
+ ```
35
+
36
+ The builders return plain data that renderers and editors can read. Always use
37
+ the builders above. Do not hand-author the serialized `$rule` object shown here:
38
+
39
+ ```json
40
+ {
41
+ "channel": "color",
42
+ "$rule": {
43
+ "kind": "ifElse",
44
+ "cond": {
45
+ "kind": "greaterThan",
46
+ "left": { "kind": "value" },
47
+ "right": { "kind": "literal", "value": 20 }
48
+ },
49
+ "then": { "kind": "literal", "value": "$token:categorical.series-5" },
50
+ "else": { "kind": "literal", "value": null }
51
+ }
52
+ }
53
+ ```
54
+
55
+ ## Current limits
56
+
57
+ The current contract supports only the `color` channel and per-point `value`.
58
+ It has one fixed, non-recursive shape: comparisons contain only `value` or
59
+ literal operands, and `when` contains one comparison plus two colour literals.
60
+ Do not place comparisons, `when(...)`, or `color(...)` inside another operand or
61
+ branch.
62
+
63
+ Rules do not calculate aggregates such as maximum, average, or percentile. Chart
64
+ code may calculate a finite scalar threshold from its data first and then use
65
+ that scalar in a rule. For example, after computing an 80th-percentile
66
+ `threshold`, use
67
+ `color(when(greaterOrEqual(value, threshold), highlightColor))` to highlight the
68
+ top 20%. The rule remains a per-point comparison; the surrounding chart code
69
+ owns the aggregate calculation.
70
+
71
+ Other data fields, compound boolean logic, opacity, label visibility, and other
72
+ output channels are not supported. Keep static colors as ordinary chart values
73
+ rather than wrapping them in rules.
@@ -1,37 +1,48 @@
1
1
  import { ChartRuleError } from './errors';
2
2
  import {
3
- type ComparisonKind,
4
- type ComparisonNode,
3
+ type ConditionNode,
4
+ type ComparisonOperandNode,
5
+ type EqualityComparisonNode,
5
6
  type IfElseNode,
6
7
  type LiteralNode,
8
+ type NumericComparisonNode,
9
+ type NumericOperandNode,
7
10
  type RefNode,
8
- type RuleNode,
9
11
  type RulePlaceholder,
10
12
  type Scalar,
11
13
  } from './types';
12
14
 
13
- /** A rule node, a nested rule (`{$rule}` placeholder), or a bare scalar. */
14
- export type Operand = RuleNode | RulePlaceholder | Scalar;
15
+ /** A non-recursive comparison operand: `value`, a literal node, or a scalar. */
16
+ export type Operand = ComparisonOperandNode | Scalar;
17
+ export type NumericOperand = NumericOperandNode | number;
15
18
 
16
- function isRuleNode(operand: Operand): operand is RuleNode {
17
- return typeof operand === 'object' && operand !== null && 'kind' in operand;
19
+ function hasOwn(value: object, key: PropertyKey): boolean {
20
+ return Object.prototype.hasOwnProperty.call(value, key);
21
+ }
22
+
23
+ function isOperandNode(operand: Operand): operand is ComparisonOperandNode {
24
+ return typeof operand === 'object' && operand !== null && hasOwn(operand, 'kind');
18
25
  }
19
26
 
20
27
  /** True when a value is a `{$rule}` placeholder — the marker the builders emit. */
21
28
  export function isRulePlaceholder(value: unknown): value is RulePlaceholder {
22
- return typeof value === 'object' && value !== null && '$rule' in value;
29
+ return typeof value === 'object' && value !== null && hasOwn(value, '$rule');
23
30
  }
24
31
 
25
32
  /** Wrap a bare scalar as a literal node. */
26
- export function literal(value: Scalar): LiteralNode {
33
+ export function literal<const TValue extends Scalar>(value: TValue): LiteralNode<TValue> {
34
+ if (typeof value === 'number' && !Number.isFinite(value)) {
35
+ throw new ChartRuleError('literal(value) requires a finite number');
36
+ }
27
37
  return { kind: 'literal', value };
28
38
  }
29
39
 
30
- function toNode(operand: Operand): RuleNode {
31
- if (isRulePlaceholder(operand)) {
32
- return operand.$rule; // a nested rule — unwrap it, never wrap it as a literal
33
- }
34
- return isRuleNode(operand) ? operand : literal(operand);
40
+ function toOperandNode(operand: Operand): ComparisonOperandNode {
41
+ return isOperandNode(operand) ? operand : literal(operand);
42
+ }
43
+
44
+ function toNumericOperandNode(operand: NumericOperand): NumericOperandNode {
45
+ return typeof operand === 'number' ? literal(operand) : operand;
35
46
  }
36
47
 
37
48
  /**
@@ -40,36 +51,43 @@ function toNode(operand: Operand): RuleNode {
40
51
  */
41
52
  export const value: RefNode = Object.freeze({ kind: 'value' });
42
53
 
43
- /* Comparisons — return a condition. */
44
- function comparison(kind: ComparisonKind): (left: Operand, right: Operand) => ComparisonNode {
45
- return (left, right) => ({ kind, left: toNode(left), right: toNode(right) });
54
+ /* Comparisons — return a condition with no nested expressions. */
55
+ function equalityComparison(
56
+ kind: EqualityComparisonNode['kind'],
57
+ ): (left: Operand, right: Operand) => EqualityComparisonNode {
58
+ return (left, right) => ({ kind, left: toOperandNode(left), right: toOperandNode(right) });
59
+ }
60
+ function numericComparison(
61
+ kind: NumericComparisonNode['kind'],
62
+ ): (left: NumericOperand, right: NumericOperand) => NumericComparisonNode {
63
+ return (left, right) => ({ kind, left: toNumericOperandNode(left), right: toNumericOperandNode(right) });
46
64
  }
47
- export const equals = comparison('equals');
48
- export const isNot = comparison('isNot');
49
- export const lessThan = comparison('lessThan');
50
- export const greaterThan = comparison('greaterThan');
51
- export const lessOrEqual = comparison('lessOrEqual');
52
- export const greaterOrEqual = comparison('greaterOrEqual');
65
+ export const equals = equalityComparison('equals');
66
+ export const isNot = equalityComparison('isNot');
67
+ export const lessThan = numericComparison('lessThan');
68
+ export const greaterThan = numericComparison('greaterThan');
69
+ export const lessOrEqual = numericComparison('lessOrEqual');
70
+ export const greaterOrEqual = numericComparison('greaterOrEqual');
53
71
 
54
72
  /**
55
- * A conditional value: pick `ifTrue` when the condition holds, else `ifFalse`.
56
- * Channel-agnostic — wrap it in a channel builder (`color`) to target something.
73
+ * A conditional colour: pick `ifTrue` when the condition holds, else `ifFalse`.
57
74
  *
58
75
  * when(lessThan(value, 100), '#E24B4A', '#378ADD')
59
76
  * // → '#E24B4A' when this point's value is under 100, '#378ADD' otherwise
60
77
  *
61
78
  * `ifFalse` is optional and defaults to `null` — for a colour, that means no
62
- * override (the chart's default is kept). Returns a plain node, not a placeholder.
79
+ * override (the chart's default is kept). Branches are colour literals only;
80
+ * nested rules are intentionally unsupported in v1.
63
81
  */
64
- export function when(condition: RuleNode, ifTrue: Operand, ifFalse?: Operand): IfElseNode {
82
+ export function when(condition: ConditionNode, ifTrue: string, ifFalse: string | null = null): IfElseNode {
65
83
  if (ifTrue === undefined) {
66
84
  throw new ChartRuleError('when(condition, ifTrue, ifFalse?) needs a value for the true case');
67
85
  }
68
86
  return {
69
87
  kind: 'ifElse',
70
88
  cond: condition,
71
- then: toNode(ifTrue),
72
- else: toNode(ifFalse ?? null),
89
+ then: literal(ifTrue),
90
+ else: literal(ifFalse),
73
91
  };
74
92
  }
75
93
 
@@ -80,11 +98,9 @@ export function when(condition: RuleNode, ifTrue: Operand, ifFalse?: Operand): I
80
98
  * color(when(lessThan(value, 100), '#E24B4A', '#378ADD'))
81
99
  * // → red when this point's value is under 100, blue otherwise
82
100
  *
83
- * Takes a conditional value — a `when(...)` (`IfElseNode`) or an already-wrapped
84
- * rule — not a bare `value` or comparison: those resolve to a number or a
85
- * boolean, which is not a colour. `evaluate` enforces the same at runtime for a
86
- * deserialized rule. Returns a `{$rule}` placeholder tagged `channel: 'color'`.
101
+ * Takes the flat conditional value produced by `when(...)`. Returns a `{$rule}`
102
+ * placeholder tagged `channel: 'color'`.
87
103
  */
88
- export function color(rule: IfElseNode | RulePlaceholder): RulePlaceholder {
89
- return { $rule: isRulePlaceholder(rule) ? rule.$rule : rule, channel: 'color' };
104
+ export function color(rule: IfElseNode): RulePlaceholder {
105
+ return { $rule: rule, channel: 'color' };
90
106
  }
@@ -0,0 +1,96 @@
1
+ {
2
+ "contractVersion": 1,
3
+ "moduleSpecifier": "npm:@rippling/rippling-sdk/lib/charts",
4
+ "builders": {
5
+ "value": {
6
+ "kind": "input",
7
+ "returns": "number"
8
+ },
9
+ "literal": {
10
+ "kind": "literal",
11
+ "parameters": [
12
+ "scalar"
13
+ ],
14
+ "returns": "value"
15
+ },
16
+ "equals": {
17
+ "kind": "comparison",
18
+ "parameters": [
19
+ "value",
20
+ "value"
21
+ ],
22
+ "returns": "condition"
23
+ },
24
+ "isNot": {
25
+ "kind": "comparison",
26
+ "parameters": [
27
+ "value",
28
+ "value"
29
+ ],
30
+ "returns": "condition"
31
+ },
32
+ "lessThan": {
33
+ "kind": "comparison",
34
+ "parameters": [
35
+ "value",
36
+ "value"
37
+ ],
38
+ "returns": "condition"
39
+ },
40
+ "greaterThan": {
41
+ "kind": "comparison",
42
+ "parameters": [
43
+ "value",
44
+ "value"
45
+ ],
46
+ "returns": "condition"
47
+ },
48
+ "lessOrEqual": {
49
+ "kind": "comparison",
50
+ "parameters": [
51
+ "value",
52
+ "value"
53
+ ],
54
+ "returns": "condition"
55
+ },
56
+ "greaterOrEqual": {
57
+ "kind": "comparison",
58
+ "parameters": [
59
+ "value",
60
+ "value"
61
+ ],
62
+ "returns": "condition"
63
+ },
64
+ "when": {
65
+ "kind": "conditional",
66
+ "parameters": [
67
+ "condition",
68
+ "color",
69
+ "color?"
70
+ ],
71
+ "returns": "conditional-color"
72
+ },
73
+ "color": {
74
+ "kind": "channel",
75
+ "parameters": [
76
+ "conditional-color"
77
+ ],
78
+ "returns": "color-rule",
79
+ "placeholderChannel": "color"
80
+ }
81
+ },
82
+ "supportedChannels": [
83
+ "color"
84
+ ],
85
+ "supportedNodeKinds": [
86
+ "literal",
87
+ "value",
88
+ "equals",
89
+ "isNot",
90
+ "lessThan",
91
+ "greaterThan",
92
+ "lessOrEqual",
93
+ "greaterOrEqual",
94
+ "ifElse"
95
+ ]
96
+ }
@@ -1,56 +1,50 @@
1
- import { isRulePlaceholder } from './builders';
2
- import { RuleDepthError, UnknownNodeError } from './errors';
3
- import { assertRuleNode, literalValue } from './guards';
4
- import { MAX_RULE_DEPTH, type Control, type Rule, type RuleNode } from './types';
1
+ import { UnknownNodeError } from './errors';
2
+ import { parseChartRule } from './schema';
3
+ import { type ComparisonOperandNode, type Control, type RuleNode } from './types';
5
4
 
6
5
  /**
7
6
  * Turn a rule into the shape the settings panel renders: a label plus its
8
- * editable parts. Accepts a `{$rule}` placeholder or a bare tree. Walks the same
9
- * tree `evaluate` runs — and validates each node the same way — so a malformed or
7
+ * editable parts. Accepts a `{$rule}` placeholder or a bare node. Reads the same
8
+ * value `evaluate` runs — and validates it the same way — so a malformed or
10
9
  * unknown node throws a `ChartRuleError` here too, never a native `TypeError`.
11
- * The unwrap is gated on `isRulePlaceholder` (not a raw `'$rule' in rule`) so a
12
- * `null`/primitive rule reaches `assertRuleNode` instead of throwing on `in`.
13
- * A tree nested past `MAX_RULE_DEPTH` throws `RuleDepthError`.
10
+ * The Valibot parser rejects malformed or nested values before this flat
11
+ * formatter reads them.
14
12
  */
15
- export function describe(rule: Rule): Control {
16
- if (isRulePlaceholder(rule)) {
17
- return visit(rule.$rule, 0);
13
+ export function describe(rule: unknown): Control {
14
+ const parsedRule = parseChartRule(rule);
15
+ if ('$rule' in parsedRule) {
16
+ return visit(parsedRule.$rule);
18
17
  }
19
- return visit(rule, 0);
18
+ return visit(parsedRule);
20
19
  }
21
20
 
22
- function visit(node: RuleNode, depth: number): Control {
23
- if (depth > MAX_RULE_DEPTH) {
24
- throw new RuleDepthError(MAX_RULE_DEPTH);
25
- }
26
- assertRuleNode(node);
27
- const next = depth + 1;
21
+ function visit(node: RuleNode): Control {
28
22
  switch (node.kind) {
29
23
  case 'value':
30
24
  return { role: 'ref', label: "this row's value" };
31
25
  case 'literal': {
32
- const scalar = literalValue(node);
26
+ const scalar = node.value;
33
27
  return { role: 'literal', label: String(scalar), value: scalar };
34
28
  }
35
29
 
36
30
  case 'equals':
37
- return comparison('is', node.left, node.right, next);
31
+ return comparison('is', node.left, node.right);
38
32
  case 'isNot':
39
- return comparison('is not', node.left, node.right, next);
33
+ return comparison('is not', node.left, node.right);
40
34
  case 'lessThan':
41
- return comparison('is under', node.left, node.right, next);
35
+ return comparison('is under', node.left, node.right);
42
36
  case 'greaterThan':
43
- return comparison('is over', node.left, node.right, next);
37
+ return comparison('is over', node.left, node.right);
44
38
  case 'lessOrEqual':
45
- return comparison('is at most', node.left, node.right, next);
39
+ return comparison('is at most', node.left, node.right);
46
40
  case 'greaterOrEqual':
47
- return comparison('is at least', node.left, node.right, next);
41
+ return comparison('is at least', node.left, node.right);
48
42
 
49
43
  case 'ifElse':
50
44
  return {
51
45
  role: 'rule',
52
46
  label: 'when',
53
- parts: [visit(node.cond, next), visit(node.then, next), visit(node.else, next)],
47
+ parts: [visit(node.cond), literalControl(node.then.value), literalControl(node.else.value)],
54
48
  };
55
49
 
56
50
  default:
@@ -58,8 +52,16 @@ function visit(node: RuleNode, depth: number): Control {
58
52
  }
59
53
  }
60
54
 
61
- function comparison(label: string, left: RuleNode, right: RuleNode, depth: number): Control {
62
- return { role: 'comparison', label, parts: [visit(left, depth), visit(right, depth)] };
55
+ function comparison(label: string, left: ComparisonOperandNode, right: ComparisonOperandNode): Control {
56
+ return { role: 'comparison', label, parts: [operandControl(left), operandControl(right)] };
57
+ }
58
+
59
+ function operandControl(node: ComparisonOperandNode): Control {
60
+ return node.kind === 'value' ? { role: 'ref', label: "this row's value" } : literalControl(node.value);
61
+ }
62
+
63
+ function literalControl(value: string | number | boolean | null): Control {
64
+ return { role: 'literal', label: String(value), value };
63
65
  }
64
66
 
65
67
  function unreachable(node: never): never {
@@ -21,7 +21,7 @@ export class RuleTypeError extends ChartRuleError {
21
21
  }
22
22
 
23
23
  /**
24
- * A structurally invalid node in a deserialized tree: not an object, no string
24
+ * A structurally invalid node in a deserialized value: not an object, no string
25
25
  * `kind`, or a `literal` without a scalar `value`. Distinct from
26
26
  * `UnknownNodeError` (a well-formed node whose `kind` is simply not in the
27
27
  * vocabulary — the intentional escape hatch). Like the others it is a
@@ -35,11 +35,7 @@ export class MalformedRuleError extends ChartRuleError {
35
35
  }
36
36
  }
37
37
 
38
- /**
39
- * A rule nested deeper than the evaluator will walk. Guards against a
40
- * stack-overflowing tree from untrusted, deserialized input; like the others it
41
- * is a `ChartRuleError`, so the caller's escape hatch catches it.
42
- */
38
+ /** @deprecated v1 is non-recursive. Retained for source compatibility. */
43
39
  export class RuleDepthError extends ChartRuleError {
44
40
  constructor(maxDepth: number) {
45
41
  super(`chart rule nested deeper than ${maxDepth} levels`);
@@ -1,9 +1,8 @@
1
- import { isRulePlaceholder } from './builders';
2
- import { MalformedRuleError, RuleDepthError, RuleTypeError, UnknownNodeError } from './errors';
3
- import { assertRuleNode, literalValue } from './guards';
1
+ import { MalformedRuleError, RuleTypeError, UnknownNodeError } from './errors';
2
+ import { parseChartRule } from './schema';
4
3
  import {
5
- MAX_RULE_DEPTH,
6
- type Rule,
4
+ type ComparisonOperandNode,
5
+ type NumericOperandNode,
7
6
  type RuleChannel,
8
7
  type RuleContext,
9
8
  type RuleNode,
@@ -12,51 +11,45 @@ import {
12
11
 
13
12
  /**
14
13
  * Resolve a rule to a value against `ctx`. Accepts a `{$rule}` placeholder or a
15
- * bare tree. A malformed or unknown node throws a `ChartRuleError` (never a
14
+ * bare node. A malformed or unknown node throws a `ChartRuleError` (never a
16
15
  * native `TypeError`), so a caller reading an untrusted, deserialized rule can
17
16
  * catch every failure with one type. When the rule is a colour placeholder, the
18
17
  * result is checked to be a colour (`string | null`) — a rule that resolves to a
19
18
  * number or boolean is a `RuleTypeError`, not something the renderer paints.
20
19
  *
21
- * Pure: the only inputs are the node and the context. No clock, no randomness,
22
- * no I/O — which is what makes it safe to run on an untrusted, user-edited tree
23
- * and identical across the renderer, the panel readout, and a test. A tree
24
- * nested past `MAX_RULE_DEPTH` throws `RuleDepthError` rather than overflowing.
20
+ * Pure and non-recursive: the only inputs are the validated flat rule and the
21
+ * context. No clock, randomness, callbacks, or I/O.
25
22
  */
26
- export function evaluate(rule: Rule, ctx: RuleContext): RuleValue {
27
- if (isRulePlaceholder(rule)) {
28
- return coerceForChannel(rule.channel, visit(rule.$rule, ctx, 0));
23
+ export function evaluate(rule: unknown, ctx: RuleContext): RuleValue {
24
+ const parsedRule = parseChartRule(rule);
25
+ if ('$rule' in parsedRule) {
26
+ return coerceForChannel(parsedRule.channel, visit(parsedRule.$rule, ctx));
29
27
  }
30
- return visit(rule, ctx, 0);
28
+ return visit(parsedRule, ctx);
31
29
  }
32
30
 
33
- function visit(node: RuleNode, ctx: RuleContext, depth: number): RuleValue {
34
- if (depth > MAX_RULE_DEPTH) {
35
- throw new RuleDepthError(MAX_RULE_DEPTH);
36
- }
37
- assertRuleNode(node);
38
- const next = depth + 1;
31
+ function visit(node: RuleNode, ctx: RuleContext): RuleValue {
39
32
  switch (node.kind) {
40
33
  case 'value':
41
34
  return ctx.value;
42
35
  case 'literal':
43
- return literalValue(node);
36
+ return node.value;
44
37
 
45
38
  case 'equals':
46
- return visit(node.left, ctx, next) === visit(node.right, ctx, next);
39
+ return operand(node.left, ctx) === operand(node.right, ctx);
47
40
  case 'isNot':
48
- return visit(node.left, ctx, next) !== visit(node.right, ctx, next);
41
+ return operand(node.left, ctx) !== operand(node.right, ctx);
49
42
  case 'lessThan':
50
- return num(visit(node.left, ctx, next)) < num(visit(node.right, ctx, next));
43
+ return numericOperand(node.left, ctx) < numericOperand(node.right, ctx);
51
44
  case 'greaterThan':
52
- return num(visit(node.left, ctx, next)) > num(visit(node.right, ctx, next));
45
+ return numericOperand(node.left, ctx) > numericOperand(node.right, ctx);
53
46
  case 'lessOrEqual':
54
- return num(visit(node.left, ctx, next)) <= num(visit(node.right, ctx, next));
47
+ return numericOperand(node.left, ctx) <= numericOperand(node.right, ctx);
55
48
  case 'greaterOrEqual':
56
- return num(visit(node.left, ctx, next)) >= num(visit(node.right, ctx, next));
49
+ return numericOperand(node.left, ctx) >= numericOperand(node.right, ctx);
57
50
 
58
51
  case 'ifElse':
59
- return bool(visit(node.cond, ctx, next)) ? visit(node.then, ctx, next) : visit(node.else, ctx, next);
52
+ return visit(node.cond, ctx) ? node.then.value : node.else.value;
60
53
 
61
54
  default:
62
55
  return unreachable(node);
@@ -67,18 +60,12 @@ function visit(node: RuleNode, ctx: RuleContext, depth: number): RuleValue {
67
60
  /* Coercions — narrow a RuleValue, or throw a typed error. */
68
61
  /* -------------------------------------------------------------------------- */
69
62
 
70
- function num(value: RuleValue): number {
71
- if (typeof value === 'number') {
72
- return value;
73
- }
74
- throw new RuleTypeError(`expected a number, got ${typeName(value)}`);
63
+ function operand(node: ComparisonOperandNode, ctx: RuleContext): RuleValue {
64
+ return node.kind === 'value' ? ctx.value : node.value;
75
65
  }
76
66
 
77
- function bool(value: RuleValue): boolean {
78
- if (typeof value === 'boolean') {
79
- return value;
80
- }
81
- throw new RuleTypeError(`expected a boolean, got ${typeName(value)}`);
67
+ function numericOperand(node: NumericOperandNode, ctx: RuleContext): number {
68
+ return node.kind === 'value' ? ctx.value : node.value;
82
69
  }
83
70
 
84
71
  /** A colour channel must resolve to a colour string, or null for "no override". */