@elastic/isomer-sdk 0.0.0 → 0.2.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 (492) hide show
  1. package/LICENSE.txt +93 -0
  2. package/NOTICE.txt +1861 -0
  3. package/README.md +69 -0
  4. package/THIRD_PARTY_LICENSES.md +957 -0
  5. package/dist/author/authored_fields.d.ts +153 -0
  6. package/dist/author/authored_fields.d.ts.map +1 -0
  7. package/dist/author/authored_fields.js +227 -0
  8. package/dist/author/authored_fields.js.map +1 -0
  9. package/dist/author/authoring_input.d.ts +7 -0
  10. package/dist/author/authoring_input.d.ts.map +1 -0
  11. package/dist/author/authoring_input.js +60 -0
  12. package/dist/author/authoring_input.js.map +1 -0
  13. package/dist/author/authoring_model.d.ts +27 -0
  14. package/dist/author/authoring_model.d.ts.map +1 -0
  15. package/dist/author/authoring_model.js +98 -0
  16. package/dist/author/authoring_model.js.map +1 -0
  17. package/dist/author/declarations.d.ts +13 -0
  18. package/dist/author/declarations.d.ts.map +1 -0
  19. package/dist/author/declarations.js +277 -0
  20. package/dist/author/declarations.js.map +1 -0
  21. package/dist/author/index.d.ts +7 -0
  22. package/dist/author/index.d.ts.map +1 -0
  23. package/dist/author/index.js +12 -0
  24. package/dist/author/index.js.map +1 -0
  25. package/dist/author/jsx.d.ts +21 -0
  26. package/dist/author/jsx.d.ts.map +1 -0
  27. package/dist/author/jsx.js +20 -0
  28. package/dist/author/jsx.js.map +1 -0
  29. package/dist/author/jsx_shim.d.ts +117 -0
  30. package/dist/author/jsx_shim.d.ts.map +1 -0
  31. package/dist/author/jsx_shim.js +270 -0
  32. package/dist/author/jsx_shim.js.map +1 -0
  33. package/dist/author/prompt.d.ts +58 -0
  34. package/dist/author/prompt.d.ts.map +1 -0
  35. package/dist/author/prompt.js +148 -0
  36. package/dist/author/prompt.js.map +1 -0
  37. package/dist/author/schema_to_typescript.d.ts +37 -0
  38. package/dist/author/schema_to_typescript.d.ts.map +1 -0
  39. package/dist/author/schema_to_typescript.js +286 -0
  40. package/dist/author/schema_to_typescript.js.map +1 -0
  41. package/dist/cjs/author/authored_fields.js +233 -0
  42. package/dist/cjs/author/authored_fields.js.map +1 -0
  43. package/dist/cjs/author/authoring_input.js +64 -0
  44. package/dist/cjs/author/authoring_input.js.map +1 -0
  45. package/dist/cjs/author/authoring_model.js +104 -0
  46. package/dist/cjs/author/authoring_model.js.map +1 -0
  47. package/dist/cjs/author/declarations.js +281 -0
  48. package/dist/cjs/author/declarations.js.map +1 -0
  49. package/dist/cjs/author/index.js +25 -0
  50. package/dist/cjs/author/index.js.map +1 -0
  51. package/dist/cjs/author/jsx.js +24 -0
  52. package/dist/cjs/author/jsx.js.map +1 -0
  53. package/dist/cjs/author/jsx_shim.js +276 -0
  54. package/dist/cjs/author/jsx_shim.js.map +1 -0
  55. package/dist/cjs/author/prompt.js +153 -0
  56. package/dist/cjs/author/prompt.js.map +1 -0
  57. package/dist/cjs/author/schema_to_typescript.js +295 -0
  58. package/dist/cjs/author/schema_to_typescript.js.map +1 -0
  59. package/dist/cjs/composition/action_event.js +9 -0
  60. package/dist/cjs/composition/action_event.js.map +1 -0
  61. package/dist/cjs/composition/body_node_base.js +112 -0
  62. package/dist/cjs/composition/body_node_base.js.map +1 -0
  63. package/dist/cjs/composition/composition.js +9 -0
  64. package/dist/cjs/composition/composition.js.map +1 -0
  65. package/dist/cjs/composition/error.js +73 -0
  66. package/dist/cjs/composition/error.js.map +1 -0
  67. package/dist/cjs/composition/index.js +32 -0
  68. package/dist/cjs/composition/index.js.map +1 -0
  69. package/dist/cjs/composition/map_nodes.js +85 -0
  70. package/dist/cjs/composition/map_nodes.js.map +1 -0
  71. package/dist/cjs/composition/named_color.js +20 -0
  72. package/dist/cjs/composition/named_color.js.map +1 -0
  73. package/dist/cjs/composition/node.js +9 -0
  74. package/dist/cjs/composition/node.js.map +1 -0
  75. package/dist/cjs/composition/one_line.js +23 -0
  76. package/dist/cjs/composition/one_line.js.map +1 -0
  77. package/dist/cjs/composition/structured_value.js +21 -0
  78. package/dist/cjs/composition/structured_value.js.map +1 -0
  79. package/dist/cjs/composition/validation_error.js +40 -0
  80. package/dist/cjs/composition/validation_error.js.map +1 -0
  81. package/dist/cjs/define/frame.js +31 -0
  82. package/dist/cjs/define/frame.js.map +1 -0
  83. package/dist/cjs/define/index.js +31 -0
  84. package/dist/cjs/define/index.js.map +1 -0
  85. package/dist/cjs/define/markdown_content.js +12 -0
  86. package/dist/cjs/define/markdown_content.js.map +1 -0
  87. package/dist/cjs/define/primitive_example.js +26 -0
  88. package/dist/cjs/define/primitive_example.js.map +1 -0
  89. package/dist/cjs/define/primitive_icon.js +17 -0
  90. package/dist/cjs/define/primitive_icon.js.map +1 -0
  91. package/dist/cjs/define/primitive_module.js +118 -0
  92. package/dist/cjs/define/primitive_module.js.map +1 -0
  93. package/dist/cjs/define/slack_assets.js +9 -0
  94. package/dist/cjs/define/slack_assets.js.map +1 -0
  95. package/dist/cjs/define/slack_blocks.js +9 -0
  96. package/dist/cjs/define/slack_blocks.js.map +1 -0
  97. package/dist/cjs/define/zod_format.js +122 -0
  98. package/dist/cjs/define/zod_format.js.map +1 -0
  99. package/dist/cjs/define/zod_helpers.js +26 -0
  100. package/dist/cjs/define/zod_helpers.js.map +1 -0
  101. package/dist/cjs/entries/html.js +12 -0
  102. package/dist/cjs/entries/html.js.map +1 -0
  103. package/dist/cjs/entries/index.js +80 -0
  104. package/dist/cjs/entries/index.js.map +1 -0
  105. package/dist/cjs/entries/markdown.js +14 -0
  106. package/dist/cjs/entries/markdown.js.map +1 -0
  107. package/dist/cjs/entries/react.js +20 -0
  108. package/dist/cjs/entries/react.js.map +1 -0
  109. package/dist/cjs/entries/slack.js +25 -0
  110. package/dist/cjs/entries/slack.js.map +1 -0
  111. package/dist/cjs/entries/text.js +12 -0
  112. package/dist/cjs/entries/text.js.map +1 -0
  113. package/dist/cjs/pack/capabilities.js +40 -0
  114. package/dist/cjs/pack/capabilities.js.map +1 -0
  115. package/dist/cjs/pack/compose.js +59 -0
  116. package/dist/cjs/pack/compose.js.map +1 -0
  117. package/dist/cjs/pack/enhancements.js +65 -0
  118. package/dist/cjs/pack/enhancements.js.map +1 -0
  119. package/dist/cjs/pack/index.js +18 -0
  120. package/dist/cjs/pack/index.js.map +1 -0
  121. package/dist/cjs/pack/primitive_pack.js +97 -0
  122. package/dist/cjs/pack/primitive_pack.js.map +1 -0
  123. package/dist/cjs/package.json +3 -0
  124. package/dist/cjs/render/anchors.js +167 -0
  125. package/dist/cjs/render/anchors.js.map +1 -0
  126. package/dist/cjs/render/context_view.js +54 -0
  127. package/dist/cjs/render/context_view.js.map +1 -0
  128. package/dist/cjs/render/format_display_value.js +143 -0
  129. package/dist/cjs/render/format_display_value.js.map +1 -0
  130. package/dist/cjs/render/format_number.js +46 -0
  131. package/dist/cjs/render/format_number.js.map +1 -0
  132. package/dist/cjs/render/html/enhancements.js +30 -0
  133. package/dist/cjs/render/html/enhancements.js.map +1 -0
  134. package/dist/cjs/render/html/envelope.js +218 -0
  135. package/dist/cjs/render/html/envelope.js.map +1 -0
  136. package/dist/cjs/render/html/index.js +12 -0
  137. package/dist/cjs/render/html/index.js.map +1 -0
  138. package/dist/cjs/render/index.js +25 -0
  139. package/dist/cjs/render/index.js.map +1 -0
  140. package/dist/cjs/render/layout_check.js +133 -0
  141. package/dist/cjs/render/layout_check.js.map +1 -0
  142. package/dist/cjs/render/markdown/builder.js +195 -0
  143. package/dist/cjs/render/markdown/builder.js.map +1 -0
  144. package/dist/cjs/render/markdown/envelope.js +33 -0
  145. package/dist/cjs/render/markdown/envelope.js.map +1 -0
  146. package/dist/cjs/render/markdown/format.js +208 -0
  147. package/dist/cjs/render/markdown/format.js.map +1 -0
  148. package/dist/cjs/render/markdown/index.js +15 -0
  149. package/dist/cjs/render/markdown/index.js.map +1 -0
  150. package/dist/cjs/render/measure_dom.js +61 -0
  151. package/dist/cjs/render/measure_dom.js.map +1 -0
  152. package/dist/cjs/render/payload.js +13 -0
  153. package/dist/cjs/render/payload.js.map +1 -0
  154. package/dist/cjs/render/primitive_dispatch.js +173 -0
  155. package/dist/cjs/render/primitive_dispatch.js.map +1 -0
  156. package/dist/cjs/render/react/content.js +44 -0
  157. package/dist/cjs/render/react/content.js.map +1 -0
  158. package/dist/cjs/render/react/enhancements.js +32 -0
  159. package/dist/cjs/render/react/enhancements.js.map +1 -0
  160. package/dist/cjs/render/react/index.js +15 -0
  161. package/dist/cjs/render/react/index.js.map +1 -0
  162. package/dist/cjs/render/slack/assets.js +45 -0
  163. package/dist/cjs/render/slack/assets.js.map +1 -0
  164. package/dist/cjs/render/slack/blocks.js +80 -0
  165. package/dist/cjs/render/slack/blocks.js.map +1 -0
  166. package/dist/cjs/render/slack/envelope.js +551 -0
  167. package/dist/cjs/render/slack/envelope.js.map +1 -0
  168. package/dist/cjs/render/slack/format.js +225 -0
  169. package/dist/cjs/render/slack/format.js.map +1 -0
  170. package/dist/cjs/render/slack/index.js +30 -0
  171. package/dist/cjs/render/slack/index.js.map +1 -0
  172. package/dist/cjs/render/slack/markdown_content.js +409 -0
  173. package/dist/cjs/render/slack/markdown_content.js.map +1 -0
  174. package/dist/cjs/render/text/envelope.js +21 -0
  175. package/dist/cjs/render/text/envelope.js.map +1 -0
  176. package/dist/cjs/render/text/index.js +12 -0
  177. package/dist/cjs/render/text/index.js.map +1 -0
  178. package/dist/cjs/testing/conformance.js +312 -0
  179. package/dist/cjs/testing/conformance.js.map +1 -0
  180. package/dist/cjs/testing/icon.js +248 -0
  181. package/dist/cjs/testing/icon.js.map +1 -0
  182. package/dist/cjs/testing/index.js +18 -0
  183. package/dist/cjs/testing/index.js.map +1 -0
  184. package/dist/cjs/testing/registration.js +142 -0
  185. package/dist/cjs/testing/registration.js.map +1 -0
  186. package/dist/cjs/validate/authoring_schema.js +312 -0
  187. package/dist/cjs/validate/authoring_schema.js.map +1 -0
  188. package/dist/cjs/validate/composition_schema.js +135 -0
  189. package/dist/cjs/validate/composition_schema.js.map +1 -0
  190. package/dist/cjs/validate/index.js +53 -0
  191. package/dist/cjs/validate/index.js.map +1 -0
  192. package/dist/cjs/validate/input_budget.js +156 -0
  193. package/dist/cjs/validate/input_budget.js.map +1 -0
  194. package/dist/cjs/validate/json_schema.js +72 -0
  195. package/dist/cjs/validate/json_schema.js.map +1 -0
  196. package/dist/cjs/validate/node_issues.js +65 -0
  197. package/dist/cjs/validate/node_issues.js.map +1 -0
  198. package/dist/cjs/validate/url.js +116 -0
  199. package/dist/cjs/validate/url.js.map +1 -0
  200. package/dist/cjs/validate/validation.js +165 -0
  201. package/dist/cjs/validate/validation.js.map +1 -0
  202. package/dist/cjs/validate/value_schemas.js +53 -0
  203. package/dist/cjs/validate/value_schemas.js.map +1 -0
  204. package/dist/composition/action_event.d.ts +13 -0
  205. package/dist/composition/action_event.d.ts.map +1 -0
  206. package/dist/composition/action_event.js +8 -0
  207. package/dist/composition/action_event.js.map +1 -0
  208. package/dist/composition/body_node_base.d.ts +72 -0
  209. package/dist/composition/body_node_base.d.ts.map +1 -0
  210. package/dist/composition/body_node_base.js +104 -0
  211. package/dist/composition/body_node_base.js.map +1 -0
  212. package/dist/composition/composition.d.ts +71 -0
  213. package/dist/composition/composition.d.ts.map +1 -0
  214. package/dist/composition/composition.js +8 -0
  215. package/dist/composition/composition.js.map +1 -0
  216. package/dist/composition/error.d.ts +61 -0
  217. package/dist/composition/error.d.ts.map +1 -0
  218. package/dist/composition/error.js +69 -0
  219. package/dist/composition/error.js.map +1 -0
  220. package/dist/composition/index.d.ts +11 -0
  221. package/dist/composition/index.d.ts.map +1 -0
  222. package/dist/composition/index.js +14 -0
  223. package/dist/composition/index.js.map +1 -0
  224. package/dist/composition/map_nodes.d.ts +16 -0
  225. package/dist/composition/map_nodes.d.ts.map +1 -0
  226. package/dist/composition/map_nodes.js +81 -0
  227. package/dist/composition/map_nodes.js.map +1 -0
  228. package/dist/composition/named_color.d.ts +9 -0
  229. package/dist/composition/named_color.d.ts.map +1 -0
  230. package/dist/composition/named_color.js +17 -0
  231. package/dist/composition/named_color.js.map +1 -0
  232. package/dist/composition/node.d.ts +11 -0
  233. package/dist/composition/node.d.ts.map +1 -0
  234. package/dist/composition/node.js +8 -0
  235. package/dist/composition/node.js.map +1 -0
  236. package/dist/composition/one_line.d.ts +7 -0
  237. package/dist/composition/one_line.d.ts.map +1 -0
  238. package/dist/composition/one_line.js +17 -0
  239. package/dist/composition/one_line.js.map +1 -0
  240. package/dist/composition/structured_value.d.ts +27 -0
  241. package/dist/composition/structured_value.d.ts.map +1 -0
  242. package/dist/composition/structured_value.js +18 -0
  243. package/dist/composition/structured_value.js.map +1 -0
  244. package/dist/composition/validation_error.d.ts +33 -0
  245. package/dist/composition/validation_error.d.ts.map +1 -0
  246. package/dist/composition/validation_error.js +35 -0
  247. package/dist/composition/validation_error.js.map +1 -0
  248. package/dist/define/frame.d.ts +155 -0
  249. package/dist/define/frame.d.ts.map +1 -0
  250. package/dist/define/frame.js +27 -0
  251. package/dist/define/frame.js.map +1 -0
  252. package/dist/define/index.d.ts +10 -0
  253. package/dist/define/index.d.ts.map +1 -0
  254. package/dist/define/index.js +13 -0
  255. package/dist/define/index.js.map +1 -0
  256. package/dist/define/markdown_content.d.ts +15 -0
  257. package/dist/define/markdown_content.d.ts.map +1 -0
  258. package/dist/define/markdown_content.js +9 -0
  259. package/dist/define/markdown_content.js.map +1 -0
  260. package/dist/define/primitive_example.d.ts +30 -0
  261. package/dist/define/primitive_example.d.ts.map +1 -0
  262. package/dist/define/primitive_example.js +21 -0
  263. package/dist/define/primitive_example.js.map +1 -0
  264. package/dist/define/primitive_icon.d.ts +11 -0
  265. package/dist/define/primitive_icon.d.ts.map +1 -0
  266. package/dist/define/primitive_icon.js +14 -0
  267. package/dist/define/primitive_icon.js.map +1 -0
  268. package/dist/define/primitive_module.d.ts +435 -0
  269. package/dist/define/primitive_module.d.ts.map +1 -0
  270. package/dist/define/primitive_module.js +112 -0
  271. package/dist/define/primitive_module.js.map +1 -0
  272. package/dist/define/slack_assets.d.ts +28 -0
  273. package/dist/define/slack_assets.d.ts.map +1 -0
  274. package/dist/define/slack_assets.js +8 -0
  275. package/dist/define/slack_assets.js.map +1 -0
  276. package/dist/define/slack_blocks.d.ts +234 -0
  277. package/dist/define/slack_blocks.d.ts.map +1 -0
  278. package/dist/define/slack_blocks.js +8 -0
  279. package/dist/define/slack_blocks.js.map +1 -0
  280. package/dist/define/zod_format.d.ts +33 -0
  281. package/dist/define/zod_format.d.ts.map +1 -0
  282. package/dist/define/zod_format.js +114 -0
  283. package/dist/define/zod_format.js.map +1 -0
  284. package/dist/define/zod_helpers.d.ts +10 -0
  285. package/dist/define/zod_helpers.d.ts.map +1 -0
  286. package/dist/define/zod_helpers.js +22 -0
  287. package/dist/define/zod_helpers.js.map +1 -0
  288. package/dist/entries/html.d.ts +3 -0
  289. package/dist/entries/html.d.ts.map +1 -0
  290. package/dist/entries/html.js +8 -0
  291. package/dist/entries/html.js.map +1 -0
  292. package/dist/entries/index.d.ts +6 -0
  293. package/dist/entries/index.d.ts.map +1 -0
  294. package/dist/entries/index.js +12 -0
  295. package/dist/entries/index.js.map +1 -0
  296. package/dist/entries/markdown.d.ts +3 -0
  297. package/dist/entries/markdown.d.ts.map +1 -0
  298. package/dist/entries/markdown.js +8 -0
  299. package/dist/entries/markdown.js.map +1 -0
  300. package/dist/entries/react.d.ts +5 -0
  301. package/dist/entries/react.d.ts.map +1 -0
  302. package/dist/entries/react.js +11 -0
  303. package/dist/entries/react.js.map +1 -0
  304. package/dist/entries/slack.d.ts +2 -0
  305. package/dist/entries/slack.d.ts.map +1 -0
  306. package/dist/entries/slack.js +8 -0
  307. package/dist/entries/slack.js.map +1 -0
  308. package/dist/entries/text.d.ts +2 -0
  309. package/dist/entries/text.d.ts.map +1 -0
  310. package/dist/entries/text.js +8 -0
  311. package/dist/entries/text.js.map +1 -0
  312. package/dist/pack/capabilities.d.ts +41 -0
  313. package/dist/pack/capabilities.d.ts.map +1 -0
  314. package/dist/pack/capabilities.js +36 -0
  315. package/dist/pack/capabilities.js.map +1 -0
  316. package/dist/pack/compose.d.ts +24 -0
  317. package/dist/pack/compose.d.ts.map +1 -0
  318. package/dist/pack/compose.js +55 -0
  319. package/dist/pack/compose.js.map +1 -0
  320. package/dist/pack/enhancements.d.ts +65 -0
  321. package/dist/pack/enhancements.d.ts.map +1 -0
  322. package/dist/pack/enhancements.js +59 -0
  323. package/dist/pack/enhancements.js.map +1 -0
  324. package/dist/pack/index.d.ts +5 -0
  325. package/dist/pack/index.d.ts.map +1 -0
  326. package/dist/pack/index.js +11 -0
  327. package/dist/pack/index.js.map +1 -0
  328. package/dist/pack/primitive_pack.d.ts +164 -0
  329. package/dist/pack/primitive_pack.d.ts.map +1 -0
  330. package/dist/pack/primitive_pack.js +92 -0
  331. package/dist/pack/primitive_pack.js.map +1 -0
  332. package/dist/render/anchors.d.ts +82 -0
  333. package/dist/render/anchors.d.ts.map +1 -0
  334. package/dist/render/anchors.js +153 -0
  335. package/dist/render/anchors.js.map +1 -0
  336. package/dist/render/context_view.d.ts +10 -0
  337. package/dist/render/context_view.d.ts.map +1 -0
  338. package/dist/render/context_view.js +49 -0
  339. package/dist/render/context_view.js.map +1 -0
  340. package/dist/render/format_display_value.d.ts +20 -0
  341. package/dist/render/format_display_value.d.ts.map +1 -0
  342. package/dist/render/format_display_value.js +137 -0
  343. package/dist/render/format_display_value.js.map +1 -0
  344. package/dist/render/format_number.d.ts +9 -0
  345. package/dist/render/format_number.d.ts.map +1 -0
  346. package/dist/render/format_number.js +42 -0
  347. package/dist/render/format_number.js.map +1 -0
  348. package/dist/render/html/enhancements.d.ts +10 -0
  349. package/dist/render/html/enhancements.d.ts.map +1 -0
  350. package/dist/render/html/enhancements.js +25 -0
  351. package/dist/render/html/enhancements.js.map +1 -0
  352. package/dist/render/html/envelope.d.ts +182 -0
  353. package/dist/render/html/envelope.d.ts.map +1 -0
  354. package/dist/render/html/envelope.js +214 -0
  355. package/dist/render/html/envelope.js.map +1 -0
  356. package/dist/render/html/index.d.ts +3 -0
  357. package/dist/render/html/index.d.ts.map +1 -0
  358. package/dist/render/html/index.js +8 -0
  359. package/dist/render/html/index.js.map +1 -0
  360. package/dist/render/index.d.ts +6 -0
  361. package/dist/render/index.d.ts.map +1 -0
  362. package/dist/render/index.js +11 -0
  363. package/dist/render/index.js.map +1 -0
  364. package/dist/render/layout_check.d.ts +43 -0
  365. package/dist/render/layout_check.d.ts.map +1 -0
  366. package/dist/render/layout_check.js +129 -0
  367. package/dist/render/layout_check.js.map +1 -0
  368. package/dist/render/markdown/builder.d.ts +46 -0
  369. package/dist/render/markdown/builder.d.ts.map +1 -0
  370. package/dist/render/markdown/builder.js +190 -0
  371. package/dist/render/markdown/builder.js.map +1 -0
  372. package/dist/render/markdown/envelope.d.ts +20 -0
  373. package/dist/render/markdown/envelope.d.ts.map +1 -0
  374. package/dist/render/markdown/envelope.js +29 -0
  375. package/dist/render/markdown/envelope.js.map +1 -0
  376. package/dist/render/markdown/format.d.ts +10 -0
  377. package/dist/render/markdown/format.d.ts.map +1 -0
  378. package/dist/render/markdown/format.js +202 -0
  379. package/dist/render/markdown/format.js.map +1 -0
  380. package/dist/render/markdown/index.d.ts +3 -0
  381. package/dist/render/markdown/index.d.ts.map +1 -0
  382. package/dist/render/markdown/index.js +9 -0
  383. package/dist/render/markdown/index.js.map +1 -0
  384. package/dist/render/measure_dom.d.ts +10 -0
  385. package/dist/render/measure_dom.d.ts.map +1 -0
  386. package/dist/render/measure_dom.js +57 -0
  387. package/dist/render/measure_dom.js.map +1 -0
  388. package/dist/render/payload.d.ts +16 -0
  389. package/dist/render/payload.d.ts.map +1 -0
  390. package/dist/render/payload.js +9 -0
  391. package/dist/render/payload.js.map +1 -0
  392. package/dist/render/primitive_dispatch.d.ts +72 -0
  393. package/dist/render/primitive_dispatch.d.ts.map +1 -0
  394. package/dist/render/primitive_dispatch.js +169 -0
  395. package/dist/render/primitive_dispatch.js.map +1 -0
  396. package/dist/render/react/content.d.ts +40 -0
  397. package/dist/render/react/content.d.ts.map +1 -0
  398. package/dist/render/react/content.js +39 -0
  399. package/dist/render/react/content.js.map +1 -0
  400. package/dist/render/react/enhancements.d.ts +15 -0
  401. package/dist/render/react/enhancements.d.ts.map +1 -0
  402. package/dist/render/react/enhancements.js +28 -0
  403. package/dist/render/react/enhancements.js.map +1 -0
  404. package/dist/render/react/index.d.ts +3 -0
  405. package/dist/render/react/index.d.ts.map +1 -0
  406. package/dist/render/react/index.js +9 -0
  407. package/dist/render/react/index.js.map +1 -0
  408. package/dist/render/slack/assets.d.ts +16 -0
  409. package/dist/render/slack/assets.d.ts.map +1 -0
  410. package/dist/render/slack/assets.js +40 -0
  411. package/dist/render/slack/assets.js.map +1 -0
  412. package/dist/render/slack/blocks.d.ts +72 -0
  413. package/dist/render/slack/blocks.d.ts.map +1 -0
  414. package/dist/render/slack/blocks.js +77 -0
  415. package/dist/render/slack/blocks.js.map +1 -0
  416. package/dist/render/slack/envelope.d.ts +52 -0
  417. package/dist/render/slack/envelope.d.ts.map +1 -0
  418. package/dist/render/slack/envelope.js +547 -0
  419. package/dist/render/slack/envelope.js.map +1 -0
  420. package/dist/render/slack/format.d.ts +70 -0
  421. package/dist/render/slack/format.d.ts.map +1 -0
  422. package/dist/render/slack/format.js +209 -0
  423. package/dist/render/slack/format.js.map +1 -0
  424. package/dist/render/slack/index.d.ts +6 -0
  425. package/dist/render/slack/index.d.ts.map +1 -0
  426. package/dist/render/slack/index.js +12 -0
  427. package/dist/render/slack/index.js.map +1 -0
  428. package/dist/render/slack/markdown_content.d.ts +17 -0
  429. package/dist/render/slack/markdown_content.d.ts.map +1 -0
  430. package/dist/render/slack/markdown_content.js +404 -0
  431. package/dist/render/slack/markdown_content.js.map +1 -0
  432. package/dist/render/text/envelope.d.ts +15 -0
  433. package/dist/render/text/envelope.d.ts.map +1 -0
  434. package/dist/render/text/envelope.js +17 -0
  435. package/dist/render/text/envelope.js.map +1 -0
  436. package/dist/render/text/index.d.ts +2 -0
  437. package/dist/render/text/index.d.ts.map +1 -0
  438. package/dist/render/text/index.js +8 -0
  439. package/dist/render/text/index.js.map +1 -0
  440. package/dist/testing/conformance.d.ts +145 -0
  441. package/dist/testing/conformance.d.ts.map +1 -0
  442. package/dist/testing/conformance.js +303 -0
  443. package/dist/testing/conformance.js.map +1 -0
  444. package/dist/testing/icon.d.ts +11 -0
  445. package/dist/testing/icon.d.ts.map +1 -0
  446. package/dist/testing/icon.js +244 -0
  447. package/dist/testing/icon.js.map +1 -0
  448. package/dist/testing/index.d.ts +4 -0
  449. package/dist/testing/index.d.ts.map +1 -0
  450. package/dist/testing/index.js +10 -0
  451. package/dist/testing/index.js.map +1 -0
  452. package/dist/testing/registration.d.ts +32 -0
  453. package/dist/testing/registration.d.ts.map +1 -0
  454. package/dist/testing/registration.js +105 -0
  455. package/dist/testing/registration.js.map +1 -0
  456. package/dist/validate/authoring_schema.d.ts +33 -0
  457. package/dist/validate/authoring_schema.d.ts.map +1 -0
  458. package/dist/validate/authoring_schema.js +306 -0
  459. package/dist/validate/authoring_schema.js.map +1 -0
  460. package/dist/validate/composition_schema.d.ts +80 -0
  461. package/dist/validate/composition_schema.d.ts.map +1 -0
  462. package/dist/validate/composition_schema.js +127 -0
  463. package/dist/validate/composition_schema.js.map +1 -0
  464. package/dist/validate/index.d.ts +9 -0
  465. package/dist/validate/index.d.ts.map +1 -0
  466. package/dist/validate/index.js +15 -0
  467. package/dist/validate/index.js.map +1 -0
  468. package/dist/validate/input_budget.d.ts +35 -0
  469. package/dist/validate/input_budget.d.ts.map +1 -0
  470. package/dist/validate/input_budget.js +151 -0
  471. package/dist/validate/input_budget.js.map +1 -0
  472. package/dist/validate/json_schema.d.ts +32 -0
  473. package/dist/validate/json_schema.d.ts.map +1 -0
  474. package/dist/validate/json_schema.js +68 -0
  475. package/dist/validate/json_schema.js.map +1 -0
  476. package/dist/validate/node_issues.d.ts +12 -0
  477. package/dist/validate/node_issues.d.ts.map +1 -0
  478. package/dist/validate/node_issues.js +61 -0
  479. package/dist/validate/node_issues.js.map +1 -0
  480. package/dist/validate/url.d.ts +50 -0
  481. package/dist/validate/url.d.ts.map +1 -0
  482. package/dist/validate/url.js +107 -0
  483. package/dist/validate/url.js.map +1 -0
  484. package/dist/validate/validation.d.ts +95 -0
  485. package/dist/validate/validation.d.ts.map +1 -0
  486. package/dist/validate/validation.js +157 -0
  487. package/dist/validate/validation.js.map +1 -0
  488. package/dist/validate/value_schemas.d.ts +53 -0
  489. package/dist/validate/value_schemas.d.ts.map +1 -0
  490. package/dist/validate/value_schemas.js +50 -0
  491. package/dist/validate/value_schemas.js.map +1 -0
  492. package/package.json +119 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body_node_base.js","sourceRoot":"","sources":["../../src/composition/body_node_base.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n/**\n * Every surface a node renders on or is hidden from, in render order.\n *\n * `html` is not here: the runtime's `html` surface wraps `react` output in a\n * document, and no node targets it.\n */\nexport const SURFACE_NAMES = [\n 'react',\n 'snapshot',\n 'text',\n 'markdown',\n 'slack',\n] as const;\n\n/** One of the {@link SURFACE_NAMES}. */\nexport type SurfaceName = (typeof SURFACE_NAMES)[number];\n\n/** @deprecated Use {@link SURFACE_NAMES}. */\nexport const BODY_NODE_SURFACES: readonly SurfaceName[] = SURFACE_NAMES;\n\n/** The two fields every primitive node carries, whatever its pack. */\nexport interface BodyNodeBase {\n /** Unique within a composition, which `validate` enforces and `parse` does not. */\n id?: string;\n /** Surfaces this node appears on. Absent means every surface. */\n surfaces?: SurfaceName[];\n}\n\n/**\n * A child node together with the field path locating it inside its parent, so\n * an error path can name the field a child actually lives under. A container\n * that returned bare nodes would leave every caller guessing the field name.\n */\nexport interface ChildNodeRef {\n /** Erased: one walker spans every pack's node types, so it can name none of them. */\n node: unknown;\n /** Relative to the parent, e.g. `items[0].node`, `items[2].description`. */\n path: string;\n}\n\n/**\n * Walks nested nodes and, for a hybrid container, reports whether the parent\n * still produces output of its own. A non-empty `children` result is the\n * complete source of rendered content unless\n * {@link ChildNodeWalker.hasOwnContent} is true for that node.\n */\nexport type ChildNodeWalker = ((node: unknown) => ChildNodeRef[]) & {\n hasOwnContent?(node: unknown): boolean;\n};\n\n/**\n * Builds the {@link ChildNodeWalker} for one composition's inventory.\n *\n * Pass every pack's definitions: a walker missing one cannot see children of a\n * container that pack defines, and a tree walk would stop at its boundary.\n */\nexport const createChildNodeWalker = (\n definitions: readonly {\n type: string;\n children?: unknown;\n hasOwnContent?: unknown;\n }[]\n): ChildNodeWalker => {\n const childrenByType = new Map<\n string,\n (node: unknown) => readonly ChildNodeRef[]\n >();\n const ownContentByType = new Map<string, (node: unknown) => boolean>();\n for (const definition of definitions) {\n if (typeof definition.children === 'function') {\n childrenByType.set(\n definition.type,\n definition.children as (node: unknown) => readonly ChildNodeRef[]\n );\n }\n if (typeof definition.hasOwnContent === 'function') {\n ownContentByType.set(\n definition.type,\n definition.hasOwnContent as (node: unknown) => boolean\n );\n }\n }\n const walk = ((node: unknown) => {\n if (!node || typeof node !== 'object') {\n return [];\n }\n const { type } = node as { type?: unknown };\n if (typeof type !== 'string') {\n return [];\n }\n return [...(childrenByType.get(type)?.(node) ?? [])];\n }) as ChildNodeWalker;\n walk.hasOwnContent = (node) => {\n if (!node || typeof node !== 'object') {\n return false;\n }\n const { type } = node as { type?: unknown };\n if (typeof type !== 'string') {\n return false;\n }\n return ownContentByType.get(type)?.(node) ?? false;\n };\n return walk;\n};\n\n/** Joins a parent path with a {@link ChildNodeRef.path} fragment. */\nexport const childNodePath = (parent: string, child: string): string =>\n `${parent}.${child}`;\n\n/**\n * Whether any node visible on `surface` matches, descending through container\n * children via `walk`. A node (or a container ancestor) hidden from `surface`\n * is skipped along with its children.\n *\n * `walk` must span every pack in the composition: a walker built from one\n * pack's definitions cannot see children of a container defined in another.\n */\nexport const someBodyNode = (\n nodes: readonly unknown[],\n surface: SurfaceName,\n predicate: (node: unknown) => boolean,\n walk: ChildNodeWalker\n): boolean =>\n nodes.some((node) => {\n if (!isVisibleOnSurface(node, surface)) {\n return false;\n }\n return (\n predicate(node) ||\n someBodyNode(\n walk(node).map((child) => child.node),\n surface,\n predicate,\n walk\n )\n );\n });\n\n/** Whether `node`'s own `surfaces` hint admits `surface`, ignoring its children. */\nexport const isVisibleOnSurface = (\n node: unknown,\n surface: SurfaceName\n): boolean => {\n if (!node || typeof node !== 'object') {\n return false;\n }\n const { surfaces } = node as { surfaces?: unknown };\n return !Array.isArray(surfaces) || surfaces.includes(surface);\n};\n\n/**\n * Whether `node` puts anything on `surface` — itself or through a descendant.\n *\n * Stronger than {@link isVisibleOnSurface}: a container every one of whose\n * children is hidden renders nothing, even though its own hint allows the\n * surface. A hybrid container that also owns string fields declares\n * {@link ChildNodeWalker.hasOwnContent} and keeps rendering regardless.\n */\nexport const rendersOnSurface = (\n node: unknown,\n surface: SurfaceName,\n walk: ChildNodeWalker\n): boolean => {\n if (!isVisibleOnSurface(node, surface)) {\n return false;\n }\n const children = walk(node);\n if (children.length === 0 || walk.hasOwnContent?.(node)) {\n return true;\n }\n return children.some(({ node: child }) =>\n rendersOnSurface(child, surface, walk)\n );\n};\n"]}
@@ -0,0 +1,71 @@
1
+ import type { RenderTheme } from './named_color.js';
2
+ import type { PrimitiveNode } from './node.js';
3
+ /**
4
+ * The wire format: one typed document that every surface renders from.
5
+ *
6
+ * Crosses process and vendor boundaries, so the JSON shape is the contract and
7
+ * the TypeScript name is not: {@link Composition.type} reads `view`, the
8
+ * discriminator an agent is prompted on.
9
+ */
10
+ export interface Composition<TNode extends PrimitiveNode = PrimitiveNode> {
11
+ /** Root marker. Always `view`; see the note on {@link Composition}. */
12
+ type: 'view';
13
+ /**
14
+ * Wire-format version. A literal rather than `number` so an unknown future
15
+ * version cannot parse as valid, and optional with no default because absent
16
+ * already means v1 — writing one in would rewrite stored documents.
17
+ */
18
+ version?: 1;
19
+ title?: string;
20
+ subtitle?: string;
21
+ /** Light/dark preference, not a resolved value; `auto` resolves light. */
22
+ theme?: RenderTheme;
23
+ /** At least one node, which the schema enforces via `.min(1)`. */
24
+ body: TNode[];
25
+ meta?: CompositionMeta;
26
+ }
27
+ /**
28
+ * Context a host may surface beside the render.
29
+ *
30
+ * Advisory and pass-through throughout: nothing here changes what the body
31
+ * renders to, and the SDK reads none of it. Timestamps are plain strings by
32
+ * convention ISO 8601, which the schema does not enforce — a host that parses
33
+ * one should tolerate anything.
34
+ */
35
+ export interface CompositionMeta {
36
+ /** Origin of the composition itself, e.g. the agent or feature that composed it. */
37
+ source?: string;
38
+ /** When the composition was produced. */
39
+ generatedAt?: string;
40
+ /** Overrides the accessible name a surface derives from `title`. */
41
+ ariaLabel?: string;
42
+ /** Where the underlying data came from, as opposed to who composed it. */
43
+ provenance?: {
44
+ /** Data origin, e.g. an index or dataset name. */
45
+ source?: string;
46
+ /** The query that produced the data, for a host that offers "show me how". */
47
+ query?: string;
48
+ /** Service or connector that answered the query. */
49
+ provider?: string;
50
+ };
51
+ /** How current the data is, for a host that shows an as-of or staleness badge. */
52
+ freshness?: {
53
+ /** When the data was current, which may precede `generatedAt`. */
54
+ asOf?: string;
55
+ /** Asserted by the producer rather than derived, so a host should prefer it to comparing `asOf`. */
56
+ stale?: boolean;
57
+ /** How long `asOf` stays current. Not range-checked. */
58
+ ttlSeconds?: number;
59
+ };
60
+ /**
61
+ * Set when the composition rendered anyway despite losing some data, so a
62
+ * host can mark it incomplete rather than presenting it as whole.
63
+ */
64
+ partialFailure?: {
65
+ /** True when some of the data behind the composition was lost before it rendered. */
66
+ degraded?: boolean;
67
+ /** Human-readable cause, safe to show a user. */
68
+ reason?: string;
69
+ };
70
+ }
71
+ //# sourceMappingURL=composition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../src/composition/composition.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,aAAa,GAAG,aAAa;IACtE,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,kEAAkE;IAClE,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,UAAU,CAAC,EAAE;QACX,kDAAkD;QAClD,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,8EAA8E;QAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,oDAAoD;QACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,kFAAkF;IAClF,SAAS,CAAC,EAAE;QACV,kEAAkE;QAClE,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,oGAAoG;QACpG,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,wDAAwD;QACxD,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF;;;OAGG;IACH,cAAc,CAAC,EAAE;QACf,qFAAqF;QACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,iDAAiD;QACjD,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH"}
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.js","sourceRoot":"","sources":["../../src/composition/composition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nimport type { RenderTheme } from './named_color';\nimport type { PrimitiveNode } from './node';\n\n/**\n * The wire format: one typed document that every surface renders from.\n *\n * Crosses process and vendor boundaries, so the JSON shape is the contract and\n * the TypeScript name is not: {@link Composition.type} reads `view`, the\n * discriminator an agent is prompted on.\n */\nexport interface Composition<TNode extends PrimitiveNode = PrimitiveNode> {\n /** Root marker. Always `view`; see the note on {@link Composition}. */\n type: 'view';\n /**\n * Wire-format version. A literal rather than `number` so an unknown future\n * version cannot parse as valid, and optional with no default because absent\n * already means v1 — writing one in would rewrite stored documents.\n */\n version?: 1;\n title?: string;\n subtitle?: string;\n /** Light/dark preference, not a resolved value; `auto` resolves light. */\n theme?: RenderTheme;\n /** At least one node, which the schema enforces via `.min(1)`. */\n body: TNode[];\n meta?: CompositionMeta;\n}\n\n/**\n * Context a host may surface beside the render.\n *\n * Advisory and pass-through throughout: nothing here changes what the body\n * renders to, and the SDK reads none of it. Timestamps are plain strings by\n * convention ISO 8601, which the schema does not enforce — a host that parses\n * one should tolerate anything.\n */\nexport interface CompositionMeta {\n /** Origin of the composition itself, e.g. the agent or feature that composed it. */\n source?: string;\n /** When the composition was produced. */\n generatedAt?: string;\n /** Overrides the accessible name a surface derives from `title`. */\n ariaLabel?: string;\n /** Where the underlying data came from, as opposed to who composed it. */\n provenance?: {\n /** Data origin, e.g. an index or dataset name. */\n source?: string;\n /** The query that produced the data, for a host that offers \"show me how\". */\n query?: string;\n /** Service or connector that answered the query. */\n provider?: string;\n };\n /** How current the data is, for a host that shows an as-of or staleness badge. */\n freshness?: {\n /** When the data was current, which may precede `generatedAt`. */\n asOf?: string;\n /** Asserted by the producer rather than derived, so a host should prefer it to comparing `asOf`. */\n stale?: boolean;\n /** How long `asOf` stays current. Not range-checked. */\n ttlSeconds?: number;\n };\n /**\n * Set when the composition rendered anyway despite losing some data, so a\n * host can mark it incomplete rather than presenting it as whole.\n */\n partialFailure?: {\n /** True when some of the data behind the composition was lost before it rendered. */\n degraded?: boolean;\n /** Human-readable cause, safe to show a user. */\n reason?: string;\n };\n}\n"]}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Stable codes for {@link IsomerError}, {@link CompositionValidationError},
3
+ * and the runtime's `RegisteredViewInputError`. Hosts branch on `code`, not
4
+ * on `message`. Codes name the condition, not the throwing module: duplicate
5
+ * type at `definePrimitivePack`, `composePacks`, and `createIsomerRuntime` is the same
6
+ * `DUPLICATE_PRIMITIVE_TYPE`; the message names the layer.
7
+ */
8
+ export declare const ISOMER_ERROR_CODES: {
9
+ readonly AMBIGUOUS_FRAME: "AMBIGUOUS_FRAME";
10
+ readonly AMBIGUOUS_STYLE_ADAPTER: "AMBIGUOUS_STYLE_ADAPTER";
11
+ readonly AUTHOR_TYPE_MISMATCH: "AUTHOR_TYPE_MISMATCH";
12
+ readonly AUTHORED_SCHEMA_REUSED: "AUTHORED_SCHEMA_REUSED";
13
+ readonly COMPOSITION_INVALID: "COMPOSITION_INVALID";
14
+ readonly CYCLIC_COMPOSITION: "CYCLIC_COMPOSITION";
15
+ readonly DUPLICATE_AUTHORED_CHILD: "DUPLICATE_AUTHORED_CHILD";
16
+ readonly DUPLICATE_ENHANCEMENT: "DUPLICATE_ENHANCEMENT";
17
+ readonly DUPLICATE_FORMAT: "DUPLICATE_FORMAT";
18
+ readonly DUPLICATE_PACK_ID: "DUPLICATE_PACK_ID";
19
+ readonly DUPLICATE_PRIMITIVE_TYPE: "DUPLICATE_PRIMITIVE_TYPE";
20
+ readonly DUPLICATE_VIEW: "DUPLICATE_VIEW";
21
+ readonly EMPTY_FRAMES: "EMPTY_FRAMES";
22
+ readonly EMPTY_PACK: "EMPTY_PACK";
23
+ readonly EMPTY_PACKS: "EMPTY_PACKS";
24
+ readonly EMPTY_PAGES: "EMPTY_PAGES";
25
+ readonly EMPTY_VOCABULARY: "EMPTY_VOCABULARY";
26
+ readonly ENHANCEMENT_ROOT_MISSING: "ENHANCEMENT_ROOT_MISSING";
27
+ readonly EXPECTED_AUTHOR_COMPONENT: "EXPECTED_AUTHOR_COMPONENT";
28
+ readonly EXPECTED_JSX_ELEMENT: "EXPECTED_JSX_ELEMENT";
29
+ readonly EXPECTED_TEXT_CHILDREN: "EXPECTED_TEXT_CHILDREN";
30
+ readonly INCOMPATIBLE_STYLE_COLLECTOR: "INCOMPATIBLE_STYLE_COLLECTOR";
31
+ readonly INPUT_NOT_PLAIN_DATA: "INPUT_NOT_PLAIN_DATA";
32
+ readonly INPUT_OVER_BUDGET: "INPUT_OVER_BUDGET";
33
+ readonly INVALID_BODY_NODE: "INVALID_BODY_NODE";
34
+ readonly INVALID_FRAME_BODY: "INVALID_FRAME_BODY";
35
+ readonly MISSING_AUTHORED_TEXT: "MISSING_AUTHORED_TEXT";
36
+ readonly MISSING_STYLE_ADAPTER: "MISSING_STYLE_ADAPTER";
37
+ readonly RESERVED_NODE_FIELD: "RESERVED_NODE_FIELD";
38
+ readonly UNEXPECTED_CHILDREN: "UNEXPECTED_CHILDREN";
39
+ readonly UNKNOWN_FRAME: "UNKNOWN_FRAME";
40
+ readonly UNKNOWN_PRIMITIVE_TYPE: "UNKNOWN_PRIMITIVE_TYPE";
41
+ readonly UNKNOWN_SURFACE: "UNKNOWN_SURFACE";
42
+ readonly UNKNOWN_VIEW: "UNKNOWN_VIEW";
43
+ readonly UNSUPPORTED_CHILD_PATH: "UNSUPPORTED_CHILD_PATH";
44
+ readonly VIEW_INPUT_INVALID: "VIEW_INPUT_INVALID";
45
+ readonly VOCABULARY_UNRESOLVED: "VOCABULARY_UNRESOLVED";
46
+ };
47
+ /** One of {@link ISOMER_ERROR_CODES}. */
48
+ export type IsomerErrorCode = (typeof ISOMER_ERROR_CODES)[keyof typeof ISOMER_ERROR_CODES];
49
+ /**
50
+ * Thrown for construction and authoring failures that are not a
51
+ * `CompositionValidationError`.
52
+ *
53
+ * Identify it by `name` and `code`, never `instanceof`: the SDK ships both
54
+ * ESM and CJS builds, so a host can hold two copies of this class and an
55
+ * identity check would miss one.
56
+ */
57
+ export declare class IsomerError extends Error {
58
+ readonly code: IsomerErrorCode;
59
+ constructor(code: IsomerErrorCode, message: string);
60
+ }
61
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/composition/error.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCrB,CAAC;AAEX,yCAAyC;AACzC,MAAM,MAAM,eAAe,GACzB,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D;;;;;;;GAOG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;gBAEnB,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;CAKnD"}
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ /**
8
+ * Stable codes for {@link IsomerError}, {@link CompositionValidationError},
9
+ * and the runtime's `RegisteredViewInputError`. Hosts branch on `code`, not
10
+ * on `message`. Codes name the condition, not the throwing module: duplicate
11
+ * type at `definePrimitivePack`, `composePacks`, and `createIsomerRuntime` is the same
12
+ * `DUPLICATE_PRIMITIVE_TYPE`; the message names the layer.
13
+ */
14
+ export const ISOMER_ERROR_CODES = {
15
+ AMBIGUOUS_FRAME: 'AMBIGUOUS_FRAME',
16
+ AMBIGUOUS_STYLE_ADAPTER: 'AMBIGUOUS_STYLE_ADAPTER',
17
+ AUTHOR_TYPE_MISMATCH: 'AUTHOR_TYPE_MISMATCH',
18
+ AUTHORED_SCHEMA_REUSED: 'AUTHORED_SCHEMA_REUSED',
19
+ COMPOSITION_INVALID: 'COMPOSITION_INVALID',
20
+ CYCLIC_COMPOSITION: 'CYCLIC_COMPOSITION',
21
+ DUPLICATE_AUTHORED_CHILD: 'DUPLICATE_AUTHORED_CHILD',
22
+ DUPLICATE_ENHANCEMENT: 'DUPLICATE_ENHANCEMENT',
23
+ DUPLICATE_FORMAT: 'DUPLICATE_FORMAT',
24
+ DUPLICATE_PACK_ID: 'DUPLICATE_PACK_ID',
25
+ DUPLICATE_PRIMITIVE_TYPE: 'DUPLICATE_PRIMITIVE_TYPE',
26
+ DUPLICATE_VIEW: 'DUPLICATE_VIEW',
27
+ EMPTY_FRAMES: 'EMPTY_FRAMES',
28
+ EMPTY_PACK: 'EMPTY_PACK',
29
+ EMPTY_PACKS: 'EMPTY_PACKS',
30
+ EMPTY_PAGES: 'EMPTY_PAGES',
31
+ EMPTY_VOCABULARY: 'EMPTY_VOCABULARY',
32
+ ENHANCEMENT_ROOT_MISSING: 'ENHANCEMENT_ROOT_MISSING',
33
+ EXPECTED_AUTHOR_COMPONENT: 'EXPECTED_AUTHOR_COMPONENT',
34
+ EXPECTED_JSX_ELEMENT: 'EXPECTED_JSX_ELEMENT',
35
+ EXPECTED_TEXT_CHILDREN: 'EXPECTED_TEXT_CHILDREN',
36
+ INCOMPATIBLE_STYLE_COLLECTOR: 'INCOMPATIBLE_STYLE_COLLECTOR',
37
+ INPUT_NOT_PLAIN_DATA: 'INPUT_NOT_PLAIN_DATA',
38
+ INPUT_OVER_BUDGET: 'INPUT_OVER_BUDGET',
39
+ INVALID_BODY_NODE: 'INVALID_BODY_NODE',
40
+ INVALID_FRAME_BODY: 'INVALID_FRAME_BODY',
41
+ MISSING_AUTHORED_TEXT: 'MISSING_AUTHORED_TEXT',
42
+ MISSING_STYLE_ADAPTER: 'MISSING_STYLE_ADAPTER',
43
+ RESERVED_NODE_FIELD: 'RESERVED_NODE_FIELD',
44
+ UNEXPECTED_CHILDREN: 'UNEXPECTED_CHILDREN',
45
+ UNKNOWN_FRAME: 'UNKNOWN_FRAME',
46
+ UNKNOWN_PRIMITIVE_TYPE: 'UNKNOWN_PRIMITIVE_TYPE',
47
+ UNKNOWN_SURFACE: 'UNKNOWN_SURFACE',
48
+ UNKNOWN_VIEW: 'UNKNOWN_VIEW',
49
+ UNSUPPORTED_CHILD_PATH: 'UNSUPPORTED_CHILD_PATH',
50
+ VIEW_INPUT_INVALID: 'VIEW_INPUT_INVALID',
51
+ VOCABULARY_UNRESOLVED: 'VOCABULARY_UNRESOLVED',
52
+ };
53
+ /**
54
+ * Thrown for construction and authoring failures that are not a
55
+ * `CompositionValidationError`.
56
+ *
57
+ * Identify it by `name` and `code`, never `instanceof`: the SDK ships both
58
+ * ESM and CJS builds, so a host can hold two copies of this class and an
59
+ * identity check would miss one.
60
+ */
61
+ export class IsomerError extends Error {
62
+ code;
63
+ constructor(code, message) {
64
+ super(message);
65
+ this.name = 'IsomerError';
66
+ this.code = code;
67
+ }
68
+ }
69
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/composition/error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,eAAe,EAAE,iBAAiB;IAClC,uBAAuB,EAAE,yBAAyB;IAClD,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,mBAAmB,EAAE,qBAAqB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,wBAAwB,EAAE,0BAA0B;IACpD,qBAAqB,EAAE,uBAAuB;IAC9C,gBAAgB,EAAE,kBAAkB;IACpC,iBAAiB,EAAE,mBAAmB;IACtC,wBAAwB,EAAE,0BAA0B;IACpD,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,gBAAgB,EAAE,kBAAkB;IACpC,wBAAwB,EAAE,0BAA0B;IACpD,yBAAyB,EAAE,2BAA2B;IACtD,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,4BAA4B,EAAE,8BAA8B;IAC5D,oBAAoB,EAAE,sBAAsB;IAC5C,iBAAiB,EAAE,mBAAmB;IACtC,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,qBAAqB,EAAE,uBAAuB;IAC9C,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,aAAa,EAAE,eAAe;IAC9B,sBAAsB,EAAE,wBAAwB;IAChD,eAAe,EAAE,iBAAiB;IAClC,YAAY,EAAE,cAAc;IAC5B,sBAAsB,EAAE,wBAAwB;IAChD,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,uBAAuB;CACtC,CAAC;AAMX;;;;;;;GAOG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAkB;IAE/B,YAAY,IAAqB,EAAE,OAAe;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n/**\n * Stable codes for {@link IsomerError}, {@link CompositionValidationError},\n * and the runtime's `RegisteredViewInputError`. Hosts branch on `code`, not\n * on `message`. Codes name the condition, not the throwing module: duplicate\n * type at `definePrimitivePack`, `composePacks`, and `createIsomerRuntime` is the same\n * `DUPLICATE_PRIMITIVE_TYPE`; the message names the layer.\n */\nexport const ISOMER_ERROR_CODES = {\n AMBIGUOUS_FRAME: 'AMBIGUOUS_FRAME',\n AMBIGUOUS_STYLE_ADAPTER: 'AMBIGUOUS_STYLE_ADAPTER',\n AUTHOR_TYPE_MISMATCH: 'AUTHOR_TYPE_MISMATCH',\n AUTHORED_SCHEMA_REUSED: 'AUTHORED_SCHEMA_REUSED',\n COMPOSITION_INVALID: 'COMPOSITION_INVALID',\n CYCLIC_COMPOSITION: 'CYCLIC_COMPOSITION',\n DUPLICATE_AUTHORED_CHILD: 'DUPLICATE_AUTHORED_CHILD',\n DUPLICATE_ENHANCEMENT: 'DUPLICATE_ENHANCEMENT',\n DUPLICATE_FORMAT: 'DUPLICATE_FORMAT',\n DUPLICATE_PACK_ID: 'DUPLICATE_PACK_ID',\n DUPLICATE_PRIMITIVE_TYPE: 'DUPLICATE_PRIMITIVE_TYPE',\n DUPLICATE_VIEW: 'DUPLICATE_VIEW',\n EMPTY_FRAMES: 'EMPTY_FRAMES',\n EMPTY_PACK: 'EMPTY_PACK',\n EMPTY_PACKS: 'EMPTY_PACKS',\n EMPTY_PAGES: 'EMPTY_PAGES',\n EMPTY_VOCABULARY: 'EMPTY_VOCABULARY',\n ENHANCEMENT_ROOT_MISSING: 'ENHANCEMENT_ROOT_MISSING',\n EXPECTED_AUTHOR_COMPONENT: 'EXPECTED_AUTHOR_COMPONENT',\n EXPECTED_JSX_ELEMENT: 'EXPECTED_JSX_ELEMENT',\n EXPECTED_TEXT_CHILDREN: 'EXPECTED_TEXT_CHILDREN',\n INCOMPATIBLE_STYLE_COLLECTOR: 'INCOMPATIBLE_STYLE_COLLECTOR',\n INPUT_NOT_PLAIN_DATA: 'INPUT_NOT_PLAIN_DATA',\n INPUT_OVER_BUDGET: 'INPUT_OVER_BUDGET',\n INVALID_BODY_NODE: 'INVALID_BODY_NODE',\n INVALID_FRAME_BODY: 'INVALID_FRAME_BODY',\n MISSING_AUTHORED_TEXT: 'MISSING_AUTHORED_TEXT',\n MISSING_STYLE_ADAPTER: 'MISSING_STYLE_ADAPTER',\n RESERVED_NODE_FIELD: 'RESERVED_NODE_FIELD',\n UNEXPECTED_CHILDREN: 'UNEXPECTED_CHILDREN',\n UNKNOWN_FRAME: 'UNKNOWN_FRAME',\n UNKNOWN_PRIMITIVE_TYPE: 'UNKNOWN_PRIMITIVE_TYPE',\n UNKNOWN_SURFACE: 'UNKNOWN_SURFACE',\n UNKNOWN_VIEW: 'UNKNOWN_VIEW',\n UNSUPPORTED_CHILD_PATH: 'UNSUPPORTED_CHILD_PATH',\n VIEW_INPUT_INVALID: 'VIEW_INPUT_INVALID',\n VOCABULARY_UNRESOLVED: 'VOCABULARY_UNRESOLVED',\n} as const;\n\n/** One of {@link ISOMER_ERROR_CODES}. */\nexport type IsomerErrorCode =\n (typeof ISOMER_ERROR_CODES)[keyof typeof ISOMER_ERROR_CODES];\n\n/**\n * Thrown for construction and authoring failures that are not a\n * `CompositionValidationError`.\n *\n * Identify it by `name` and `code`, never `instanceof`: the SDK ships both\n * ESM and CJS builds, so a host can hold two copies of this class and an\n * identity check would miss one.\n */\nexport class IsomerError extends Error {\n readonly code: IsomerErrorCode;\n\n constructor(code: IsomerErrorCode, message: string) {\n super(message);\n this.name = 'IsomerError';\n this.code = code;\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export { type ActionEventRef } from './action_event.js';
2
+ export { type BodyNodeBase, type ChildNodeRef, type ChildNodeWalker, type SurfaceName, BODY_NODE_SURFACES, SURFACE_NAMES, createChildNodeWalker, isVisibleOnSurface, someBodyNode, } from './body_node_base.js';
3
+ export { type Composition, type CompositionMeta } from './composition.js';
4
+ export { type IsomerErrorCode, ISOMER_ERROR_CODES, IsomerError } from './error.js';
5
+ export { mapCompositionNodes } from './map_nodes.js';
6
+ export { type NamedColor, type NamedColorPalette, type RenderTheme, ALL_NAMED_COLORS, } from './named_color.js';
7
+ export { type PrimitiveNode } from './node.js';
8
+ export { nameText, oneLine, quoteText } from './one_line.js';
9
+ export { type DisplayValue, type StructuredValue, type StructuredValueFormat, STRUCTURED_VALUE_FORMATS, } from './structured_value.js';
10
+ export { type ValidationError, CompositionValidationError, formatValidationError, } from './validation_error.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composition/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,KAAK,eAAe,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,eAAe,EACpB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ export { BODY_NODE_SURFACES, SURFACE_NAMES, createChildNodeWalker, isVisibleOnSurface, someBodyNode, } from './body_node_base.js';
8
+ export { ISOMER_ERROR_CODES, IsomerError } from './error.js';
9
+ export { mapCompositionNodes } from './map_nodes.js';
10
+ export { ALL_NAMED_COLORS, } from './named_color.js';
11
+ export { nameText, oneLine, quoteText } from './one_line.js';
12
+ export { STRUCTURED_VALUE_FORMATS, } from './structured_value.js';
13
+ export { CompositionValidationError, formatValidationError, } from './validation_error.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/composition/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAKL,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAwB,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAIL,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAIL,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,oBAAoB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport { type ActionEventRef } from './action_event';\nexport {\n type BodyNodeBase,\n type ChildNodeRef,\n type ChildNodeWalker,\n type SurfaceName,\n BODY_NODE_SURFACES,\n SURFACE_NAMES,\n createChildNodeWalker,\n isVisibleOnSurface,\n someBodyNode,\n} from './body_node_base';\nexport { type Composition, type CompositionMeta } from './composition';\nexport { type IsomerErrorCode, ISOMER_ERROR_CODES, IsomerError } from './error';\nexport { mapCompositionNodes } from './map_nodes';\nexport {\n type NamedColor,\n type NamedColorPalette,\n type RenderTheme,\n ALL_NAMED_COLORS,\n} from './named_color';\nexport { type PrimitiveNode } from './node';\nexport { nameText, oneLine, quoteText } from './one_line';\nexport {\n type DisplayValue,\n type StructuredValue,\n type StructuredValueFormat,\n STRUCTURED_VALUE_FORMATS,\n} from './structured_value';\nexport {\n type ValidationError,\n CompositionValidationError,\n formatValidationError,\n} from './validation_error';\n"]}
@@ -0,0 +1,16 @@
1
+ import type { ChildNodeWalker } from './body_node_base.js';
2
+ import type { Composition } from './composition.js';
3
+ import type { PrimitiveNode } from './node.js';
4
+ /**
5
+ * Rebuilds `composition`'s body with `fn` applied to every node, including
6
+ * the nested children `walk` yields.
7
+ *
8
+ * Post-order: a container reaches `fn` after its children have been mapped,
9
+ * so `fn` sees the finished replacements in place. Build `walk` with
10
+ * {@link createChildNodeWalker} over every pack in the composition.
11
+ * A child path is the dotted `field` / `field[index]` form the SDK documents
12
+ * (`items[0].node`); any other shape throws `UNSUPPORTED_CHILD_PATH`.
13
+ * Walked without recursion, so depth is bounded by memory, not the call stack; a node nested in itself throws `CYCLIC_COMPOSITION`.
14
+ */
15
+ export declare const mapCompositionNodes: <TNode extends PrimitiveNode = PrimitiveNode>(composition: Composition<TNode>, walk: ChildNodeWalker, fn: (node: PrimitiveNode) => PrimitiveNode) => Composition<TNode>;
16
+ //# sourceMappingURL=map_nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map_nodes.d.ts","sourceRoot":"","sources":["../../src/composition/map_nodes.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAiD5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC9B,KAAK,SAAS,aAAa,GAAG,aAAa,EAE3C,aAAa,WAAW,CAAC,KAAK,CAAC,EAC/B,MAAM,eAAe,EACrB,IAAI,CAAC,IAAI,EAAE,aAAa,KAAK,aAAa,KACzC,WAAW,CAAC,KAAK,CA2CnB,CAAC"}
@@ -0,0 +1,81 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ import { IsomerError } from './error.js';
8
+ /** One dotted step of a child path: `field` or `field[index]`. */
9
+ const PATH_STEP = /^([A-Za-z_$][\w$]*)(?:\[(\d+)\])?$/;
10
+ const unsupportedPath = (path) => new IsomerError('UNSUPPORTED_CHILD_PATH', `mapCompositionNodes: cannot rewrite child at path "${path}"; expected dotted "field" or "field[index]" steps`);
11
+ /** `parent` with the value at `steps` replaced, every touched object and array copied. */
12
+ const withValueAt = (parent, steps, value, path) => {
13
+ const [step, ...rest] = steps;
14
+ const match = step === undefined ? null : PATH_STEP.exec(step);
15
+ if (!match || typeof parent !== 'object' || parent === null) {
16
+ throw unsupportedPath(path);
17
+ }
18
+ const field = match[1];
19
+ const record = parent;
20
+ if (match[2] === undefined) {
21
+ const next = rest.length === 0 ? value : withValueAt(record[field], rest, value, path);
22
+ return { ...record, [field]: next };
23
+ }
24
+ const index = Number(match[2]);
25
+ const current = record[field];
26
+ if (!Array.isArray(current)) {
27
+ throw unsupportedPath(path);
28
+ }
29
+ const array = [...current];
30
+ array[index] =
31
+ rest.length === 0 ? value : withValueAt(array[index], rest, value, path);
32
+ return { ...record, [field]: array };
33
+ };
34
+ /**
35
+ * Rebuilds `composition`'s body with `fn` applied to every node, including
36
+ * the nested children `walk` yields.
37
+ *
38
+ * Post-order: a container reaches `fn` after its children have been mapped,
39
+ * so `fn` sees the finished replacements in place. Build `walk` with
40
+ * {@link createChildNodeWalker} over every pack in the composition.
41
+ * A child path is the dotted `field` / `field[index]` form the SDK documents
42
+ * (`items[0].node`); any other shape throws `UNSUPPORTED_CHILD_PATH`.
43
+ * Walked without recursion, so depth is bounded by memory, not the call stack; a node nested in itself throws `CYCLIC_COMPOSITION`.
44
+ */
45
+ export const mapCompositionNodes = (composition, walk, fn) => {
46
+ const mapNode = (root) => {
47
+ const open = new Set();
48
+ const stack = [];
49
+ const enter = (node) => {
50
+ if (open.has(node)) {
51
+ throw new IsomerError('CYCLIC_COMPOSITION', 'mapCompositionNodes: a node is nested in itself');
52
+ }
53
+ open.add(node);
54
+ stack.push({ node, children: walk(node), next: 0, result: node });
55
+ };
56
+ enter(root);
57
+ for (;;) {
58
+ const frame = stack[stack.length - 1];
59
+ const child = frame.children[frame.next];
60
+ if (child) {
61
+ enter(child.node);
62
+ continue;
63
+ }
64
+ stack.pop();
65
+ open.delete(frame.node);
66
+ const mapped = fn(frame.result);
67
+ const parent = stack[stack.length - 1];
68
+ if (!parent) {
69
+ return mapped;
70
+ }
71
+ const { path } = parent.children[parent.next];
72
+ parent.result = withValueAt(parent.result, path.split('.'), mapped, path);
73
+ parent.next += 1;
74
+ }
75
+ };
76
+ return {
77
+ ...composition,
78
+ body: composition.body.map((node) => mapNode(node)),
79
+ };
80
+ };
81
+ //# sourceMappingURL=map_nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map_nodes.js","sourceRoot":"","sources":["../../src/composition/map_nodes.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nimport type { ChildNodeRef, ChildNodeWalker } from './body_node_base';\nimport type { Composition } from './composition';\nimport { IsomerError } from './error';\nimport type { PrimitiveNode } from './node';\n\n/** One dotted step of a child path: `field` or `field[index]`. */\nconst PATH_STEP = /^([A-Za-z_$][\\w$]*)(?:\\[(\\d+)\\])?$/;\n\nconst unsupportedPath = (path: string): IsomerError =>\n new IsomerError(\n 'UNSUPPORTED_CHILD_PATH',\n `mapCompositionNodes: cannot rewrite child at path \"${path}\"; expected dotted \"field\" or \"field[index]\" steps`\n );\n\n/** `parent` with the value at `steps` replaced, every touched object and array copied. */\nconst withValueAt = (\n parent: unknown,\n steps: readonly string[],\n value: unknown,\n path: string\n): unknown => {\n const [step, ...rest] = steps;\n const match = step === undefined ? null : PATH_STEP.exec(step);\n if (!match || typeof parent !== 'object' || parent === null) {\n throw unsupportedPath(path);\n }\n const field = match[1] as string;\n const record = parent as Record<string, unknown>;\n if (match[2] === undefined) {\n const next =\n rest.length === 0 ? value : withValueAt(record[field], rest, value, path);\n return { ...record, [field]: next };\n }\n const index = Number(match[2]);\n const current = record[field];\n if (!Array.isArray(current)) {\n throw unsupportedPath(path);\n }\n const array = [...(current as unknown[])];\n array[index] =\n rest.length === 0 ? value : withValueAt(array[index], rest, value, path);\n return { ...record, [field]: array };\n};\n\n/** A node being mapped: its children, how many are done, and its copy so far. */\ninterface Frame {\n node: PrimitiveNode;\n children: ChildNodeRef[];\n next: number;\n result: PrimitiveNode;\n}\n\n/**\n * Rebuilds `composition`'s body with `fn` applied to every node, including\n * the nested children `walk` yields.\n *\n * Post-order: a container reaches `fn` after its children have been mapped,\n * so `fn` sees the finished replacements in place. Build `walk` with\n * {@link createChildNodeWalker} over every pack in the composition.\n * A child path is the dotted `field` / `field[index]` form the SDK documents\n * (`items[0].node`); any other shape throws `UNSUPPORTED_CHILD_PATH`.\n * Walked without recursion, so depth is bounded by memory, not the call stack; a node nested in itself throws `CYCLIC_COMPOSITION`.\n */\nexport const mapCompositionNodes = <\n TNode extends PrimitiveNode = PrimitiveNode,\n>(\n composition: Composition<TNode>,\n walk: ChildNodeWalker,\n fn: (node: PrimitiveNode) => PrimitiveNode\n): Composition<TNode> => {\n const mapNode = (root: PrimitiveNode): PrimitiveNode => {\n const open = new Set<PrimitiveNode>();\n const stack: Frame[] = [];\n const enter = (node: PrimitiveNode) => {\n if (open.has(node)) {\n throw new IsomerError(\n 'CYCLIC_COMPOSITION',\n 'mapCompositionNodes: a node is nested in itself'\n );\n }\n open.add(node);\n stack.push({ node, children: walk(node), next: 0, result: node });\n };\n enter(root);\n for (;;) {\n const frame = stack[stack.length - 1]!;\n const child = frame.children[frame.next];\n if (child) {\n enter(child.node as PrimitiveNode);\n continue;\n }\n stack.pop();\n open.delete(frame.node);\n const mapped = fn(frame.result);\n const parent = stack[stack.length - 1];\n if (!parent) {\n return mapped;\n }\n const { path } = parent.children[parent.next]!;\n parent.result = withValueAt(\n parent.result,\n path.split('.'),\n mapped,\n path\n ) as PrimitiveNode;\n parent.next += 1;\n }\n };\n return {\n ...composition,\n body: composition.body.map((node) => mapNode(node) as TNode),\n };\n};\n"]}
@@ -0,0 +1,9 @@
1
+ /** Portable color names shared by primitive packs and renderers. An exact subset of EUI's `NamedColor`. */
2
+ export type NamedColor = 'neutral' | 'primary' | 'accent' | 'success' | 'warning' | 'risk' | 'danger';
3
+ /** Every {@link NamedColor}, and the source `namedColorSchema` derives from. */
4
+ export declare const ALL_NAMED_COLORS: readonly NamedColor[];
5
+ /** Light/dark preference. `auto` resolves light wherever media queries are unavailable. */
6
+ export type RenderTheme = 'auto' | 'light' | 'dark';
7
+ /** A pack's colors by name. Partial: an unmapped name falls back to the renderer's default. */
8
+ export type NamedColorPalette = Partial<Record<NamedColor, string>>;
9
+ //# sourceMappingURL=named_color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"named_color.d.ts","sourceRoot":"","sources":["../../src/composition/named_color.ts"],"names":[],"mappings":"AAOA,2GAA2G;AAC3G,MAAM,MAAM,UAAU,GACpB,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/E,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAQjD,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD,+FAA+F;AAC/F,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ /** Every {@link NamedColor}, and the source `namedColorSchema` derives from. */
8
+ export const ALL_NAMED_COLORS = [
9
+ 'neutral',
10
+ 'primary',
11
+ 'accent',
12
+ 'success',
13
+ 'warning',
14
+ 'risk',
15
+ 'danger',
16
+ ];
17
+ //# sourceMappingURL=named_color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"named_color.js","sourceRoot":"","sources":["../../src/composition/named_color.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAA0B;IACrD,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;CACT,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n/** Portable color names shared by primitive packs and renderers. An exact subset of EUI's `NamedColor`. */\nexport type NamedColor =\n 'neutral' | 'primary' | 'accent' | 'success' | 'warning' | 'risk' | 'danger';\n\n/** Every {@link NamedColor}, and the source `namedColorSchema` derives from. */\nexport const ALL_NAMED_COLORS: readonly NamedColor[] = [\n 'neutral',\n 'primary',\n 'accent',\n 'success',\n 'warning',\n 'risk',\n 'danger',\n];\n\n/** Light/dark preference. `auto` resolves light wherever media queries are unavailable. */\nexport type RenderTheme = 'auto' | 'light' | 'dark';\n\n/** A pack's colors by name. Partial: an unmapped name falls back to the renderer's default. */\nexport type NamedColorPalette = Partial<Record<NamedColor, string>>;\n"]}
@@ -0,0 +1,11 @@
1
+ import type { BodyNodeBase } from './body_node_base.js';
2
+ /**
3
+ * One node in a `Composition`'s body, erased to its discriminator.
4
+ *
5
+ * A pack narrows `type` to its own literal union; the SDK holds this form
6
+ * because a heterogeneous inventory has no single node type to name.
7
+ */
8
+ export interface PrimitiveNode extends BodyNodeBase {
9
+ type: string;
10
+ }
11
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/composition/node.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/composition/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nimport type { BodyNodeBase } from './body_node_base';\n\n/**\n * One node in a `Composition`'s body, erased to its discriminator.\n *\n * A pack narrows `type` to its own literal union; the SDK holds this form\n * because a heterogeneous inventory has no single node type to name.\n */\nexport interface PrimitiveNode extends BodyNodeBase {\n type: string;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /** `text` on one line: each run of whitespace holding a line terminator becomes one space, and other whitespace stays as is. */
2
+ export declare const oneLine: (text: string) => string;
3
+ /** `text` as a JSON string on one line: `JSON.stringify` leaves U+2028 and U+2029 raw. */
4
+ export declare const quoteText: (text: string) => string;
5
+ /** A name for a one-line message: as it is when plain, else as {@link quoteText} quotes it. */
6
+ export declare const nameText: (name: string) => string;
7
+ //# sourceMappingURL=one_line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one_line.d.ts","sourceRoot":"","sources":["../../src/composition/one_line.ts"],"names":[],"mappings":"AASA,gIAAgI;AAChI,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MACoC,CAAC;AAE5E,0FAA0F;AAC1F,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAGP,CAAC;AAInC,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,MACQ,CAAC"}
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ const LINE_TERMINATOR_RE = /[\r\n\u2028\u2029]/;
8
+ /** `text` on one line: each run of whitespace holding a line terminator becomes one space, and other whitespace stays as is. */
9
+ export const oneLine = (text) => text.replace(/\s+/g, (run) => (LINE_TERMINATOR_RE.test(run) ? ' ' : run));
10
+ /** `text` as a JSON string on one line: `JSON.stringify` leaves U+2028 and U+2029 raw. */
11
+ export const quoteText = (text) => JSON.stringify(text)
12
+ .replace(/\u2028/g, '\\u2028')
13
+ .replace(/\u2029/g, '\\u2029');
14
+ const PLAIN_NAME = /^[\w$-]+$/;
15
+ /** A name for a one-line message: as it is when plain, else as {@link quoteText} quotes it. */
16
+ export const nameText = (name) => PLAIN_NAME.test(name) ? name : quoteText(name);
17
+ //# sourceMappingURL=one_line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one_line.js","sourceRoot":"","sources":["../../src/composition/one_line.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD,gIAAgI;AAChI,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE,CAC9C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAU,EAAE,CAChD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KACjB,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;KAC7B,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAEnC,MAAM,UAAU,GAAG,WAAW,CAAC;AAE/B,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE,CAC/C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nconst LINE_TERMINATOR_RE = /[\\r\\n\\u2028\\u2029]/;\n\n/** `text` on one line: each run of whitespace holding a line terminator becomes one space, and other whitespace stays as is. */\nexport const oneLine = (text: string): string =>\n text.replace(/\\s+/g, (run) => (LINE_TERMINATOR_RE.test(run) ? ' ' : run));\n\n/** `text` as a JSON string on one line: `JSON.stringify` leaves U+2028 and U+2029 raw. */\nexport const quoteText = (text: string): string =>\n JSON.stringify(text)\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n\nconst PLAIN_NAME = /^[\\w$-]+$/;\n\n/** A name for a one-line message: as it is when plain, else as {@link quoteText} quotes it. */\nexport const nameText = (name: string): string =>\n PLAIN_NAME.test(name) ? name : quoteText(name);\n"]}
@@ -0,0 +1,27 @@
1
+ /** Format hints a {@link StructuredValue} may carry. */
2
+ export declare const STRUCTURED_VALUE_FORMATS: readonly ["number", "compact", "percent", "currency", "bytes", "duration", "date", "relativeTime"];
3
+ /** One of {@link STRUCTURED_VALUE_FORMATS}. */
4
+ export type StructuredValueFormat = (typeof STRUCTURED_VALUE_FORMATS)[number];
5
+ /**
6
+ * A raw quantity plus a format hint, so every surface renders the same string.
7
+ *
8
+ * Formatting happens once, in `formatDisplayValue`, rather than per renderer —
9
+ * otherwise the text and Slack surfaces drift on rounding.
10
+ */
11
+ export interface StructuredValue {
12
+ /** Unformatted, in base units — a `percent` of `0.42` renders as 42%. */
13
+ raw: number | string;
14
+ /** How to render `raw`. Absent passes a string through and gives a number default formatting. */
15
+ format?: StructuredValueFormat;
16
+ /**
17
+ * Fraction digits for numeric formats. `number`, `percent`, and `currency`
18
+ * pad to it; omitted, `number` and `percent` keep at most two and `currency`
19
+ * two. `compact` and `bytes` drop trailing zeros and keep one when omitted.
20
+ */
21
+ precision?: number;
22
+ /** Three-letter currency code for `currency`; defaults to USD. */
23
+ currency?: string;
24
+ }
25
+ /** A value-bearing field: preformatted prose, or a {@link StructuredValue} to format. */
26
+ export type DisplayValue = string | StructuredValue;
27
+ //# sourceMappingURL=structured_value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured_value.d.ts","sourceRoot":"","sources":["../../src/composition/structured_value.ts"],"names":[],"mappings":"AAOA,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,oGAS3B,CAAC;AAEX,+CAA+C;AAC/C,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,iGAAiG;IACjG,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,yFAAyF;AACzF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,eAAe,CAAC"}
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ /** Format hints a {@link StructuredValue} may carry. */
8
+ export const STRUCTURED_VALUE_FORMATS = [
9
+ 'number',
10
+ 'compact',
11
+ 'percent',
12
+ 'currency',
13
+ 'bytes',
14
+ 'duration',
15
+ 'date',
16
+ 'relativeTime',
17
+ ];
18
+ //# sourceMappingURL=structured_value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured_value.js","sourceRoot":"","sources":["../../src/composition/structured_value.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wDAAwD;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;IACV,OAAO;IACP,UAAU;IACV,MAAM;IACN,cAAc;CACN,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n/** Format hints a {@link StructuredValue} may carry. */\nexport const STRUCTURED_VALUE_FORMATS = [\n 'number',\n 'compact',\n 'percent',\n 'currency',\n 'bytes',\n 'duration',\n 'date',\n 'relativeTime',\n] as const;\n\n/** One of {@link STRUCTURED_VALUE_FORMATS}. */\nexport type StructuredValueFormat = (typeof STRUCTURED_VALUE_FORMATS)[number];\n\n/**\n * A raw quantity plus a format hint, so every surface renders the same string.\n *\n * Formatting happens once, in `formatDisplayValue`, rather than per renderer —\n * otherwise the text and Slack surfaces drift on rounding.\n */\nexport interface StructuredValue {\n /** Unformatted, in base units — a `percent` of `0.42` renders as 42%. */\n raw: number | string;\n /** How to render `raw`. Absent passes a string through and gives a number default formatting. */\n format?: StructuredValueFormat;\n /**\n * Fraction digits for numeric formats. `number`, `percent`, and `currency`\n * pad to it; omitted, `number` and `percent` keep at most two and `currency`\n * two. `compact` and `bytes` drop trailing zeros and keep one when omitted.\n */\n precision?: number;\n /** Three-letter currency code for `currency`; defaults to USD. */\n currency?: string;\n}\n\n/** A value-bearing field: preformatted prose, or a {@link StructuredValue} to format. */\nexport type DisplayValue = string | StructuredValue;\n"]}