@elastic/isomer-sdk 0.2.0 → 0.4.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 (251) hide show
  1. package/NOTICE.txt +0 -286
  2. package/THIRD_PARTY_LICENSES.md +1 -885
  3. package/dist/author/authored_fields.d.ts +37 -12
  4. package/dist/author/authored_fields.d.ts.map +1 -1
  5. package/dist/author/authored_fields.js +45 -69
  6. package/dist/author/authored_fields.js.map +1 -1
  7. package/dist/author/authoring_input.d.ts.map +1 -1
  8. package/dist/author/authoring_input.js +12 -6
  9. package/dist/author/authoring_input.js.map +1 -1
  10. package/dist/author/authoring_model.d.ts +8 -2
  11. package/dist/author/authoring_model.d.ts.map +1 -1
  12. package/dist/author/authoring_model.js +67 -23
  13. package/dist/author/authoring_model.js.map +1 -1
  14. package/dist/author/declarations.d.ts.map +1 -1
  15. package/dist/author/declarations.js +45 -34
  16. package/dist/author/declarations.js.map +1 -1
  17. package/dist/author/index.d.ts +2 -1
  18. package/dist/author/index.d.ts.map +1 -1
  19. package/dist/author/index.js +2 -1
  20. package/dist/author/index.js.map +1 -1
  21. package/dist/author/jsx_shim.d.ts +49 -30
  22. package/dist/author/jsx_shim.d.ts.map +1 -1
  23. package/dist/author/jsx_shim.js +131 -40
  24. package/dist/author/jsx_shim.js.map +1 -1
  25. package/dist/author/print_jsx.d.ts +19 -0
  26. package/dist/author/print_jsx.d.ts.map +1 -0
  27. package/dist/author/print_jsx.js +372 -0
  28. package/dist/author/print_jsx.js.map +1 -0
  29. package/dist/author/prompt.d.ts +2 -2
  30. package/dist/author/prompt.d.ts.map +1 -1
  31. package/dist/author/prompt.js +7 -2
  32. package/dist/author/prompt.js.map +1 -1
  33. package/dist/author/schema_to_typescript.d.ts.map +1 -1
  34. package/dist/author/schema_to_typescript.js +6 -3
  35. package/dist/author/schema_to_typescript.js.map +1 -1
  36. package/dist/cjs/author/authored_fields.js +47 -70
  37. package/dist/cjs/author/authored_fields.js.map +1 -1
  38. package/dist/cjs/author/authoring_input.js +12 -6
  39. package/dist/cjs/author/authoring_input.js.map +1 -1
  40. package/dist/cjs/author/authoring_model.js +69 -24
  41. package/dist/cjs/author/authoring_model.js.map +1 -1
  42. package/dist/cjs/author/declarations.js +44 -33
  43. package/dist/cjs/author/declarations.js.map +1 -1
  44. package/dist/cjs/author/index.js +5 -1
  45. package/dist/cjs/author/index.js.map +1 -1
  46. package/dist/cjs/author/jsx_shim.js +130 -39
  47. package/dist/cjs/author/jsx_shim.js.map +1 -1
  48. package/dist/cjs/author/print_jsx.js +378 -0
  49. package/dist/cjs/author/print_jsx.js.map +1 -0
  50. package/dist/cjs/author/prompt.js +7 -2
  51. package/dist/cjs/author/prompt.js.map +1 -1
  52. package/dist/cjs/author/schema_to_typescript.js +6 -3
  53. package/dist/cjs/author/schema_to_typescript.js.map +1 -1
  54. package/dist/cjs/composition/error.js +2 -0
  55. package/dist/cjs/composition/error.js.map +1 -1
  56. package/dist/cjs/composition/structured_value.js.map +1 -1
  57. package/dist/cjs/define/index.js.map +1 -1
  58. package/dist/cjs/define/primitive_module.js +10 -4
  59. package/dist/cjs/define/primitive_module.js.map +1 -1
  60. package/dist/cjs/define/slack_blocks.js.map +1 -1
  61. package/dist/cjs/entries/index.js +5 -2
  62. package/dist/cjs/entries/index.js.map +1 -1
  63. package/dist/cjs/entries/markdown.js +3 -1
  64. package/dist/cjs/entries/markdown.js.map +1 -1
  65. package/dist/cjs/entries/react.js +2 -1
  66. package/dist/cjs/entries/react.js.map +1 -1
  67. package/dist/cjs/entries/slack.js +5 -1
  68. package/dist/cjs/entries/slack.js.map +1 -1
  69. package/dist/cjs/pack/enhancements.js.map +1 -1
  70. package/dist/cjs/pack/index.js +2 -1
  71. package/dist/cjs/pack/index.js.map +1 -1
  72. package/dist/cjs/pack/primitive_pack.js +14 -4
  73. package/dist/cjs/pack/primitive_pack.js.map +1 -1
  74. package/dist/cjs/render/format_number.js +2 -1
  75. package/dist/cjs/render/format_number.js.map +1 -1
  76. package/dist/cjs/render/html/envelope.js +12 -6
  77. package/dist/cjs/render/html/envelope.js.map +1 -1
  78. package/dist/cjs/render/markdown/blocks.js +82 -0
  79. package/dist/cjs/render/markdown/blocks.js.map +1 -0
  80. package/dist/cjs/render/markdown/builder.js +6 -2
  81. package/dist/cjs/render/markdown/builder.js.map +1 -1
  82. package/dist/cjs/render/markdown/format.js +46 -24
  83. package/dist/cjs/render/markdown/format.js.map +1 -1
  84. package/dist/cjs/render/markdown/host_tags.js +67 -0
  85. package/dist/cjs/render/markdown/host_tags.js.map +1 -0
  86. package/dist/cjs/render/markdown/index.js +5 -1
  87. package/dist/cjs/render/markdown/index.js.map +1 -1
  88. package/dist/cjs/render/markdown/split.js +325 -0
  89. package/dist/cjs/render/markdown/split.js.map +1 -0
  90. package/dist/cjs/render/primitive_dispatch.js +36 -6
  91. package/dist/cjs/render/primitive_dispatch.js.map +1 -1
  92. package/dist/cjs/render/react/content.js +3 -1
  93. package/dist/cjs/render/react/content.js.map +1 -1
  94. package/dist/cjs/render/react/index.js +3 -1
  95. package/dist/cjs/render/react/index.js.map +1 -1
  96. package/dist/cjs/render/react/markdown_content.js +143 -0
  97. package/dist/cjs/render/react/markdown_content.js.map +1 -0
  98. package/dist/cjs/render/slack/blocks.js +7 -0
  99. package/dist/cjs/render/slack/blocks.js.map +1 -1
  100. package/dist/cjs/render/slack/container.js +62 -0
  101. package/dist/cjs/render/slack/container.js.map +1 -0
  102. package/dist/cjs/render/slack/envelope.js +70 -14
  103. package/dist/cjs/render/slack/envelope.js.map +1 -1
  104. package/dist/cjs/render/slack/format.js +56 -6
  105. package/dist/cjs/render/slack/format.js.map +1 -1
  106. package/dist/cjs/render/slack/index.js +7 -1
  107. package/dist/cjs/render/slack/index.js.map +1 -1
  108. package/dist/cjs/render/slack/markdown_content.js +36 -77
  109. package/dist/cjs/render/slack/markdown_content.js.map +1 -1
  110. package/dist/cjs/render/slack/unmodeled.js +38 -0
  111. package/dist/cjs/render/slack/unmodeled.js.map +1 -0
  112. package/dist/cjs/testing/conformance.js +15 -1
  113. package/dist/cjs/testing/conformance.js.map +1 -1
  114. package/dist/cjs/testing/index.js +2 -1
  115. package/dist/cjs/testing/index.js.map +1 -1
  116. package/dist/cjs/validate/json_schema.js +10 -3
  117. package/dist/cjs/validate/json_schema.js.map +1 -1
  118. package/dist/cjs/validate/url.js +2 -1
  119. package/dist/cjs/validate/url.js.map +1 -1
  120. package/dist/composition/error.d.ts +2 -0
  121. package/dist/composition/error.d.ts.map +1 -1
  122. package/dist/composition/error.js +2 -0
  123. package/dist/composition/error.js.map +1 -1
  124. package/dist/composition/structured_value.d.ts +3 -3
  125. package/dist/composition/structured_value.d.ts.map +1 -1
  126. package/dist/composition/structured_value.js.map +1 -1
  127. package/dist/define/index.d.ts +1 -1
  128. package/dist/define/index.d.ts.map +1 -1
  129. package/dist/define/index.js.map +1 -1
  130. package/dist/define/primitive_module.d.ts +14 -5
  131. package/dist/define/primitive_module.d.ts.map +1 -1
  132. package/dist/define/primitive_module.js +10 -4
  133. package/dist/define/primitive_module.js.map +1 -1
  134. package/dist/define/slack_blocks.d.ts +31 -1
  135. package/dist/define/slack_blocks.d.ts.map +1 -1
  136. package/dist/define/slack_blocks.js.map +1 -1
  137. package/dist/entries/index.d.ts +2 -2
  138. package/dist/entries/index.d.ts.map +1 -1
  139. package/dist/entries/index.js +2 -2
  140. package/dist/entries/index.js.map +1 -1
  141. package/dist/entries/markdown.d.ts +1 -1
  142. package/dist/entries/markdown.d.ts.map +1 -1
  143. package/dist/entries/markdown.js +1 -1
  144. package/dist/entries/markdown.js.map +1 -1
  145. package/dist/entries/react.d.ts +1 -1
  146. package/dist/entries/react.d.ts.map +1 -1
  147. package/dist/entries/react.js +1 -1
  148. package/dist/entries/react.js.map +1 -1
  149. package/dist/entries/slack.d.ts +1 -1
  150. package/dist/entries/slack.d.ts.map +1 -1
  151. package/dist/entries/slack.js +1 -1
  152. package/dist/entries/slack.js.map +1 -1
  153. package/dist/pack/enhancements.d.ts +4 -0
  154. package/dist/pack/enhancements.d.ts.map +1 -1
  155. package/dist/pack/enhancements.js.map +1 -1
  156. package/dist/pack/index.d.ts +1 -1
  157. package/dist/pack/index.d.ts.map +1 -1
  158. package/dist/pack/index.js +1 -1
  159. package/dist/pack/index.js.map +1 -1
  160. package/dist/pack/primitive_pack.d.ts +3 -1
  161. package/dist/pack/primitive_pack.d.ts.map +1 -1
  162. package/dist/pack/primitive_pack.js +13 -3
  163. package/dist/pack/primitive_pack.js.map +1 -1
  164. package/dist/render/format_number.d.ts.map +1 -1
  165. package/dist/render/format_number.js +2 -1
  166. package/dist/render/format_number.js.map +1 -1
  167. package/dist/render/html/envelope.js +12 -6
  168. package/dist/render/html/envelope.js.map +1 -1
  169. package/dist/render/markdown/blocks.d.ts +6 -0
  170. package/dist/render/markdown/blocks.d.ts.map +1 -0
  171. package/dist/render/markdown/blocks.js +77 -0
  172. package/dist/render/markdown/blocks.js.map +1 -0
  173. package/dist/render/markdown/builder.d.ts +3 -0
  174. package/dist/render/markdown/builder.d.ts.map +1 -1
  175. package/dist/render/markdown/builder.js +3 -1
  176. package/dist/render/markdown/builder.js.map +1 -1
  177. package/dist/render/markdown/format.d.ts +2 -0
  178. package/dist/render/markdown/format.d.ts.map +1 -1
  179. package/dist/render/markdown/format.js +42 -22
  180. package/dist/render/markdown/format.js.map +1 -1
  181. package/dist/render/markdown/host_tags.d.ts +14 -0
  182. package/dist/render/markdown/host_tags.d.ts.map +1 -0
  183. package/dist/render/markdown/host_tags.js +63 -0
  184. package/dist/render/markdown/host_tags.js.map +1 -0
  185. package/dist/render/markdown/index.d.ts +2 -0
  186. package/dist/render/markdown/index.d.ts.map +1 -1
  187. package/dist/render/markdown/index.js +2 -0
  188. package/dist/render/markdown/index.js.map +1 -1
  189. package/dist/render/markdown/split.d.ts +32 -0
  190. package/dist/render/markdown/split.d.ts.map +1 -0
  191. package/dist/render/markdown/split.js +321 -0
  192. package/dist/render/markdown/split.js.map +1 -0
  193. package/dist/render/primitive_dispatch.d.ts +4 -2
  194. package/dist/render/primitive_dispatch.d.ts.map +1 -1
  195. package/dist/render/primitive_dispatch.js +36 -6
  196. package/dist/render/primitive_dispatch.js.map +1 -1
  197. package/dist/render/react/content.d.ts +1 -1
  198. package/dist/render/react/content.d.ts.map +1 -1
  199. package/dist/render/react/content.js +3 -1
  200. package/dist/render/react/content.js.map +1 -1
  201. package/dist/render/react/index.d.ts +1 -0
  202. package/dist/render/react/index.d.ts.map +1 -1
  203. package/dist/render/react/index.js +1 -0
  204. package/dist/render/react/index.js.map +1 -1
  205. package/dist/render/react/markdown_content.d.ts +9 -0
  206. package/dist/render/react/markdown_content.d.ts.map +1 -0
  207. package/dist/render/react/markdown_content.js +139 -0
  208. package/dist/render/react/markdown_content.js.map +1 -0
  209. package/dist/render/slack/blocks.d.ts +8 -1
  210. package/dist/render/slack/blocks.d.ts.map +1 -1
  211. package/dist/render/slack/blocks.js +7 -0
  212. package/dist/render/slack/blocks.js.map +1 -1
  213. package/dist/render/slack/container.d.ts +25 -0
  214. package/dist/render/slack/container.d.ts.map +1 -0
  215. package/dist/render/slack/container.js +55 -0
  216. package/dist/render/slack/container.js.map +1 -0
  217. package/dist/render/slack/envelope.d.ts +6 -4
  218. package/dist/render/slack/envelope.d.ts.map +1 -1
  219. package/dist/render/slack/envelope.js +71 -15
  220. package/dist/render/slack/envelope.js.map +1 -1
  221. package/dist/render/slack/format.d.ts +15 -3
  222. package/dist/render/slack/format.d.ts.map +1 -1
  223. package/dist/render/slack/format.js +54 -5
  224. package/dist/render/slack/format.js.map +1 -1
  225. package/dist/render/slack/index.d.ts +4 -2
  226. package/dist/render/slack/index.d.ts.map +1 -1
  227. package/dist/render/slack/index.js +2 -0
  228. package/dist/render/slack/index.js.map +1 -1
  229. package/dist/render/slack/markdown_content.d.ts +3 -2
  230. package/dist/render/slack/markdown_content.d.ts.map +1 -1
  231. package/dist/render/slack/markdown_content.js +27 -68
  232. package/dist/render/slack/markdown_content.js.map +1 -1
  233. package/dist/render/slack/unmodeled.d.ts +16 -0
  234. package/dist/render/slack/unmodeled.d.ts.map +1 -0
  235. package/dist/render/slack/unmodeled.js +32 -0
  236. package/dist/render/slack/unmodeled.js.map +1 -0
  237. package/dist/testing/conformance.d.ts +3 -1
  238. package/dist/testing/conformance.d.ts.map +1 -1
  239. package/dist/testing/conformance.js +14 -0
  240. package/dist/testing/conformance.js.map +1 -1
  241. package/dist/testing/index.d.ts +1 -1
  242. package/dist/testing/index.d.ts.map +1 -1
  243. package/dist/testing/index.js +1 -1
  244. package/dist/testing/index.js.map +1 -1
  245. package/dist/validate/json_schema.d.ts.map +1 -1
  246. package/dist/validate/json_schema.js +10 -3
  247. package/dist/validate/json_schema.js.map +1 -1
  248. package/dist/validate/url.d.ts.map +1 -1
  249. package/dist/validate/url.js +2 -1
  250. package/dist/validate/url.js.map +1 -1
  251. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"schema_to_typescript.js","sourceRoot":"","sources":["../../../src/author/schema_to_typescript.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIU,QAAA,UAAU,GAAG,UAAU,CAAC;AAErC,qDAAqD;AACxC,QAAA,aAAa,GAAG,eAAe,CAAC;AAE7C,MAAM,eAAe,GAAG;IACtB,MAAM;IACN,OAAO;IACP,MAAM;IACN,YAAY;IACZ,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,OAAO;IACP,aAAa;IACb,OAAO;IACP,OAAO;IACP,OAAO;CACC,CAAC;AAEX,MAAM,MAAM,GAAG,IAAI,CAAC;AAEP,QAAA,UAAU,GAAG,oBAAoB,CAAC;AAExC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAD1D,QAAA,YAAY,gBAC8C;AAEhE,MAAM,WAAW,GAA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ACvC,OAAO,CAAC,IAAI,CACV,QAAQ,IAAI,MAAM,SAAS,CAAC,IAAA,cAAM,EAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CACxE,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AA9PW,QAAA,iBAAiB,qBA8P5B","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 JsonObject = Record<string, unknown>;\n\nexport const DEF_PREFIX = '#/$defs/';\n\n/** Ids `z.toJSONSchema` gives a def no one named. */\nexport const ANONYMOUS_DEF = /^__schema\\d+$/;\n\nconst STRUCTURAL_KEYS = [\n 'type',\n 'const',\n 'enum',\n 'properties',\n 'additionalProperties',\n 'patternProperties',\n 'propertyNames',\n 'items',\n 'prefixItems',\n 'oneOf',\n 'anyOf',\n 'allOf',\n] as const;\n\nconst INDENT = ' ';\n\nexport const IDENTIFIER = /^[A-Za-z_$][\\w$]*$/;\n\nexport const isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport const parseDefRef = (ref: unknown): string | undefined =>\n typeof ref === 'string' && ref.startsWith(DEF_PREFIX)\n ? ref.slice(DEF_PREFIX.length)\n : undefined;\n\nexport const ownDef = (defs: JsonObject, id: string): unknown =>\n Object.hasOwn(defs, id) ? defs[id] : undefined;\n\n/** `slideStats` becomes `SlideStats`; anything but letters and digits splits words. */\nexport const pascalCase = (value: string): string => {\n const name = value\n .split(/[^A-Za-z0-9]+/)\n .filter(Boolean)\n .map((word) => `${word.slice(0, 1).toUpperCase()}${word.slice(1)}`)\n .join('');\n if (name === '') {\n return 'Type';\n }\n return /^\\d/.test(name) ? `_${name}` : name;\n};\n\n/** A JSDoc block for `lines`, or `''` when there are none. */\nexport const jsDoc = (lines: readonly string[], pad: string): string => {\n const text = lines\n .flatMap((line) => line.split('\\n'))\n .map((line) => line.replaceAll('*/', '*\\\\/').trimEnd());\n while (text[0] === '') {\n text.shift();\n }\n while (text.at(-1) === '') {\n text.pop();\n }\n if (text.length === 0) {\n return '';\n }\n const [only] = text;\n if (text.length === 1 && only !== undefined) {\n return `${pad}/** ${only} */\\n`;\n }\n return `${pad}/**\\n${text\n .map((line) => (line === '' ? `${pad} *` : `${pad} * ${line}`))\n .join('\\n')}\\n${pad} */\\n`;\n};\n\nconst propertyKey = (key: string): string =>\n IDENTIFIER.test(key) ? key : JSON.stringify(key);\n\nconst literal = (value: unknown): string => {\n if (value === null) {\n return 'null';\n }\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n case 'number':\n case 'boolean':\n return String(value);\n default:\n return 'unknown';\n }\n};\n\ninterface Printed {\n text: string;\n kind: 'atom' | 'union' | 'intersection';\n}\n\nconst atom = (text: string): Printed => ({ text, kind: 'atom' });\n\nconst union = (members: readonly Printed[]): Printed => {\n if (members.some(({ text }) => text === 'unknown')) return atom('unknown');\n const unique = new Map(members.map((member) => [member.text, member]));\n const [only] = [...unique.values()];\n if (unique.size === 0) {\n return atom('never');\n }\n return unique.size === 1 && only\n ? only\n : { text: [...unique.keys()].join(' | '), kind: 'union' };\n};\n\nconst intersection = (members: readonly Printed[]): Printed => {\n const unique = new Map(members.map((member) => [member.text, member]));\n const [only] = [...unique.values()];\n if (!only) return atom('unknown');\n if (unique.size === 1 && only) {\n return only;\n }\n return {\n text: [...unique.values()]\n .map(({ text, kind }) => (kind === 'union' ? `(${text})` : text))\n .join(' & '),\n kind: 'intersection',\n };\n};\n\nconst arrayOf = ({ text, kind }: Printed): Printed =>\n atom(kind === 'atom' ? `${text}[]` : `(${text})[]`);\n\n/** What {@link TypePrinter.members} prints and how. */\nexport interface MemberOptions {\n /** Properties left out. */\n omit?: ReadonlySet<string>;\n /** Properties printed optional whether or not the schema requires them. */\n optional?: ReadonlySet<string>;\n}\n\nexport interface TypePrinterOptions {\n defs: JsonObject;\n /** TypeScript names for defs printed by reference; every other def is inlined. */\n names: ReadonlyMap<string, string>;\n /** A fresh, unused name, for a def inlining cannot express. */\n claim: (base: string) => string;\n}\n\nexport interface TypePrinter {\n /** `schema` as a TypeScript type, written at `depth` levels of indent. */\n print: (schema: unknown, depth?: number) => string;\n /** The `key?: Type;` members of an object schema, with their JSDoc, at `depth + 1`. */\n members: (\n schema: JsonObject,\n depth: number,\n options?: MemberOptions\n ) => string;\n /** Type aliases for the anonymous defs that refer to themselves. Call last. */\n promoted: () => string[];\n}\n\n/** A TypeScript printer over the subset of JSON Schema `z.toJSONSchema` emits. */\nexport const createTypePrinter = ({\n defs,\n names,\n claim,\n}: TypePrinterOptions): TypePrinter => {\n const promotedNames = new Map<string, string>();\n\n const printRef = (\n id: string,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const named = names.get(id);\n if (named !== undefined) {\n return atom(named);\n }\n const target = ownDef(defs, id);\n if (target === undefined) {\n return atom('unknown');\n }\n if (active.has(id)) {\n const name = promotedNames.get(id) ?? claim(pascalCase(id));\n promotedNames.set(id, name);\n return atom(name);\n }\n return printNode(target, depth, new Set([...active, id]));\n };\n\n const printNode = (\n node: unknown,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n if (node === false) {\n return atom('never');\n }\n if (!isJsonObject(node)) {\n return atom('unknown');\n }\n const parts: Printed[] = [];\n const ref = parseDefRef(node.$ref);\n if (ref !== undefined) {\n parts.push(printRef(ref, depth, active));\n }\n if (STRUCTURAL_KEYS.some((key) => Object.hasOwn(node, key))) {\n parts.push(printStructure(node, depth, active));\n }\n return parts.length === 0 ? atom('unknown') : intersection(parts);\n };\n\n const printStructure = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const parts: Printed[] = [];\n const own = printOwn(node, depth, active);\n if (own) {\n parts.push(own);\n }\n for (const key of ['oneOf', 'anyOf'] as const) {\n const members = node[key];\n if (Array.isArray(members)) {\n parts.push(\n union(members.map((member) => printNode(member, depth, active)))\n );\n }\n }\n if (Array.isArray(node.allOf)) {\n parts.push(\n intersection(\n node.allOf.map((member) => printNode(member, depth, active))\n )\n );\n }\n return parts.length === 0 ? atom('unknown') : intersection(parts);\n };\n\n // `undefined` when the node only combines other schemas.\n const printOwn = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed | undefined => {\n if (Object.hasOwn(node, 'const')) {\n return atom(literal(node.const));\n }\n if (Array.isArray(node.enum)) {\n return union(node.enum.map((value) => atom(literal(value))));\n }\n const { type } = node;\n if (Array.isArray(type)) {\n return union(\n type.map((member) => printTyped(member, node, depth, active))\n );\n }\n if (typeof type === 'string') {\n return printTyped(type, node, depth, active);\n }\n if (\n Object.hasOwn(node, 'properties') ||\n Object.hasOwn(node, 'additionalProperties')\n ) {\n return printObject(node, depth, active);\n }\n if (Object.hasOwn(node, 'items') || Object.hasOwn(node, 'prefixItems')) {\n return printArray(node, depth, active);\n }\n return undefined;\n };\n\n const printTyped = (\n type: unknown,\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n switch (type) {\n case 'string':\n return atom('string');\n case 'number':\n case 'integer':\n return atom('number');\n case 'boolean':\n return atom('boolean');\n case 'null':\n return atom('null');\n case 'array':\n return printArray(node, depth, active);\n case 'object':\n return printObject(node, depth, active);\n default:\n return atom('unknown');\n }\n };\n\n const printArray = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const { prefixItems, items } = node;\n if (Array.isArray(prefixItems)) {\n const required = typeof node.minItems === 'number' ? node.minItems : 0;\n const elements = prefixItems.map((item, index) => {\n const printed = printNode(item, depth, active);\n return index < required\n ? printed.text\n : `${printed.kind === 'atom' ? printed.text : `(${printed.text})`}?`;\n });\n if (items !== undefined && items !== false) {\n elements.push(`...${arrayOf(printNode(items, depth, active)).text}`);\n }\n return atom(`[${elements.join(', ')}]`);\n }\n return arrayOf(\n items === undefined ? atom('unknown') : printNode(items, depth, active)\n );\n };\n\n const printObject = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const properties = isJsonObject(node.properties) ? node.properties : {};\n const lines = printMembers(node, depth, active, {});\n const extra = node.additionalProperties;\n const patterns = isJsonObject(node.patternProperties)\n ? Object.values(node.patternProperties)\n : [];\n const open = extra !== false;\n const values = [\n ...patterns.map((schema) => printNode(schema, depth, active)),\n ];\n if (open)\n values.push(\n extra === undefined || extra === true\n ? atom('unknown')\n : printNode(extra, depth, active)\n );\n const index =\n values.length === 0\n ? Object.keys(properties).length === 0\n ? `${INDENT.repeat(depth + 1)}[key: string]: never;\\n`\n : ''\n : `${INDENT.repeat(depth + 1)}[key: string]: ${\n union([\n ...values,\n ...Object.values(properties).map((schema) =>\n printNode(schema, depth, active)\n ),\n ...(Object.keys(properties).some(\n (key) =>\n !Array.isArray(node.required) || !node.required.includes(key)\n )\n ? [atom('undefined')]\n : []),\n ]).text\n };\\n`;\n return atom(`{\\n${lines}${index}${INDENT.repeat(depth)}}`);\n };\n\n const printMembers = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>,\n { omit, optional }: MemberOptions\n ): string => {\n const pad = INDENT.repeat(depth + 1);\n const required = new Set(\n Array.isArray(node.required)\n ? node.required.filter((key) => typeof key === 'string')\n : []\n );\n const properties = isJsonObject(node.properties) ? node.properties : {};\n return Object.entries(properties)\n .filter(([key]) => !omit?.has(key))\n .map(([key, property]) => {\n const doc = isJsonObject(property)\n ? jsDoc(\n [\n typeof property.description === 'string'\n ? property.description\n : '',\n ...(Object.hasOwn(property, 'default')\n ? [`@default ${JSON.stringify(property.default)}`]\n : []),\n ],\n pad\n )\n : '';\n const mark = required.has(key) && !optional?.has(key) ? '' : '?';\n return `${doc}${pad}${propertyKey(key)}${mark}: ${\n printNode(property, depth + 1, active).text\n };\\n`;\n })\n .join('');\n };\n\n return {\n print: (schema, depth = 0) => printNode(schema, depth, new Set()).text,\n members: (schema, depth, options = {}) =>\n printMembers(schema, depth, new Set(), options),\n promoted: () => {\n const aliases: string[] = [];\n for (const [id, name] of promotedNames) {\n aliases.push(\n `type ${name} = ${printNode(ownDef(defs, id), 0, new Set([id])).text};`\n );\n }\n return aliases;\n },\n };\n};\n"]}
1
+ {"version":3,"file":"schema_to_typescript.js","sourceRoot":"","sources":["../../../src/author/schema_to_typescript.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIU,QAAA,UAAU,GAAG,UAAU,CAAC;AAErC,qDAAqD;AACxC,QAAA,aAAa,GAAG,eAAe,CAAC;AAE7C,MAAM,eAAe,GAAG;IACtB,MAAM;IACN,OAAO;IACP,MAAM;IACN,YAAY;IACZ,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,OAAO;IACP,aAAa;IACb,OAAO;IACP,OAAO;IACP,OAAO;CACC,CAAC;AAEX,MAAM,MAAM,GAAG,IAAI,CAAC;AAEP,QAAA,UAAU,GAAG,oBAAoB,CAAC;AAExC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAD1D,QAAA,YAAY,gBAC8C;AAEhE,MAAM,WAAW,GAAG,CAAC,GAAY,EAAsB,EAAE,CAC9D,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,kBAAU,CAAC;IACnD,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAU,CAAC,MAAM,CAAC;IAC9B,CAAC,CAAC,SAAS,CAAC;AAHH,QAAA,WAAW,eAGR;AAET,MAAM,MAAM,GAAG,CAAC,IAAgB,EAAE,EAAU,EAAW,EAAE,CAC9D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,C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PW,QAAA,iBAAiB,qBA+P5B","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 JsonObject = Record<string, unknown>;\n\nexport const DEF_PREFIX = '#/$defs/';\n\n/** Ids `z.toJSONSchema` gives a def no one named. */\nexport const ANONYMOUS_DEF = /^__schema\\d+$/;\n\nconst STRUCTURAL_KEYS = [\n 'type',\n 'const',\n 'enum',\n 'properties',\n 'additionalProperties',\n 'patternProperties',\n 'propertyNames',\n 'items',\n 'prefixItems',\n 'oneOf',\n 'anyOf',\n 'allOf',\n] as const;\n\nconst INDENT = ' ';\n\nexport const IDENTIFIER = /^[A-Za-z_$][\\w$]*$/;\n\nexport const isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport const parseDefRef = (ref: unknown): string | undefined =>\n typeof ref === 'string' && ref.startsWith(DEF_PREFIX)\n ? ref.slice(DEF_PREFIX.length)\n : undefined;\n\nexport const ownDef = (defs: JsonObject, id: string): unknown =>\n Object.hasOwn(defs, id) ? defs[id] : undefined;\n\n/** `slideStats` becomes `SlideStats`; anything but letters and digits splits words. */\nexport const pascalCase = (value: string): string => {\n const name = value\n .split(/[^A-Za-z0-9]+/)\n .filter(Boolean)\n .map((word) => `${word.slice(0, 1).toUpperCase()}${word.slice(1)}`)\n .join('');\n if (name === '') {\n return 'Type';\n }\n return /^\\d/.test(name) ? `_${name}` : name;\n};\n\n/** A JSDoc block for `lines`, or `''` when there are none. */\nexport const jsDoc = (lines: readonly string[], pad: string): string => {\n const text = lines\n .flatMap((line) => line.split('\\n'))\n .map((line) => line.replaceAll('*/', '*\\\\/').trimEnd());\n while (text[0] === '') {\n text.shift();\n }\n while (text.at(-1) === '') {\n text.pop();\n }\n if (text.length === 0) {\n return '';\n }\n const [only] = text;\n if (text.length === 1 && only !== undefined) {\n return `${pad}/** ${only} */\\n`;\n }\n return `${pad}/**\\n${text\n .map((line) => (line === '' ? `${pad} *` : `${pad} * ${line}`))\n .join('\\n')}\\n${pad} */\\n`;\n};\n\nconst propertyKey = (key: string): string =>\n IDENTIFIER.test(key) ? key : JSON.stringify(key);\n\nconst literal = (value: unknown): string => {\n if (value === null) {\n return 'null';\n }\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n case 'number':\n case 'boolean':\n return String(value);\n default:\n return 'unknown';\n }\n};\n\ninterface Printed {\n text: string;\n kind: 'atom' | 'union' | 'intersection';\n}\n\nconst atom = (text: string): Printed => ({ text, kind: 'atom' });\n\nconst union = (members: readonly Printed[]): Printed => {\n if (members.some(({ text }) => text === 'unknown')) {\n return atom('unknown');\n }\n const unique = new Map(members.map((member) => [member.text, member]));\n const [only] = [...unique.values()];\n if (unique.size === 0) {\n return atom('never');\n }\n return unique.size === 1 && only\n ? only\n : { text: [...unique.keys()].join(' | '), kind: 'union' };\n};\n\nconst intersection = (members: readonly Printed[]): Printed => {\n const unique = new Map(members.map((member) => [member.text, member]));\n const [only] = [...unique.values()];\n if (!only) {\n return atom('unknown');\n }\n if (unique.size === 1 && only) {\n return only;\n }\n return {\n text: [...unique.values()]\n .map(({ text, kind }) => (kind === 'union' ? `(${text})` : text))\n .join(' & '),\n kind: 'intersection',\n };\n};\n\nconst arrayOf = ({ text, kind }: Printed): Printed =>\n atom(kind === 'atom' ? `${text}[]` : `(${text})[]`);\n\n/** What {@link TypePrinter.members} prints and how. */\nexport interface MemberOptions {\n /** Properties left out. */\n omit?: ReadonlySet<string>;\n /** Properties printed optional whether or not the schema requires them. */\n optional?: ReadonlySet<string>;\n}\n\nexport interface TypePrinterOptions {\n defs: JsonObject;\n /** TypeScript names for defs printed by reference; every other def is inlined. */\n names: ReadonlyMap<string, string>;\n /** A fresh, unused name, for a def inlining cannot express. */\n claim: (base: string) => string;\n}\n\nexport interface TypePrinter {\n /** `schema` as a TypeScript type, written at `depth` levels of indent. */\n print: (schema: unknown, depth?: number) => string;\n /** The `key?: Type;` members of an object schema, with their JSDoc, at `depth + 1`. */\n members: (\n schema: JsonObject,\n depth: number,\n options?: MemberOptions\n ) => string;\n /** Type aliases for the anonymous defs that refer to themselves. Call last. */\n promoted: () => string[];\n}\n\n/** A TypeScript printer over the subset of JSON Schema `z.toJSONSchema` emits. */\nexport const createTypePrinter = ({\n defs,\n names,\n claim,\n}: TypePrinterOptions): TypePrinter => {\n const promotedNames = new Map<string, string>();\n\n const printRef = (\n id: string,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const named = names.get(id);\n if (named !== undefined) {\n return atom(named);\n }\n const target = ownDef(defs, id);\n if (target === undefined) {\n return atom('unknown');\n }\n if (active.has(id)) {\n const name = promotedNames.get(id) ?? claim(pascalCase(id));\n promotedNames.set(id, name);\n return atom(name);\n }\n return printNode(target, depth, new Set([...active, id]));\n };\n\n const printNode = (\n node: unknown,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n if (node === false) {\n return atom('never');\n }\n if (!isJsonObject(node)) {\n return atom('unknown');\n }\n const parts: Printed[] = [];\n const ref = parseDefRef(node.$ref);\n if (ref !== undefined) {\n parts.push(printRef(ref, depth, active));\n }\n if (STRUCTURAL_KEYS.some((key) => Object.hasOwn(node, key))) {\n parts.push(printStructure(node, depth, active));\n }\n return parts.length === 0 ? atom('unknown') : intersection(parts);\n };\n\n const printStructure = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const parts: Printed[] = [];\n const own = printOwn(node, depth, active);\n if (own) {\n parts.push(own);\n }\n for (const key of ['oneOf', 'anyOf'] as const) {\n const members = node[key];\n if (Array.isArray(members)) {\n parts.push(\n union(members.map((member) => printNode(member, depth, active)))\n );\n }\n }\n if (Array.isArray(node.allOf)) {\n parts.push(\n intersection(\n node.allOf.map((member) => printNode(member, depth, active))\n )\n );\n }\n return parts.length === 0 ? atom('unknown') : intersection(parts);\n };\n\n // `undefined` when the node only combines other schemas.\n const printOwn = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed | undefined => {\n if (Object.hasOwn(node, 'const')) {\n return atom(literal(node.const));\n }\n if (Array.isArray(node.enum)) {\n return union(node.enum.map((value) => atom(literal(value))));\n }\n const { type } = node;\n if (Array.isArray(type)) {\n return union(\n type.map((member) => printTyped(member, node, depth, active))\n );\n }\n if (typeof type === 'string') {\n return printTyped(type, node, depth, active);\n }\n if (\n Object.hasOwn(node, 'properties') ||\n Object.hasOwn(node, 'additionalProperties')\n ) {\n return printObject(node, depth, active);\n }\n if (Object.hasOwn(node, 'items') || Object.hasOwn(node, 'prefixItems')) {\n return printArray(node, depth, active);\n }\n return undefined;\n };\n\n const printTyped = (\n type: unknown,\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n switch (type) {\n case 'string':\n return atom('string');\n case 'number':\n case 'integer':\n return atom('number');\n case 'boolean':\n return atom('boolean');\n case 'null':\n return atom('null');\n case 'array':\n return printArray(node, depth, active);\n case 'object':\n return printObject(node, depth, active);\n default:\n return atom('unknown');\n }\n };\n\n const printArray = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const { prefixItems, items } = node;\n if (Array.isArray(prefixItems)) {\n const required = typeof node.minItems === 'number' ? node.minItems : 0;\n const elements = prefixItems.map((item, index) => {\n const printed = printNode(item, depth, active);\n return index < required\n ? printed.text\n : `${printed.kind === 'atom' ? printed.text : `(${printed.text})`}?`;\n });\n if (items !== undefined && items !== false) {\n elements.push(`...${arrayOf(printNode(items, depth, active)).text}`);\n }\n return atom(`[${elements.join(', ')}]`);\n }\n return arrayOf(\n items === undefined ? atom('unknown') : printNode(items, depth, active)\n );\n };\n\n const printObject = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>\n ): Printed => {\n const properties = isJsonObject(node.properties) ? node.properties : {};\n const lines = printMembers(node, depth, active, {});\n const extra = node.additionalProperties;\n const patterns = isJsonObject(node.patternProperties)\n ? Object.values(node.patternProperties)\n : [];\n const open = extra !== false;\n const values = [\n ...patterns.map((schema) => printNode(schema, depth, active)),\n ];\n if (open) {\n values.push(\n extra === undefined || extra === true\n ? atom('unknown')\n : printNode(extra, depth, active)\n );\n }\n const index =\n values.length === 0\n ? Object.keys(properties).length === 0\n ? `${INDENT.repeat(depth + 1)}[key: string]: never;\\n`\n : ''\n : `${INDENT.repeat(depth + 1)}[key: string]: ${\n union([\n ...values,\n ...Object.values(properties).map((schema) =>\n printNode(schema, depth, active)\n ),\n ...(Object.keys(properties).some(\n (key) =>\n !Array.isArray(node.required) || !node.required.includes(key)\n )\n ? [atom('undefined')]\n : []),\n ]).text\n };\\n`;\n return atom(`{\\n${lines}${index}${INDENT.repeat(depth)}}`);\n };\n\n const printMembers = (\n node: JsonObject,\n depth: number,\n active: ReadonlySet<string>,\n { omit, optional }: MemberOptions\n ): string => {\n const pad = INDENT.repeat(depth + 1);\n const required = new Set(\n Array.isArray(node.required)\n ? node.required.filter((key) => typeof key === 'string')\n : []\n );\n const properties = isJsonObject(node.properties) ? node.properties : {};\n return Object.entries(properties)\n .filter(([key]) => !omit?.has(key))\n .map(([key, property]) => {\n const doc = isJsonObject(property)\n ? jsDoc(\n [\n typeof property.description === 'string'\n ? property.description\n : '',\n ...(Object.hasOwn(property, 'default')\n ? [`@default ${JSON.stringify(property.default)}`]\n : []),\n ],\n pad\n )\n : '';\n const mark = required.has(key) && !optional?.has(key) ? '' : '?';\n return `${doc}${pad}${propertyKey(key)}${mark}: ${\n printNode(property, depth + 1, active).text\n };\\n`;\n })\n .join('');\n };\n\n return {\n print: (schema, depth = 0) => printNode(schema, depth, new Set()).text,\n members: (schema, depth, options = {}) =>\n printMembers(schema, depth, new Set(), options),\n promoted: () => {\n const aliases: string[] = [];\n for (const [id, name] of promotedNames) {\n aliases.push(\n `type ${name} = ${printNode(ownDef(defs, id), 0, new Set([id])).text};`\n );\n }\n return aliases;\n },\n };\n};\n"]}
@@ -39,8 +39,10 @@ exports.ISOMER_ERROR_CODES = {
39
39
  INCOMPATIBLE_STYLE_COLLECTOR: 'INCOMPATIBLE_STYLE_COLLECTOR',
40
40
  INPUT_NOT_PLAIN_DATA: 'INPUT_NOT_PLAIN_DATA',
41
41
  INPUT_OVER_BUDGET: 'INPUT_OVER_BUDGET',
42
+ INVALID_BASE_URL: 'INVALID_BASE_URL',
42
43
  INVALID_BODY_NODE: 'INVALID_BODY_NODE',
43
44
  INVALID_FRAME_BODY: 'INVALID_FRAME_BODY',
45
+ INVALID_PACK_GROUPS: 'INVALID_PACK_GROUPS',
44
46
  MISSING_AUTHORED_TEXT: 'MISSING_AUTHORED_TEXT',
45
47
  MISSING_STYLE_ADAPTER: 'MISSING_STYLE_ADAPTER',
46
48
  RESERVED_NODE_FIELD: 'RESERVED_NODE_FIELD',
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/composition/error.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;;;;GAMG;AACU,QAAA,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,MAAa,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;AARD,kCAQC","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"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/composition/error.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;;;;GAMG;AACU,QAAA,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,gBAAgB,EAAE,kBAAkB;IACpC,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,mBAAmB,EAAE,qBAAqB;IAC1C,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,MAAa,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;AARD,kCAQC","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_BASE_URL: 'INVALID_BASE_URL',\n INVALID_BODY_NODE: 'INVALID_BODY_NODE',\n INVALID_FRAME_BODY: 'INVALID_FRAME_BODY',\n INVALID_PACK_GROUPS: 'INVALID_PACK_GROUPS',\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"structured_value.js","sourceRoot":"","sources":["../../../src/composition/structured_value.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,wDAAwD;AAC3C,QAAA,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"]}
1
+ {"version":3,"file":"structured_value.js","sourceRoot":"","sources":["../../../src/composition/structured_value.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,wDAAwD;AAC3C,QAAA,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 | undefined;\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 | undefined;\n /** Three-letter currency code for `currency`; defaults to USD. */\n currency?: string | undefined;\n}\n\n/** A value-bearing field: preformatted prose, or a {@link StructuredValue} to format. */\nexport type DisplayValue = string | StructuredValue;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/define/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iCAUiB;AADf,kGAAA,SAAS,OAAA;AAQX,yDAM6B;AAF3B,iHAAA,YAAY,OAAA;AACZ,sHAAA,iBAAiB,OAAA;AAEnB,mDAAiE;AAApC,2GAAA,SAAS,OAAA;AACtC,uDA8B4B;AAP1B,qHAAA,iBAAiB,OAAA;AACjB,oHAAA,gBAAgB,OAAA;AAChB,0HAAA,sBAAsB,OAAA;AACtB,mHAAA,eAAe,OAAA;AACf,sHAAA,kBAAkB,OAAA;AAClB,4HAAA,wBAAwB,OAAA;AACxB,sHAAA,kBAAkB,OAAA;AAgDpB,2CAAmE;AAA1D,gHAAA,kBAAkB,OAAA;AAAE,6GAAA,eAAe,OAAA;AAC5C,6CAAkD;AAAzC,6GAAA,cAAc,OAAA;AAAE,gGAAA,CAAC,OAAA","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 {\n type BoundFrame,\n type Frame,\n type FrameBody,\n type FrameComposition,\n type FrameDispatcher,\n type FrameHeader,\n type FrameViewport,\n type ThemePair,\n bindFrame,\n} from './frame';\nexport {\n type MarkdownBlock,\n type MarkdownContent,\n type MarkdownInline,\n type MarkdownInlineInput,\n} from './markdown_content';\nexport {\n type ExampleNode,\n type NormalizedPrimitiveExample,\n type PrimitiveExample,\n exampleNodes,\n primitiveExamples,\n} from './primitive_example';\nexport { type PrimitiveIcon, ICON_VARS } from './primitive_icon';\nexport {\n type AnyPrimitiveDefinition,\n type DefaultPackTypes,\n type OptionalSurface,\n type PackTypes,\n type PrimitiveCatalogEntry,\n type PrimitiveChildRef,\n type PrimitiveDefinition,\n type PrimitiveMetrics,\n type PrimitiveNode,\n type PrimitiveRenderContext,\n type PrimitiveSchema,\n type PrimitiveStyleCollectionContext,\n type PrimitiveStyleCollector,\n type ReactContextArg,\n type Renderer,\n type Renderers,\n type RenderScope,\n type StyledRenderContext,\n type StyleHandle,\n type SurfaceMap,\n type ThemeTokenPath,\n type WithNodeFields,\n OPTIONAL_SURFACES,\n bodyNodeIdSchema,\n bodyNodeSurfacesSchema,\n definePrimitive,\n definePrimitiveFor,\n unresolvedBodyNodeSchema,\n validateWithSchema,\n} from './primitive_module';\nexport {\n type SlackAssetCollector,\n type SlackAssetRequest,\n} from './slack_assets';\nexport {\n type SlackActionElement,\n type SlackActionsBlock,\n type SlackBlock,\n type SlackButtonElement,\n type SlackCheckboxesElement,\n type SlackContextBlock,\n type SlackDividerBlock,\n type SlackFileReference,\n type SlackHeaderBlock,\n type SlackHeaderLevel,\n type SlackImageBlock,\n type SlackImageElement,\n type SlackMrkdwnTextObject,\n type SlackMultiStaticSelectElement,\n type SlackOptionGroup,\n type SlackOptionObject,\n type SlackOverflowElement,\n type SlackPlainTextObject,\n type SlackRadioButtonsElement,\n type SlackRawTextElement,\n type SlackRichTextBlock,\n type SlackRichTextBlockElement,\n type SlackRichTextInline,\n type SlackRichTextLink,\n type SlackRichTextList,\n type SlackRichTextPreformatted,\n type SlackRichTextQuote,\n type SlackRichTextSection,\n type SlackRichTextStyle,\n type SlackRichTextTag,\n type SlackRichTextText,\n type SlackSectionAccessory,\n type SlackSectionBlock,\n type SlackStaticSelectElement,\n type SlackTableBlock,\n type SlackTableCell,\n type SlackTableColumnSetting,\n type SlackTagColor,\n type SlackTextObject,\n type SlackVideoBlock,\n} from './slack_blocks';\nexport { declaredFieldsNote, formatZodIssues } from './zod_format';\nexport { requiredString, z } from './zod_helpers';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/define/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iCAUiB;AADf,kGAAA,SAAS,OAAA;AAQX,yDAM6B;AAF3B,iHAAA,YAAY,OAAA;AACZ,sHAAA,iBAAiB,OAAA;AAEnB,mDAAiE;AAApC,2GAAA,SAAS,OAAA;AACtC,uDA8B4B;AAP1B,qHAAA,iBAAiB,OAAA;AACjB,oHAAA,gBAAgB,OAAA;AAChB,0HAAA,sBAAsB,OAAA;AACtB,mHAAA,eAAe,OAAA;AACf,sHAAA,kBAAkB,OAAA;AAClB,4HAAA,wBAAwB,OAAA;AACxB,sHAAA,kBAAkB,OAAA;AAkDpB,2CAAmE;AAA1D,gHAAA,kBAAkB,OAAA;AAAE,6GAAA,eAAe,OAAA;AAC5C,6CAAkD;AAAzC,6GAAA,cAAc,OAAA;AAAE,gGAAA,CAAC,OAAA","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 {\n type BoundFrame,\n type Frame,\n type FrameBody,\n type FrameComposition,\n type FrameDispatcher,\n type FrameHeader,\n type FrameViewport,\n type ThemePair,\n bindFrame,\n} from './frame';\nexport {\n type MarkdownBlock,\n type MarkdownContent,\n type MarkdownInline,\n type MarkdownInlineInput,\n} from './markdown_content';\nexport {\n type ExampleNode,\n type NormalizedPrimitiveExample,\n type PrimitiveExample,\n exampleNodes,\n primitiveExamples,\n} from './primitive_example';\nexport { type PrimitiveIcon, ICON_VARS } from './primitive_icon';\nexport {\n type AnyPrimitiveDefinition,\n type DefaultPackTypes,\n type OptionalSurface,\n type PackTypes,\n type PrimitiveCatalogEntry,\n type PrimitiveChildRef,\n type PrimitiveDefinition,\n type PrimitiveMetrics,\n type PrimitiveNode,\n type PrimitiveRenderContext,\n type PrimitiveSchema,\n type PrimitiveStyleCollectionContext,\n type PrimitiveStyleCollector,\n type ReactContextArg,\n type Renderer,\n type Renderers,\n type RenderScope,\n type StyledRenderContext,\n type StyleHandle,\n type SurfaceMap,\n type ThemeTokenPath,\n type WithNodeFields,\n OPTIONAL_SURFACES,\n bodyNodeIdSchema,\n bodyNodeSurfacesSchema,\n definePrimitive,\n definePrimitiveFor,\n unresolvedBodyNodeSchema,\n validateWithSchema,\n} from './primitive_module';\nexport {\n type SlackAssetCollector,\n type SlackAssetRequest,\n} from './slack_assets';\nexport {\n type SlackActionElement,\n type SlackActionsBlock,\n type SlackBlock,\n type SlackButtonElement,\n type SlackCheckboxesElement,\n type SlackContainerBlock,\n type SlackContainerChildBlock,\n type SlackContextBlock,\n type SlackDividerBlock,\n type SlackFileReference,\n type SlackHeaderBlock,\n type SlackHeaderLevel,\n type SlackImageBlock,\n type SlackImageElement,\n type SlackMrkdwnTextObject,\n type SlackMultiStaticSelectElement,\n type SlackOptionGroup,\n type SlackOptionObject,\n type SlackOverflowElement,\n type SlackPlainTextObject,\n type SlackRadioButtonsElement,\n type SlackRawTextElement,\n type SlackRichTextBlock,\n type SlackRichTextBlockElement,\n type SlackRichTextInline,\n type SlackRichTextLink,\n type SlackRichTextList,\n type SlackRichTextPreformatted,\n type SlackRichTextQuote,\n type SlackRichTextSection,\n type SlackRichTextStyle,\n type SlackRichTextTag,\n type SlackRichTextText,\n type SlackSectionAccessory,\n type SlackSectionBlock,\n type SlackStaticSelectElement,\n type SlackTableBlock,\n type SlackTableCell,\n type SlackTableColumnSetting,\n type SlackTagColor,\n type SlackTextObject,\n type SlackVideoBlock,\n} from './slack_blocks';\nexport { declaredFieldsNote, formatZodIssues } from './zod_format';\nexport { requiredString, z } from './zod_helpers';\n"]}
@@ -62,10 +62,14 @@ exports.unresolvedBodyNodeSchema = zod_1.z.looseObject({
62
62
  * {@link PackTypes}, so each primitive names only `TNode`.
63
63
  */
64
64
  const definePrimitive = (definition) => {
65
- const { schemaFor } = definition;
65
+ const { schemaFor, schema, catalog } = definition;
66
+ const described = catalog.description === undefined ? schema.description : undefined;
66
67
  return {
67
68
  ...definition,
68
- schema: withNodeFields(definition.schema),
69
+ ...(described === undefined
70
+ ? {}
71
+ : { catalog: { ...catalog, description: described } }),
72
+ schema: withNodeFields(schema),
69
73
  // Both forms get the node fields, or a container would accept `id` and
70
74
  // `surfaces` standalone and reject them inside a composition.
71
75
  ...(schemaFor
@@ -98,11 +102,13 @@ const NODE_FIELDS = {
98
102
  const isNodeField = (schema) => {
99
103
  let current = schema;
100
104
  while (current && typeof current === 'object') {
101
- if (Object.hasOwn(current, NODE_FIELD))
105
+ if (Object.hasOwn(current, NODE_FIELD)) {
102
106
  return true;
107
+ }
103
108
  const { def } = current;
104
- if (def?.type !== 'optional')
109
+ if (def?.type !== 'optional') {
105
110
  return false;
111
+ }
106
112
  current = def.innerType;
107
113
  }
108
114
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"primitive_module.js","sourceRoot":"","sources":["../../../src/define/primitive_module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6BAAsD;AAGtD,kEAIuC;AACvC,gDAAuE;AASvE,6CAAsD;AACtD,+CAA+C;AAgP/C;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG;IAC/B,OAAO;CACkC,CAAC;AAwL5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AAQ,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAC5C,CAAC,KAAK,EAAE,EAAE,CACR,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAC1E,CAAC;IACF,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,IAAI,mBAAW,CACnB,0BAAkB,CAAC,mBAAmB,EACtC,wDAAwD,QAAQ,6BAA6B,CAC9F,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,CACL,MAAM,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CACtC,CAAC;AAC/B,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\nimport type { ReactNode } from 'react';\nimport { z, type ZodObject, type ZodType } from 'zod';\n\nimport type { ActionEventRef } from '../composition/action_event';\nimport {\n type ChildNodeRef,\n SURFACE_NAMES,\n type SurfaceName,\n} from '../composition/body_node_base';\nimport { ISOMER_ERROR_CODES, IsomerError } from '../composition/error';\nimport type { PrimitiveNode } from '../composition/node';\nimport type { ValidationError } from '../composition/validation_error';\n\nimport type { MarkdownContent } from './markdown_content';\nimport type { PrimitiveExample } from './primitive_example';\nimport type { PrimitiveIcon } from './primitive_icon';\nimport type { SlackAssetCollector } from './slack_assets';\nimport type { SlackBlock } from './slack_blocks';\nimport { formatZodIssues, oneOf } from './zod_format';\nimport { requiredString } from './zod_helpers';\n\nexport type { PrimitiveNode };\n\n/**\n * A primitive's entry in the catalog the authoring prompt is built from.\n *\n * Written for the model rather than for a developer: `useWhen` and `avoidWhen`\n * are what steer it away from reaching for the wrong primitive. `name` is the\n * one host-facing field, and the prompt never prints it.\n */\nexport interface PrimitiveCatalogEntry {\n type: string;\n /** Short name a host shows for the primitive, e.g. `Stat group`. Absent means the host derives one from `type`. */\n name?: string;\n /** One line on what the primitive is for, in the model's voice. */\n purpose: string;\n /** Situations that call for this primitive. Phrase each as a user intent, not a shape. */\n useWhen: string[];\n /** Situations that look like a fit but are not, naming the primitive to reach for instead. */\n avoidWhen: string[];\n /** A node literal the authoring prompt inlines under this primitive. */\n example: unknown;\n}\n\n/** A style a renderer asks for by name, resolved to a class by the host's adapter. */\nexport interface StyleHandle {\n /** Stable lookup key. The adapter's map is keyed on this. */\n key: string;\n /** Debug-facing label, which an adapter may fold into a generated class name. */\n readableName: string;\n}\n\n/** Dotted path into a pack's theme tokens, e.g. `colors.text.subdued`. */\nexport type ThemeTokenPath = string;\n\n/**\n * The sdk's own render context, and {@link DefaultPackTypes.context}.\n *\n * A pack with real theme tokens or a richer style-handle type declares its\n * own context in its {@link PackTypes}; {@link StyledRenderContext} is the\n * sdk's own extension. The bag is what lets a pack narrow without\n * re-declaring everything that mentions a context.\n */\nexport interface PrimitiveRenderContext {\n /**\n * The progressive enhancements this render may assume, by id. A set rather\n * than a field per feature so adding an enhancement costs no plumbing:\n * containers forward the whole context, and a renderer asks\n * `context.enhancements?.has('tableSort')`.\n *\n * Empty or absent is the baseline every host can render, so a renderer must\n * still answer the question on its own. See `docs/rendering.md`.\n */\n enhancements?: ReadonlySet<string>;\n /** Turns on `nodeAnchor` outside an HTML surface render, on the React and `snapshot` surfaces; inside one, the surface decides. */\n anchors?: boolean;\n /** Raises an interaction for the host to route. Absent means render non-interactively. */\n onEvent?: (event: ActionEventRef) => void;\n}\n\n/**\n * The render-context argument, optional only when omitting it is sound.\n *\n * The sdk's own {@link PrimitiveRenderContext} has no required field, so `{}`\n * is a complete value and a caller may leave it out. A pack that narrows the\n * context with a required member makes the argument mandatory.\n */\nexport type ReactContextArg<TContext> =\n Record<string, never> extends TContext\n ? [context?: TContext]\n : [context: TContext];\n\n/**\n * {@link PrimitiveRenderContext} plus the CSS-in-JS hooks an HTML style adapter\n * supplies. A pack that styles differently uses its own `TContext` instead.\n */\nexport interface StyledRenderContext extends PrimitiveRenderContext {\n /** Resolves handles to a `className`. Absent means the host supplies no styling. */\n resolveClassName?: (...handles: StyleHandle[]) => string;\n /** Resolves a theme token to a CSS variable reference. Absent means inline the literal value. */\n cssVarRef?: (path: ThemeTokenPath) => `var(--${string})`;\n}\n\n/** Passed to a primitive's style collector so it can vary CSS by layout mode. */\nexport interface PrimitiveStyleCollectionContext {\n /** The render fills its container rather than sitting at a fixed width. */\n fluid?: boolean;\n}\n\n/** A pack's collected styles, opaque to the SDK. */\nexport type PrimitiveStyleCollector = object;\n\n/**\n * The types a pack binds once and writes every primitive against: the palette\n * its frames supply, the context its `react` renderers receive, the collector\n * its `collectStyles` hooks mutate, and the Slack payload and collector types.\n *\n * Extend {@link DefaultPackTypes} and narrow only what the pack needs:\n *\n * ```ts\n * interface SlidesPackTypes extends DefaultPackTypes {\n * theme: SlideTheme;\n * context: SlideRenderContext;\n * }\n * ```\n */\nexport interface PackTypes {\n theme: unknown;\n context: unknown;\n collector: PrimitiveStyleCollector;\n slackBlock: unknown;\n slackCollector: unknown;\n}\n\n/** {@link PackTypes} as the sdk itself binds them, and the default everywhere. */\nexport interface DefaultPackTypes extends PackTypes {\n theme: unknown;\n context: PrimitiveRenderContext;\n collector: PrimitiveStyleCollector;\n slackBlock: SlackBlock;\n slackCollector: SlackAssetCollector;\n}\n\n/**\n * Each surface's renderer signature: the env bag it receives beyond the node,\n * and what it returns.\n *\n * Written out per surface rather than derived through an indexed access. A bag\n * is additive: a new extra on a surface is not an arity break. {@link Renderer}\n * indexes this table for the dispatcher cast; {@link Renderers} does not.\n */\nexport interface SurfaceMap<T extends PackTypes = DefaultPackTypes> {\n react: {\n env: {\n context: T['context'];\n scope: RenderScope<T>;\n /**\n * The frame's resolved palette, when this render is reached through the\n * `snapshot` surface. A bare `react`/`html` render has no {@link Frame} to\n * resolve one from, so it is absent there — a pack that needs a\n * literal color outside `snapshot` still goes through `context`.\n */\n theme?: T['theme'];\n };\n output: ReactNode;\n };\n /**\n * Identical to `react`, and served by the same renderer: an image backend\n * lays out the pack's DOM tree and stylesheet rather than a second tree\n * authored for it. The surface stays separate so a node can be hidden from\n * snapshots alone, and so a {@link Frame} has something to draw inside.\n */\n snapshot: {\n env: {\n context: T['context'];\n scope: RenderScope<T>;\n /** The frame's resolved palette for this render's mode; see `react.env.theme`. */\n theme?: T['theme'];\n };\n output: ReactNode;\n };\n text: {\n env: {\n scope: RenderScope<T>;\n };\n output: string;\n };\n /** Content built with `md`, escaped where it lands; authored Markdown source goes through `md.authored`. */\n markdown: {\n env: {\n scope: RenderScope<T>;\n };\n output: MarkdownContent;\n };\n /**\n * Returns one payload or several, so a primitive need not wrap a single\n * payload in an array.\n */\n slack: {\n env: {\n collector?: T['slackCollector'];\n scope: RenderScope<T>;\n };\n output: T['slackBlock'] | readonly T['slackBlock'][];\n };\n}\n\n/**\n * The dispatcher a renderer is given so a container can recurse into a child\n * owned by another pack. Erased to {@link PrimitiveNode}: a heterogeneous\n * inventory has no single node type to name.\n *\n * Passed as `scope` on every renderer's env bag. The dispatcher's own named\n * methods stay positional.\n */\nexport interface RenderScope<T extends PackTypes = DefaultPackTypes> {\n readonly definitions: readonly AnyPrimitiveDefinition[];\n /** Throws for an unknown node type; a missing primitive is a bug, not a degradation. */\n getDefinition(node: PrimitiveNode): AnyPrimitiveDefinition;\n /** `undefined` when the node is hidden from `surface`, `sanitize` drops it, or its primitive declares no renderer for `surface`. */\n renderOn<S extends SurfaceName>(\n surface: S,\n node: PrimitiveNode,\n extras: Omit<SurfaceMap<T>[S]['env'], 'scope'>\n ): SurfaceMap<T>[S]['output'] | undefined;\n renderReact(node: PrimitiveNode, context?: T['context']): ReactNode;\n collectStyles(\n node: PrimitiveNode,\n styles: PrimitiveStyleCollector,\n context: PrimitiveStyleCollectionContext\n ): void;\n renderText(node: PrimitiveNode): string;\n renderMarkdown(node: PrimitiveNode): string;\n /** A child as content, for a container building with `md`. */\n renderMarkdownContent(node: PrimitiveNode): MarkdownContent;\n /** Empty when the node is hidden from `slack`, `sanitize` drops it, or its renderer returns nothing; a node with no `slack` renderer degrades through its markdown. */\n renderSlack(\n node: PrimitiveNode,\n collector?: T['slackCollector']\n ): readonly T['slackBlock'][];\n /** `0` when the node is hidden from `snapshot` or its primitive declares no `metrics.snapshotHeight`. */\n estimateSnapshotHeight(node: PrimitiveNode): number;\n /** Appends schema failures under `path` to `errors`, each naming `node`'s type. */\n validate(node: PrimitiveNode, path: string, errors: ValidationError[]): void;\n}\n\n/**\n * One surface's renderer for one node type, per {@link SurfaceMap}.\n *\n * Indexes the env bag. Do not use this to type the renderers map: the\n * written-out signatures on {@link Renderers} are what keep the bags checked\n * per surface.\n */\nexport type Renderer<\n TNode extends PrimitiveNode,\n S extends SurfaceName,\n T extends PackTypes = DefaultPackTypes,\n> = (node: TNode, env: SurfaceMap<T>[S]['env']) => SurfaceMap<T>[S]['output'];\n\n/**\n * The surface a pack may declare beyond the mandatory three.\n *\n * Only `slack`, and even that stays optional per primitive: the dispatcher\n * converts the mandatory markdown to Block Kit, so a missing Slack renderer\n * degrades rather than disappearing. `snapshot` is not here because no primitive\n * implements it — the surface reuses `react`.\n */\nexport const OPTIONAL_SURFACES = [\n 'slack',\n] as const satisfies readonly SurfaceName[];\n\n/** One of the {@link OPTIONAL_SURFACES}. */\nexport type OptionalSurface = (typeof OPTIONAL_SURFACES)[number];\n\n/**\n * One renderer per surface a primitive implements.\n *\n * `react`, `text`, and `markdown` are always required: those three are what\n * make \"every composition degrades\" true. `react` serves the `snapshot` surface\n * too, so targeting images costs a primitive nothing.\n *\n * `slack` is declared method-style deliberately: method parameters are checked\n * bivariantly, which is what lets a pack narrow the collector's node type.\n */\nexport interface Renderers<\n TNode extends PrimitiveNode,\n T extends PackTypes = DefaultPackTypes,\n> {\n react(\n node: TNode,\n env: {\n context: T['context'];\n scope: RenderScope<T>;\n /** See {@link SurfaceMap.react}'s `env.theme`. */\n theme?: T['theme'];\n }\n ): ReactNode;\n text(\n node: TNode,\n env: {\n scope: RenderScope<T>;\n }\n ): string;\n markdown(\n node: TNode,\n env: {\n scope: RenderScope<T>;\n }\n ): MarkdownContent;\n slack?(\n node: TNode,\n env: {\n collector?: T['slackCollector'];\n scope: RenderScope<T>;\n }\n ): T['slackBlock'] | readonly T['slackBlock'][];\n}\n\n/**\n * Measurements a frame can ask of a node before drawing it.\n *\n * `snapshotHeight` is optional. The height estimate is `0` when it is missing, so\n * a frame that sums node heights sizes short.\n */\nexport interface PrimitiveMetrics<TNode extends PrimitiveNode> {\n /** The node's drawn height in pixels at the frame's width. */\n snapshotHeight?: (node: TNode) => number;\n}\n\n/**\n * Every primitive's schema is an object schema, because {@link definePrimitive}\n * extends it with `id` and `surfaces` and the composition builds a\n * `z.discriminatedUnion('type', …)` over them. Typed as `ZodObject` rather\n * than `ZodType<unknown>` so a union or intersection schema is a compile\n * error at the definition, not a runtime failure at the first `.extend()`.\n * Zod 4 types `z.object().superRefine(…)` as a `ZodObject` and preserves the\n * refinement through `.extend()`, so top-level refinements are unaffected.\n */\nexport type PrimitiveSchema = ZodObject;\n\n/**\n * The child-ref shape a primitive definition's own `children` returns.\n *\n * {@link ChildNodeRef} stays erased (`node: unknown`) because\n * `createChildNodeWalker` mixes children from every primitive type in the\n * runtime into one map and cannot name a single node type for them. A single\n * definition has no such excuse: its `children` should not type-check\n * against `unknown` and let something that is not a {@link PrimitiveNode} —\n * `null`, for instance — silently disappear from every tree walk.\n */\nexport interface PrimitiveChildRef extends ChildNodeRef {\n node: PrimitiveNode;\n}\n\n/**\n * One primitive: its node type, schema, catalog entry, and a renderer per\n * surface. The unit of vocabulary, and what {@link definePrimitive} takes.\n *\n * `T` is the pack's {@link PackTypes}, bound once with\n * {@link definePrimitiveFor} so each primitive names only `TNode`.\n */\nexport interface PrimitiveDefinition<\n TNode extends PrimitiveNode,\n T extends PackTypes = DefaultPackTypes,\n TSchema extends PrimitiveSchema = PrimitiveSchema,\n> {\n /** The node's discriminant, and the key this primitive occupies in an inventory. */\n type: TNode['type'];\n /** How the authoring prompt describes this primitive to the model. */\n catalog: PrimitiveCatalogEntry;\n /** Host-facing glyph, never shown to the model. Absent means the host supplies its own. */\n icon?: PrimitiveIcon;\n /**\n * Driven by the conformance harness, bare or named; read them with\n * `exampleNodes` or `primitiveExamples`. The catalog `example` is what the\n * prompt shows.\n */\n examples: readonly (TNode | PrimitiveExample<TNode>)[];\n /**\n * This primitive on its own. A container declares\n * {@link PrimitiveDefinition.schemaFor} as well, and uses\n * {@link unresolvedBodyNodeSchema} in the child slot here.\n */\n schema: TSchema;\n /**\n * A container's schema, bound to the body-node union of the composition it is\n * being built into.\n *\n * Declaring the shape and letting each composition supply its own union is\n * what lets one primitive appear in two runtimes with different inventories:\n * `z.lazy` memoizes per instance, and an instance built here belongs to\n * exactly one union.\n */\n schemaFor?: (bodyNodeSchema: ZodType<unknown>) => PrimitiveSchema;\n /** One function per surface; `react` serves `snapshot` as well. */\n renderers: Renderers<TNode, T>;\n /** Sizing a frame can ask for before drawing. Absent means it cannot be measured. */\n metrics?: PrimitiveMetrics<TNode>;\n /**\n * Render-time URL trust, the second of the two layers in `validate/url.ts`.\n *\n * Returning `null` drops the node. Applied even to an unvalidated node, so a\n * renderer invoked directly still cannot emit an unsafe URL.\n */\n sanitize?: (node: TNode) => TNode | null;\n /**\n * Nested nodes, for containers, in the order the `react` renderer draws\n * them; `findNodeElementPairs` relies on it. Absent means a leaf.\n */\n children?: (node: TNode) => readonly PrimitiveChildRef[];\n /**\n * True when this node produces surface output of its own, not only via\n * {@link PrimitiveDefinition.children}. A non-empty `children` result is\n * otherwise the complete source of rendered content, so a hybrid container\n * that still owns string fields returns true to keep rendering when every\n * nested node is hidden from the surface.\n */\n hasOwnContent?: (node: TNode) => boolean;\n /** Contributes this node's CSS by mutating `styles`, once per node per render. */\n collectStyles?: (\n node: TNode,\n env: { styles: T['collector']; context: PrimitiveStyleCollectionContext }\n ) => void;\n}\n\n/**\n * {@link PrimitiveDefinition} with every type parameter erased, and the form an\n * inventory is stored in.\n *\n * A heterogeneous pack has no single `TNode` to be generic over, so the\n * renderers degrade to `unknown` here.\n *\n * Each field carries the same contract as its {@link PrimitiveDefinition}\n * counterpart; only the types are erased.\n */\nexport interface AnyPrimitiveDefinition {\n type: string;\n catalog: PrimitiveCatalogEntry;\n icon?: PrimitiveIcon;\n examples: readonly (PrimitiveNode | PrimitiveExample)[];\n schema: PrimitiveSchema;\n schemaFor?: (bodyNodeSchema: ZodType<unknown>) => PrimitiveSchema;\n renderers: Record<'react' | 'text' | 'markdown', unknown> &\n Partial<Record<'slack', unknown>>;\n metrics?: {\n snapshotHeight?: unknown;\n };\n sanitize?: unknown;\n children?: unknown;\n hasOwnContent?: unknown;\n collectStyles?: unknown;\n}\n\n/** Parses `node` against `schema`, appending path-prefixed messages to `errors`. */\nexport const validateWithSchema = (\n schema: PrimitiveSchema,\n node: unknown,\n path: string,\n errors: ValidationError[]\n): void => {\n const result = schema.safeParse(node, { reportInput: true });\n if (!result.success) {\n errors.push(...formatZodIssues(result.error.issues, path));\n }\n};\n\n/** The `id` every node may carry, unique within a composition. */\nexport const bodyNodeIdSchema = requiredString('must be a non-empty string');\n\n/** The `surfaces` allowlist on a node. Absent means every surface; empty is rejected. */\nexport const bodyNodeSurfacesSchema = z\n .array(\n z.enum(SURFACE_NAMES, {\n error: () => oneOf(SURFACE_NAMES),\n })\n )\n .min(1, { error: 'must contain at least one surface' });\n\n/**\n * The child slot in a container's standalone {@link PrimitiveDefinition.schema},\n * where no body-node union is available.\n *\n * Deliberately permissive rather than `z.unknown()`: it still rejects a child\n * that is not a node at all, which is the error worth catching without an\n * inventory. Anything that depends on *which* types are legal — the validator,\n * the parser, the JSON Schema projection — goes through\n * {@link PrimitiveDefinition.schemaFor} and sees the real union.\n */\nexport const unresolvedBodyNodeSchema = z.looseObject({\n type: requiredString('must be a non-empty string'),\n});\n\n/**\n * Declares one primitive, extending its schema with the `id` and `surfaces`\n * fields every node carries, and closing it to unknown keys so a node is held\n * to the same rule as the composition root and the JSON Schema an agent reads.\n * A schema with its own catchall (`z.looseObject`) keeps it.\n *\n * A pack normally calls the form {@link definePrimitiveFor} binds to its own\n * {@link PackTypes}, so each primitive names only `TNode`.\n */\nexport const definePrimitive = <\n TNode extends PrimitiveNode,\n T extends PackTypes = DefaultPackTypes,\n TSchema extends PrimitiveSchema = PrimitiveSchema,\n>(\n definition: PrimitiveDefinition<TNode, T, TSchema>\n): PrimitiveDefinition<TNode, T, WithNodeFields<TSchema>> => {\n const { schemaFor } = definition;\n return {\n ...definition,\n schema: withNodeFields(definition.schema),\n // Both forms get the node fields, or a container would accept `id` and\n // `surfaces` standalone and reject them inside a composition.\n ...(schemaFor\n ? {\n schemaFor: (bodyNodeSchema: ZodType<unknown>) =>\n withNodeFields(schemaFor(bodyNodeSchema)),\n }\n : {}),\n };\n};\n\n/**\n * {@link definePrimitive} bound to one pack's {@link PackTypes}.\n *\n * ```ts\n * const define = definePrimitiveFor<SlidesPackTypes>();\n * export const note = define({ type: 'note', … });\n * ```\n */\nexport const definePrimitiveFor =\n <T extends PackTypes>() =>\n <\n TNode extends PrimitiveNode,\n TSchema extends PrimitiveSchema = PrimitiveSchema,\n >(\n definition: PrimitiveDefinition<TNode, T, TSchema>\n ): PrimitiveDefinition<TNode, T, WithNodeFields<TSchema>> =>\n definePrimitive<TNode, T, TSchema>(definition);\n\n/**\n * `.extend()` on a generic `ZodObject` widens the shape to `any`, so the\n * return type is rebuilt from `TSchema`'s shape. The brand on a field schema\n * stays on that same object at runtime.\n */\nexport type WithNodeFields<TSchema extends PrimitiveSchema> =\n TSchema extends ZodObject<infer Shape>\n ? ZodObject<\n Shape & {\n id: ReturnType<typeof bodyNodeIdSchema.optional>;\n surfaces: ReturnType<typeof bodyNodeSurfacesSchema.optional>;\n }\n >\n : PrimitiveSchema;\n\n// Marks the field schemas `definePrimitive` adds. A schema derived from a\n// defined one shares them by reference, and `Symbol.for` matches across ESM and\n// CommonJS copies of the SDK.\nconst NODE_FIELD = Symbol.for('elastic.isomer.node_field');\n\nconst nodeField = <T extends ZodType>(schema: T): T =>\n Object.defineProperty(schema, NODE_FIELD, { value: true });\n\nconst NODE_FIELDS = {\n id: nodeField(bodyNodeIdSchema.optional()),\n surfaces: nodeField(bodyNodeSurfacesSchema.optional()),\n};\n\nconst isNodeField = (schema: unknown): boolean => {\n let current = schema;\n while (current && typeof current === 'object') {\n if (Object.hasOwn(current, NODE_FIELD)) return true;\n const { def } = current as {\n def?: { type?: string; innerType?: unknown };\n };\n if (def?.type !== 'optional') return false;\n current = def.innerType;\n }\n return false;\n};\n\nconst withNodeFields = <TSchema extends PrimitiveSchema>(\n schema: TSchema\n): WithNodeFields<TSchema> => {\n const reserved = Object.keys(NODE_FIELDS).find(\n (field) =>\n Object.hasOwn(schema.shape, field) && !isNodeField(schema.shape[field])\n );\n if (reserved) {\n throw new IsomerError(\n ISOMER_ERROR_CODES.RESERVED_NODE_FIELD,\n `definePrimitive: a primitive schema cannot declare \\`${reserved}\\`; every body node has it.`\n );\n }\n const extended = schema.extend(NODE_FIELDS);\n return (\n schema.def.catchall === undefined ? extended.strict() : extended\n ) as WithNodeFields<TSchema>;\n};\n"]}
1
+ {"version":3,"file":"primitive_module.js","sourceRoot":"","sources":["../../../src/define/primitive_module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6BAAsD;AAGtD,kEAIuC;AACvC,gDAAuE;AASvE,6CAAsD;AACtD,+CAA+C;AA2P/C;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG;IAC/B,OAAO;CACkC,CAAC;AAyL5C,oFAAoF;AAC7E,MAAM,kBAAkB,GAAG,CAChC,MAAuB,EACvB,IAAa,EACb,IAAY,EAC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OAEf,CAAC;QACF,IAAI,GAAG,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACrB,MAAe,EACU,EAAE;IAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAC5C,CAAC,KAAK,EAAE,EAAE,CACR,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAC1E,CAAC;IACF,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,IAAI,mBAAW,CACnB,0BAAkB,CAAC,mBAAmB,EACtC,wDAAwD,QAAQ,6BAA6B,CAC9F,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,CACL,MAAM,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CACtC,CAAC;AAC/B,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\nimport type { ReactNode } from 'react';\nimport { z, type ZodObject, type ZodType } from 'zod';\n\nimport type { ActionEventRef } from '../composition/action_event';\nimport {\n type ChildNodeRef,\n SURFACE_NAMES,\n type SurfaceName,\n} from '../composition/body_node_base';\nimport { ISOMER_ERROR_CODES, IsomerError } from '../composition/error';\nimport type { PrimitiveNode } from '../composition/node';\nimport type { ValidationError } from '../composition/validation_error';\n\nimport type { MarkdownContent } from './markdown_content';\nimport type { PrimitiveExample } from './primitive_example';\nimport type { PrimitiveIcon } from './primitive_icon';\nimport type { SlackAssetCollector } from './slack_assets';\nimport type { SlackBlock } from './slack_blocks';\nimport { formatZodIssues, oneOf } from './zod_format';\nimport { requiredString } from './zod_helpers';\n\nexport type { PrimitiveNode };\n\n/**\n * A primitive's entry in the catalog the authoring prompt is built from.\n *\n * Written for the model rather than for a developer: `useWhen` and `avoidWhen`\n * are what steer it away from reaching for the wrong primitive. `name` is the\n * one host-facing field, and the prompt never prints it.\n */\nexport interface PrimitiveCatalogEntry {\n type: string;\n /** Short name a host shows for the primitive, e.g. `Stat group`. Absent means the host derives one from `type`. */\n name?: string;\n /**\n * Description of this primitive's `$def` in the authoring JSON Schema.\n *\n * `z.toJSONSchema` drops refinements, so a cross-field rule is restated here.\n * {@link definePrimitive} copies `schema.description` when this is omitted.\n */\n description?: string;\n /** One line on what the primitive is for, in the model's voice. */\n purpose: string;\n /** Situations that call for this primitive. Phrase each as a user intent, not a shape. */\n useWhen: string[];\n /** Situations that look like a fit but are not, naming the primitive to reach for instead. */\n avoidWhen: string[];\n /** A node literal the authoring prompt inlines under this primitive. */\n example: unknown;\n}\n\n/** A style a renderer asks for by name, resolved to a class by the host's adapter. */\nexport interface StyleHandle {\n /** Stable lookup key. The adapter's map is keyed on this. */\n key: string;\n /** Debug-facing label, which an adapter may fold into a generated class name. */\n readableName: string;\n}\n\n/** Dotted path into a pack's theme tokens, e.g. `colors.text.subdued`. */\nexport type ThemeTokenPath = string;\n\n/**\n * The sdk's own render context, and {@link DefaultPackTypes.context}.\n *\n * A pack with real theme tokens or a richer style-handle type declares its\n * own context in its {@link PackTypes}; {@link StyledRenderContext} is the\n * sdk's own extension. The bag is what lets a pack narrow without\n * re-declaring everything that mentions a context.\n */\nexport interface PrimitiveRenderContext {\n /**\n * The progressive enhancements this render may assume, by id. A set rather\n * than a field per feature so adding an enhancement costs no plumbing:\n * containers forward the whole context, and a renderer asks\n * `context.enhancements?.has('tableSort')`.\n *\n * Empty or absent is the baseline every host can render, so a renderer must\n * still answer the question on its own. See `docs/rendering.md`.\n */\n enhancements?: ReadonlySet<string>;\n /** Turns on `nodeAnchor` outside an HTML surface render, on the React and `snapshot` surfaces; inside one, the surface decides. */\n anchors?: boolean;\n /** Raises an interaction for the host to route. Absent means render non-interactively. */\n onEvent?: (event: ActionEventRef) => void;\n}\n\n/**\n * The render-context argument, optional only when omitting it is sound.\n *\n * The sdk's own {@link PrimitiveRenderContext} has no required field, so `{}`\n * is a complete value and a caller may leave it out. A pack that narrows the\n * context with a required member makes the argument mandatory.\n */\nexport type ReactContextArg<TContext> =\n Record<string, never> extends TContext\n ? [context?: TContext]\n : [context: TContext];\n\n/**\n * {@link PrimitiveRenderContext} plus the CSS-in-JS hooks an HTML style adapter\n * supplies. A pack that styles differently uses its own `TContext` instead.\n */\nexport interface StyledRenderContext extends PrimitiveRenderContext {\n /** Resolves handles to a `className`. Absent means the host supplies no styling. */\n resolveClassName?: (...handles: StyleHandle[]) => string;\n /** Resolves a theme token to a CSS variable reference. Absent means inline the literal value. */\n cssVarRef?: (path: ThemeTokenPath) => `var(--${string})`;\n}\n\n/** Passed to a primitive's style collector so it can vary CSS by layout mode. */\nexport interface PrimitiveStyleCollectionContext {\n /** The render fills its container rather than sitting at a fixed width. */\n fluid?: boolean;\n}\n\n/** A pack's collected styles, opaque to the SDK. */\nexport type PrimitiveStyleCollector = object;\n\n/**\n * The types a pack binds once and writes every primitive against: the palette\n * its frames supply, the context its `react` renderers receive, the collector\n * its `collectStyles` hooks mutate, and the Slack payload and collector types.\n *\n * Extend {@link DefaultPackTypes} and narrow only what the pack needs:\n *\n * ```ts\n * interface SlidesPackTypes extends DefaultPackTypes {\n * theme: SlideTheme;\n * context: SlideRenderContext;\n * }\n * ```\n */\nexport interface PackTypes {\n theme: unknown;\n context: unknown;\n collector: PrimitiveStyleCollector;\n slackBlock: unknown;\n slackCollector: unknown;\n}\n\n/** {@link PackTypes} as the sdk itself binds them, and the default everywhere. */\nexport interface DefaultPackTypes extends PackTypes {\n theme: unknown;\n context: PrimitiveRenderContext;\n collector: PrimitiveStyleCollector;\n slackBlock: SlackBlock;\n slackCollector: SlackAssetCollector;\n}\n\n/**\n * Each surface's renderer signature: the env bag it receives beyond the node,\n * and what it returns.\n *\n * Written out per surface rather than derived through an indexed access. A bag\n * is additive: a new extra on a surface is not an arity break. {@link Renderer}\n * indexes this table for the dispatcher cast; {@link Renderers} does not.\n */\nexport interface SurfaceMap<T extends PackTypes = DefaultPackTypes> {\n react: {\n env: {\n context: T['context'];\n scope: RenderScope<T>;\n /**\n * The frame's resolved palette, inherited by descendants on `snapshot`.\n * Bare `react`/`html` renders leave it absent; browser colors follow CSS.\n */\n theme?: T['theme'];\n };\n output: ReactNode;\n };\n /**\n * Identical to `react`, and served by the same renderer: an image backend\n * lays out the pack's DOM tree and stylesheet rather than a second tree\n * authored for it. The surface stays separate so a node can be hidden from\n * snapshots alone, and so a {@link Frame} has something to draw inside.\n */\n snapshot: {\n env: {\n context: T['context'];\n scope: RenderScope<T>;\n /** The frame's resolved palette for this render's mode; see `react.env.theme`. */\n theme?: T['theme'];\n };\n output: ReactNode;\n };\n text: {\n env: {\n scope: RenderScope<T>;\n };\n output: string;\n };\n /** Content built with `md`, escaped where it lands; authored Markdown source goes through `md.authored`. */\n markdown: {\n env: {\n scope: RenderScope<T>;\n };\n output: MarkdownContent;\n };\n /**\n * Returns one payload or several, so a primitive need not wrap a single\n * payload in an array.\n */\n slack: {\n env: {\n collector?: T['slackCollector'];\n /** The host's absolute `http(s)` base for relative links; pass it to `slackLinkUrl` and `link`. `scope` already carries it to children. */\n baseUrl?: string;\n scope: RenderScope<T>;\n };\n output: T['slackBlock'] | readonly T['slackBlock'][];\n };\n}\n\n/**\n * The dispatcher a renderer is given so a container can recurse into a child\n * owned by another pack. Erased to {@link PrimitiveNode}: a heterogeneous\n * inventory has no single node type to name.\n *\n * Passed as `scope` on every renderer's env bag. The dispatcher's own named\n * methods stay positional.\n */\nexport interface RenderScope<T extends PackTypes = DefaultPackTypes> {\n readonly definitions: readonly AnyPrimitiveDefinition[];\n /** Throws for an unknown node type; a missing primitive is a bug, not a degradation. */\n getDefinition(node: PrimitiveNode): AnyPrimitiveDefinition;\n /** `undefined` when the node is hidden from `surface`, `sanitize` drops it, or its primitive declares no renderer for `surface`. */\n renderOn<S extends SurfaceName>(\n surface: S,\n node: PrimitiveNode,\n extras: Omit<SurfaceMap<T>[S]['env'], 'scope'>\n ): SurfaceMap<T>[S]['output'] | undefined;\n /** On `snapshot`, preserves snapshot visibility and the frame palette. `context` may be omitted only when `{}` is a complete context for the pack. */\n renderReact(\n node: PrimitiveNode,\n ...context: ReactContextArg<T['context']>\n ): ReactNode;\n collectStyles(\n node: PrimitiveNode,\n styles: PrimitiveStyleCollector,\n context: PrimitiveStyleCollectionContext\n ): void;\n renderText(node: PrimitiveNode): string;\n renderMarkdown(node: PrimitiveNode): string;\n /** A child as content, for a container building with `md`. */\n renderMarkdownContent(node: PrimitiveNode): MarkdownContent;\n /** Empty when the node is hidden from `slack`, `sanitize` drops it, or its renderer returns nothing; a node with no `slack` renderer degrades through its markdown. */\n renderSlack(\n node: PrimitiveNode,\n collector?: T['slackCollector']\n ): readonly T['slackBlock'][];\n /** `0` when the node is hidden from `snapshot` or its primitive declares no `metrics.snapshotHeight`. */\n estimateSnapshotHeight(node: PrimitiveNode): number;\n /** Appends schema failures under `path` to `errors`, each naming `node`'s type. */\n validate(node: PrimitiveNode, path: string, errors: ValidationError[]): void;\n}\n\n/**\n * One surface's renderer for one node type, per {@link SurfaceMap}.\n *\n * Indexes the env bag. Do not use this to type the renderers map: the\n * written-out signatures on {@link Renderers} are what keep the bags checked\n * per surface.\n */\nexport type Renderer<\n TNode extends PrimitiveNode,\n S extends SurfaceName,\n T extends PackTypes = DefaultPackTypes,\n> = (node: TNode, env: SurfaceMap<T>[S]['env']) => SurfaceMap<T>[S]['output'];\n\n/**\n * The surface a pack may declare beyond the mandatory three.\n *\n * Only `slack`, and even that stays optional per primitive: the dispatcher\n * converts the mandatory markdown to Block Kit, so a missing Slack renderer\n * degrades rather than disappearing. `snapshot` is not here because no primitive\n * implements it — the surface reuses `react`.\n */\nexport const OPTIONAL_SURFACES = [\n 'slack',\n] as const satisfies readonly SurfaceName[];\n\n/** One of the {@link OPTIONAL_SURFACES}. */\nexport type OptionalSurface = (typeof OPTIONAL_SURFACES)[number];\n\n/**\n * One renderer per surface a primitive implements.\n *\n * `react`, `text`, and `markdown` are always required: those three are what\n * make \"every composition degrades\" true. `react` serves the `snapshot` surface\n * too, so targeting images costs a primitive nothing.\n *\n * `slack` is declared method-style deliberately: method parameters are checked\n * bivariantly, which is what lets a pack narrow the collector's node type.\n */\nexport interface Renderers<\n TNode extends PrimitiveNode,\n T extends PackTypes = DefaultPackTypes,\n> {\n react(\n node: TNode,\n env: {\n context: T['context'];\n scope: RenderScope<T>;\n /** See {@link SurfaceMap.react}'s `env.theme`. */\n theme?: T['theme'];\n }\n ): ReactNode;\n text(\n node: TNode,\n env: {\n scope: RenderScope<T>;\n }\n ): string;\n markdown(\n node: TNode,\n env: {\n scope: RenderScope<T>;\n }\n ): MarkdownContent;\n slack?(\n node: TNode,\n env: {\n collector?: T['slackCollector'];\n baseUrl?: string;\n scope: RenderScope<T>;\n }\n ): T['slackBlock'] | readonly T['slackBlock'][];\n}\n\n/**\n * Measurements a frame can ask of a node before drawing it.\n *\n * `snapshotHeight` is optional. The height estimate is `0` when it is missing, so\n * a frame that sums node heights sizes short.\n */\nexport interface PrimitiveMetrics<TNode extends PrimitiveNode> {\n /** The node's drawn height in pixels at the frame's width. */\n snapshotHeight?: (node: TNode) => number;\n}\n\n/**\n * Every primitive's schema is an object schema, because {@link definePrimitive}\n * extends it with `id` and `surfaces` and the composition builds a\n * `z.discriminatedUnion('type', …)` over them. Typed as `ZodObject` rather\n * than `ZodType<unknown>` so a union or intersection schema is a compile\n * error at the definition, not a runtime failure at the first `.extend()`.\n * Zod 4 types `z.object().superRefine(…)` as a `ZodObject` and preserves the\n * refinement through `.extend()`, so top-level refinements are unaffected.\n */\nexport type PrimitiveSchema = ZodObject;\n\n/**\n * The child-ref shape a primitive definition's own `children` returns.\n *\n * {@link ChildNodeRef} stays erased (`node: unknown`) because\n * `createChildNodeWalker` mixes children from every primitive type in the\n * runtime into one map and cannot name a single node type for them. A single\n * definition has no such excuse: its `children` should not type-check\n * against `unknown` and let something that is not a {@link PrimitiveNode} —\n * `null`, for instance — silently disappear from every tree walk.\n */\nexport interface PrimitiveChildRef extends ChildNodeRef {\n node: PrimitiveNode;\n}\n\n/**\n * One primitive: its node type, schema, catalog entry, and a renderer per\n * surface. The unit of vocabulary, and what {@link definePrimitive} takes.\n *\n * `T` is the pack's {@link PackTypes}, bound once with\n * {@link definePrimitiveFor} so each primitive names only `TNode`.\n */\nexport interface PrimitiveDefinition<\n TNode extends PrimitiveNode,\n T extends PackTypes = DefaultPackTypes,\n TSchema extends PrimitiveSchema = PrimitiveSchema,\n> {\n /** The node's discriminant, and the key this primitive occupies in an inventory. */\n type: TNode['type'];\n /** How the authoring prompt describes this primitive to the model. */\n catalog: PrimitiveCatalogEntry;\n /** Host-facing glyph, never shown to the model. Absent means the host supplies its own. */\n icon?: PrimitiveIcon;\n /**\n * Driven by the conformance harness, bare or named; read them with\n * `exampleNodes` or `primitiveExamples`. The catalog `example` is what the\n * prompt shows.\n */\n examples: readonly (TNode | PrimitiveExample<TNode>)[];\n /**\n * This primitive on its own. A container declares\n * {@link PrimitiveDefinition.schemaFor} as well, and uses\n * {@link unresolvedBodyNodeSchema} in the child slot here.\n */\n schema: TSchema;\n /**\n * A container's schema, bound to the body-node union of the composition it is\n * being built into.\n *\n * Declaring the shape and letting each composition supply its own union is\n * what lets one primitive appear in two runtimes with different inventories:\n * `z.lazy` memoizes per instance, and an instance built here belongs to\n * exactly one union.\n */\n schemaFor?: (bodyNodeSchema: ZodType<unknown>) => PrimitiveSchema;\n /** One function per surface; `react` serves `snapshot` as well. */\n renderers: Renderers<TNode, T>;\n /** Sizing a frame can ask for before drawing. Absent means it cannot be measured. */\n metrics?: PrimitiveMetrics<TNode>;\n /**\n * Render-time URL trust, the second of the two layers in `validate/url.ts`.\n *\n * Returning `null` drops the node. Applied even to an unvalidated node, so a\n * renderer invoked directly still cannot emit an unsafe URL.\n */\n sanitize?: (node: TNode) => TNode | null;\n /**\n * Nested nodes, for containers, in the order the `react` renderer draws\n * them; `findNodeElementPairs` relies on it. Absent means a leaf.\n */\n children?: (node: TNode) => readonly PrimitiveChildRef[];\n /**\n * True when this node produces surface output of its own, not only via\n * {@link PrimitiveDefinition.children}. A non-empty `children` result is\n * otherwise the complete source of rendered content, so a hybrid container\n * that still owns string fields returns true to keep rendering when every\n * nested node is hidden from the surface.\n */\n hasOwnContent?: (node: TNode) => boolean;\n /** Contributes this node's CSS by mutating `styles`, once per node per render. */\n collectStyles?: (\n node: TNode,\n env: { styles: T['collector']; context: PrimitiveStyleCollectionContext }\n ) => void;\n}\n\n/**\n * {@link PrimitiveDefinition} with every type parameter erased, and the form an\n * inventory is stored in.\n *\n * A heterogeneous pack has no single `TNode` to be generic over, so the\n * renderers degrade to `unknown` here.\n *\n * Each field carries the same contract as its {@link PrimitiveDefinition}\n * counterpart; only the types are erased.\n */\nexport interface AnyPrimitiveDefinition {\n type: string;\n catalog: PrimitiveCatalogEntry;\n icon?: PrimitiveIcon;\n examples: readonly (PrimitiveNode | PrimitiveExample)[];\n schema: PrimitiveSchema;\n schemaFor?: (bodyNodeSchema: ZodType<unknown>) => PrimitiveSchema;\n renderers: Record<'react' | 'text' | 'markdown', unknown> &\n Partial<Record<'slack', unknown>>;\n metrics?: {\n snapshotHeight?: unknown;\n };\n sanitize?: unknown;\n children?: unknown;\n hasOwnContent?: unknown;\n collectStyles?: unknown;\n}\n\n/** Parses `node` against `schema`, appending path-prefixed messages to `errors`. */\nexport const validateWithSchema = (\n schema: PrimitiveSchema,\n node: unknown,\n path: string,\n errors: ValidationError[]\n): void => {\n const result = schema.safeParse(node, { reportInput: true });\n if (!result.success) {\n errors.push(...formatZodIssues(result.error.issues, path));\n }\n};\n\n/** The `id` every node may carry, unique within a composition. */\nexport const bodyNodeIdSchema = requiredString('must be a non-empty string');\n\n/** The `surfaces` allowlist on a node. Absent means every surface; empty is rejected. */\nexport const bodyNodeSurfacesSchema = z\n .array(\n z.enum(SURFACE_NAMES, {\n error: () => oneOf(SURFACE_NAMES),\n })\n )\n .min(1, { error: 'must contain at least one surface' });\n\n/**\n * The child slot in a container's standalone {@link PrimitiveDefinition.schema},\n * where no body-node union is available.\n *\n * Deliberately permissive rather than `z.unknown()`: it still rejects a child\n * that is not a node at all, which is the error worth catching without an\n * inventory. Anything that depends on *which* types are legal — the validator,\n * the parser, the JSON Schema projection — goes through\n * {@link PrimitiveDefinition.schemaFor} and sees the real union.\n */\nexport const unresolvedBodyNodeSchema = z.looseObject({\n type: requiredString('must be a non-empty string'),\n});\n\n/**\n * Declares one primitive, extending its schema with the `id` and `surfaces`\n * fields every node carries, and closing it to unknown keys so a node is held\n * to the same rule as the composition root and the JSON Schema an agent reads.\n * A schema with its own catchall (`z.looseObject`) keeps it.\n *\n * A pack normally calls the form {@link definePrimitiveFor} binds to its own\n * {@link PackTypes}, so each primitive names only `TNode`.\n */\nexport const definePrimitive = <\n TNode extends PrimitiveNode,\n T extends PackTypes = DefaultPackTypes,\n TSchema extends PrimitiveSchema = PrimitiveSchema,\n>(\n definition: PrimitiveDefinition<TNode, T, TSchema>\n): PrimitiveDefinition<TNode, T, WithNodeFields<TSchema>> => {\n const { schemaFor, schema, catalog } = definition;\n const described =\n catalog.description === undefined ? schema.description : undefined;\n return {\n ...definition,\n ...(described === undefined\n ? {}\n : { catalog: { ...catalog, description: described } }),\n schema: withNodeFields(schema),\n // Both forms get the node fields, or a container would accept `id` and\n // `surfaces` standalone and reject them inside a composition.\n ...(schemaFor\n ? {\n schemaFor: (bodyNodeSchema: ZodType<unknown>) =>\n withNodeFields(schemaFor(bodyNodeSchema)),\n }\n : {}),\n };\n};\n\n/**\n * {@link definePrimitive} bound to one pack's {@link PackTypes}.\n *\n * ```ts\n * const define = definePrimitiveFor<SlidesPackTypes>();\n * export const note = define({ type: 'note', … });\n * ```\n */\nexport const definePrimitiveFor =\n <T extends PackTypes>() =>\n <\n TNode extends PrimitiveNode,\n TSchema extends PrimitiveSchema = PrimitiveSchema,\n >(\n definition: PrimitiveDefinition<TNode, T, TSchema>\n ): PrimitiveDefinition<TNode, T, WithNodeFields<TSchema>> =>\n definePrimitive<TNode, T, TSchema>(definition);\n\n/**\n * `.extend()` on a generic `ZodObject` widens the shape to `any`, so the\n * return type is rebuilt from `TSchema`'s shape. The brand on a field schema\n * stays on that same object at runtime.\n */\nexport type WithNodeFields<TSchema extends PrimitiveSchema> =\n TSchema extends ZodObject<infer Shape>\n ? ZodObject<\n Shape & {\n id: ReturnType<typeof bodyNodeIdSchema.optional>;\n surfaces: ReturnType<typeof bodyNodeSurfacesSchema.optional>;\n }\n >\n : PrimitiveSchema;\n\n// Marks the field schemas `definePrimitive` adds. A schema derived from a\n// defined one shares them by reference, and `Symbol.for` matches across ESM and\n// CommonJS copies of the SDK.\nconst NODE_FIELD = Symbol.for('elastic.isomer.node_field');\n\nconst nodeField = <T extends ZodType>(schema: T): T =>\n Object.defineProperty(schema, NODE_FIELD, { value: true });\n\nconst NODE_FIELDS = {\n id: nodeField(bodyNodeIdSchema.optional()),\n surfaces: nodeField(bodyNodeSurfacesSchema.optional()),\n};\n\nconst isNodeField = (schema: unknown): boolean => {\n let current = schema;\n while (current && typeof current === 'object') {\n if (Object.hasOwn(current, NODE_FIELD)) {\n return true;\n }\n const { def } = current as {\n def?: { type?: string; innerType?: unknown };\n };\n if (def?.type !== 'optional') {\n return false;\n }\n current = def.innerType;\n }\n return false;\n};\n\nconst withNodeFields = <TSchema extends PrimitiveSchema>(\n schema: TSchema\n): WithNodeFields<TSchema> => {\n const reserved = Object.keys(NODE_FIELDS).find(\n (field) =>\n Object.hasOwn(schema.shape, field) && !isNodeField(schema.shape[field])\n );\n if (reserved) {\n throw new IsomerError(\n ISOMER_ERROR_CODES.RESERVED_NODE_FIELD,\n `definePrimitive: a primitive schema cannot declare \\`${reserved}\\`; every body node has it.`\n );\n }\n const extended = schema.extend(NODE_FIELDS);\n return (\n schema.def.catchall === undefined ? extended.strict() : extended\n ) as WithNodeFields<TSchema>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"slack_blocks.js","sourceRoot":"","sources":["../../../src/define/slack_blocks.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\n// Slack surface output types for SurfaceMap. Not wire format.\n//\n// Message-surface Block Kit only (channel/DM posts). Field names and shapes\n// match Slack's JSON so output can go to `chat.postMessage`. Fields are\n// commented only where this subset departs from the published contract, or\n// where Slack's behavior is not evident from the name.\n//\n// References:\n// https://api.slack.com/reference/block-kit/blocks\n// https://api.slack.com/reference/block-kit/composition-objects\n// https://api.slack.com/reference/block-kit/block-elements\n\nexport interface SlackPlainTextObject {\n type: 'plain_text';\n text: string;\n emoji?: boolean;\n}\n\nexport interface SlackMrkdwnTextObject {\n type: 'mrkdwn';\n text: string;\n /** When true, Slack skips auto-linking URLs, channels, and users. Defaults to false. */\n verbatim?: boolean;\n}\n\nexport type SlackTextObject = SlackPlainTextObject | SlackMrkdwnTextObject;\n\nexport type SlackHeaderLevel = 1 | 2 | 3 | 4;\n\nexport interface SlackHeaderBlock {\n type: 'header';\n block_id?: string;\n text: SlackPlainTextObject;\n /** H1–H4 sizing. Accepted on message, modal, and Home tab surfaces. */\n level?: SlackHeaderLevel;\n}\n\nexport interface SlackSectionBlock {\n type: 'section';\n block_id?: string;\n text?: SlackTextObject;\n fields?: SlackMrkdwnTextObject[];\n accessory?: SlackSectionAccessory;\n}\n\nexport interface SlackDividerBlock {\n type: 'divider';\n block_id?: string;\n}\n\n/**\n * Inline image used inside `context` blocks and as a `section` accessory.\n * Distinct from the block-level {@link SlackImageBlock}.\n */\nexport interface SlackImageElement {\n type: 'image';\n image_url: string;\n alt_text: string;\n}\n\nexport interface SlackContextBlock {\n type: 'context';\n block_id?: string;\n elements: Array<SlackTextObject | SlackImageElement>;\n}\n\nexport interface SlackButtonElement {\n type: 'button';\n text: SlackPlainTextObject;\n url?: string;\n value?: string;\n action_id?: string;\n style?: 'primary' | 'danger';\n}\n\n/**\n * Reference to a file already uploaded to Slack.\n *\n * `id` and `url` are Slack's published fields. `ref` is not: a render cannot\n * upload, so it emits a placeholder the host swaps for Slack's file id once\n * the upload lands. See `SlackAssetCollector`.\n */\nexport interface SlackFileReference {\n id?: string;\n url?: string;\n ref?: string;\n}\n\n/**\n * Block-level image. `image_url` requires a publicly hosted URL; `slack_file`\n * references a file uploaded to Slack first, which is the only VPN-safe path.\n */\nexport interface SlackImageBlock {\n type: 'image';\n block_id?: string;\n alt_text: string;\n image_url?: string;\n slack_file?: SlackFileReference;\n title?: SlackPlainTextObject;\n}\n\n/** `video` block, matching Slack's JSON contract exactly. */\nexport interface SlackVideoBlock {\n type: 'video';\n block_id?: string;\n title: SlackPlainTextObject;\n title_url?: string;\n video_url: string;\n thumbnail_url: string;\n alt_text: string;\n description?: SlackPlainTextObject;\n author_name?: string;\n provider_name?: string;\n provider_icon_url?: string;\n}\n\nexport interface SlackRichTextStyle {\n bold?: boolean;\n italic?: boolean;\n strike?: boolean;\n code?: boolean;\n}\n\nexport interface SlackRichTextText {\n type: 'text';\n text: string;\n style?: SlackRichTextStyle;\n}\n\nexport interface SlackRichTextLink {\n type: 'link';\n url: string;\n text?: string;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackTagColor =\n | 'gray'\n | 'brown'\n | 'purple'\n | 'indigo'\n | 'blue'\n | 'green'\n | 'yellow'\n | 'orange'\n | 'red';\n\nexport interface SlackRichTextTag {\n type: 'tag';\n text: string;\n color?: SlackTagColor;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackRichTextInline =\n SlackRichTextText | SlackRichTextLink | SlackRichTextTag;\n\nexport interface SlackRichTextSection {\n type: 'rich_text_section';\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextList {\n type: 'rich_text_list';\n style: 'bullet' | 'ordered';\n indent?: number;\n /** Added to an ordered list's first number, which is otherwise 1. */\n offset?: number;\n border?: number;\n elements: SlackRichTextSection[];\n}\n\nexport interface SlackRichTextPreformatted {\n type: 'rich_text_preformatted';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextQuote {\n type: 'rich_text_quote';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport type SlackRichTextBlockElement =\n | SlackRichTextSection\n | SlackRichTextList\n | SlackRichTextPreformatted\n | SlackRichTextQuote;\n\nexport interface SlackRichTextBlock {\n type: 'rich_text';\n block_id?: string;\n elements: SlackRichTextBlockElement[];\n}\n\n/** The option shape shared by every menu, select, checkbox, and radio element. */\nexport interface SlackOptionObject {\n text: SlackTextObject;\n value: string;\n description?: SlackPlainTextObject;\n /** Only honored inside an `overflow` element. */\n url?: string;\n}\n\nexport interface SlackOptionGroup {\n label: SlackPlainTextObject;\n options: SlackOptionObject[];\n}\n\nexport interface SlackOverflowElement {\n type: 'overflow';\n action_id: string;\n options: SlackOptionObject[];\n}\n\nexport interface SlackStaticSelectElement {\n type: 'static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options?: SlackOptionObject[];\n option_groups?: SlackOptionGroup[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackMultiStaticSelectElement {\n type: 'multi_static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n max_selected_items?: number;\n}\n\nexport interface SlackRadioButtonsElement {\n type: 'radio_buttons';\n action_id: string;\n options: SlackOptionObject[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackCheckboxesElement {\n type: 'checkboxes';\n action_id: string;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n}\n\n/** Elements Slack permits inside an `actions` block. */\nexport type SlackActionElement =\n | SlackButtonElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\n/** Elements Slack permits as a `section.accessory`. */\nexport type SlackSectionAccessory =\n | SlackButtonElement\n | SlackImageElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\nexport interface SlackActionsBlock {\n type: 'actions';\n block_id?: string;\n elements: SlackActionElement[];\n}\n\n/** A plain table cell. Strings and numbers use this; see {@link SlackTableCell}. */\nexport interface SlackRawTextElement {\n type: 'raw_text';\n text: string;\n}\n\n/**\n * One table cell. Badge and toned values need the `rich_text` form so a `tag`\n * or bold run can sit inside the grid.\n */\nexport type SlackTableCell = SlackRawTextElement | SlackRichTextBlock;\n\n/**\n * Per-column behavior, positional: entry N configures column N.\n *\n * Trailing columns without an entry keep Slack's defaults (left-aligned, no\n * wrapping), and a `null` entry skips a column.\n */\nexport interface SlackTableColumnSetting {\n align?: 'left' | 'center' | 'right';\n is_wrapped?: boolean;\n}\n\n/**\n * Native `table` block, whose first row renders as the header.\n *\n * Cells, rows, and columns are capped by Slack; see `SLACK_LIMITS`.\n * https://docs.slack.dev/reference/block-kit/blocks/table-block\n */\nexport interface SlackTableBlock {\n type: 'table';\n block_id?: string;\n rows: SlackTableCell[][];\n column_settings?: Array<SlackTableColumnSetting | null>;\n}\n\n/** Every block this renderer emits, and what a `slack` renderer returns. */\nexport type SlackBlock =\n | SlackHeaderBlock\n | SlackSectionBlock\n | SlackDividerBlock\n | SlackImageBlock\n | SlackVideoBlock\n | SlackContextBlock\n | SlackActionsBlock\n | SlackRichTextBlock\n | SlackTableBlock;\n"]}
1
+ {"version":3,"file":"slack_blocks.js","sourceRoot":"","sources":["../../../src/define/slack_blocks.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\n// Slack surface output types for SurfaceMap. Not wire format.\n//\n// Message-surface Block Kit only (channel/DM posts). Field names and shapes\n// match Slack's JSON so output can go to `chat.postMessage`. Fields are\n// commented only where this subset departs from the published contract, or\n// where Slack's behavior is not evident from the name.\n//\n// References:\n// https://api.slack.com/reference/block-kit/blocks\n// https://api.slack.com/reference/block-kit/composition-objects\n// https://api.slack.com/reference/block-kit/block-elements\n\nexport interface SlackPlainTextObject {\n type: 'plain_text';\n text: string;\n emoji?: boolean;\n}\n\nexport interface SlackMrkdwnTextObject {\n type: 'mrkdwn';\n text: string;\n /** When true, Slack skips auto-linking URLs, channels, and users. Defaults to false. */\n verbatim?: boolean;\n}\n\nexport type SlackTextObject = SlackPlainTextObject | SlackMrkdwnTextObject;\n\nexport type SlackHeaderLevel = 1 | 2 | 3 | 4;\n\nexport interface SlackHeaderBlock {\n type: 'header';\n block_id?: string;\n text: SlackPlainTextObject;\n /** H1–H4 sizing. Accepted on message, modal, and Home tab surfaces. */\n level?: SlackHeaderLevel;\n}\n\nexport interface SlackSectionBlock {\n type: 'section';\n block_id?: string;\n text?: SlackTextObject;\n fields?: SlackMrkdwnTextObject[];\n accessory?: SlackSectionAccessory;\n}\n\nexport interface SlackDividerBlock {\n type: 'divider';\n block_id?: string;\n}\n\n/**\n * Inline image used inside `context` blocks and as a `section` accessory.\n * Distinct from the block-level {@link SlackImageBlock}.\n */\nexport interface SlackImageElement {\n type: 'image';\n image_url: string;\n alt_text: string;\n}\n\nexport interface SlackContextBlock {\n type: 'context';\n block_id?: string;\n elements: Array<SlackTextObject | SlackImageElement>;\n}\n\nexport interface SlackButtonElement {\n type: 'button';\n text: SlackPlainTextObject;\n url?: string;\n value?: string;\n action_id?: string;\n style?: 'primary' | 'danger';\n}\n\n/**\n * Reference to a file already uploaded to Slack.\n *\n * `id` and `url` are Slack's published fields. `ref` is not: a render cannot\n * upload, so it emits a placeholder the host swaps for Slack's file id once\n * the upload lands. See `SlackAssetCollector`.\n */\nexport interface SlackFileReference {\n id?: string;\n url?: string;\n ref?: string;\n}\n\n/**\n * Block-level image. `image_url` requires a publicly hosted URL; `slack_file`\n * references a file uploaded to Slack first, which is the only VPN-safe path.\n */\nexport interface SlackImageBlock {\n type: 'image';\n block_id?: string;\n alt_text: string;\n image_url?: string;\n slack_file?: SlackFileReference;\n title?: SlackPlainTextObject;\n}\n\n/** `video` block, matching Slack's JSON contract exactly. */\nexport interface SlackVideoBlock {\n type: 'video';\n block_id?: string;\n title: SlackPlainTextObject;\n title_url?: string;\n video_url: string;\n thumbnail_url: string;\n alt_text: string;\n description?: SlackPlainTextObject;\n author_name?: string;\n provider_name?: string;\n provider_icon_url?: string;\n}\n\nexport interface SlackRichTextStyle {\n bold?: boolean;\n italic?: boolean;\n strike?: boolean;\n code?: boolean;\n}\n\nexport interface SlackRichTextText {\n type: 'text';\n text: string;\n style?: SlackRichTextStyle;\n}\n\nexport interface SlackRichTextLink {\n type: 'link';\n url: string;\n text?: string;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackTagColor =\n | 'gray'\n | 'brown'\n | 'purple'\n | 'indigo'\n | 'blue'\n | 'green'\n | 'yellow'\n | 'orange'\n | 'red';\n\nexport interface SlackRichTextTag {\n type: 'tag';\n text: string;\n color?: SlackTagColor;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackRichTextInline =\n SlackRichTextText | SlackRichTextLink | SlackRichTextTag;\n\nexport interface SlackRichTextSection {\n type: 'rich_text_section';\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextList {\n type: 'rich_text_list';\n style: 'bullet' | 'ordered';\n indent?: number;\n /** Added to an ordered list's first number, which is otherwise 1. */\n offset?: number;\n border?: number;\n elements: SlackRichTextSection[];\n}\n\nexport interface SlackRichTextPreformatted {\n type: 'rich_text_preformatted';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextQuote {\n type: 'rich_text_quote';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport type SlackRichTextBlockElement =\n | SlackRichTextSection\n | SlackRichTextList\n | SlackRichTextPreformatted\n | SlackRichTextQuote;\n\nexport interface SlackRichTextBlock {\n type: 'rich_text';\n block_id?: string;\n elements: SlackRichTextBlockElement[];\n}\n\n/** The option shape shared by every menu, select, checkbox, and radio element. */\nexport interface SlackOptionObject {\n text: SlackTextObject;\n value: string;\n description?: SlackPlainTextObject;\n /** Only honored inside an `overflow` element. */\n url?: string;\n}\n\nexport interface SlackOptionGroup {\n label: SlackPlainTextObject;\n options: SlackOptionObject[];\n}\n\nexport interface SlackOverflowElement {\n type: 'overflow';\n action_id: string;\n options: SlackOptionObject[];\n}\n\nexport interface SlackStaticSelectElement {\n type: 'static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options?: SlackOptionObject[];\n option_groups?: SlackOptionGroup[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackMultiStaticSelectElement {\n type: 'multi_static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n max_selected_items?: number;\n}\n\nexport interface SlackRadioButtonsElement {\n type: 'radio_buttons';\n action_id: string;\n options: SlackOptionObject[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackCheckboxesElement {\n type: 'checkboxes';\n action_id: string;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n}\n\n/** Elements Slack permits inside an `actions` block. */\nexport type SlackActionElement =\n | SlackButtonElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\n/** Elements Slack permits as a `section.accessory`. */\nexport type SlackSectionAccessory =\n | SlackButtonElement\n | SlackImageElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\nexport interface SlackActionsBlock {\n type: 'actions';\n block_id?: string;\n elements: SlackActionElement[];\n}\n\n/** A plain table cell. Strings and numbers use this; see {@link SlackTableCell}. */\nexport interface SlackRawTextElement {\n type: 'raw_text';\n text: string;\n}\n\n/**\n * One table cell. Badge and toned values need the `rich_text` form so a `tag`\n * or bold run can sit inside the grid.\n */\nexport type SlackTableCell = SlackRawTextElement | SlackRichTextBlock;\n\n/**\n * Per-column behavior, positional: entry N configures column N.\n *\n * Trailing columns without an entry keep Slack's defaults (left-aligned, no\n * wrapping), and a `null` entry skips a column.\n */\nexport interface SlackTableColumnSetting {\n align?: 'left' | 'center' | 'right';\n is_wrapped?: boolean;\n}\n\n/**\n * Native `table` block, whose first row renders as the header.\n *\n * Cells, rows, and columns are capped by Slack; see `SLACK_LIMITS`.\n * https://docs.slack.dev/reference/block-kit/blocks/table-block\n */\nexport interface SlackTableBlock {\n type: 'table';\n block_id?: string;\n rows: SlackTableCell[][];\n column_settings?: Array<SlackTableColumnSetting | null>;\n}\n\n/** Blocks a {@link SlackContainerBlock} holds. Slack also accepts `file` and `input`, which this subset does not model. */\nexport type SlackContainerChildBlock =\n | SlackHeaderBlock\n | SlackSectionBlock\n | SlackDividerBlock\n | SlackImageBlock\n | SlackVideoBlock\n | SlackContextBlock\n | SlackActionsBlock\n | SlackRichTextBlock\n | SlackTableBlock;\n\ninterface SlackContainerFields {\n type: 'container';\n block_id?: string;\n subtitle?: SlackTextObject;\n icon?: SlackImageElement;\n /** Between 1 and `SLACK_LIMITS.containerChildBlocks`; Slack rejects a nested `container`. */\n child_blocks: SlackContainerChildBlock[];\n width?: 'narrow' | 'standard' | 'wide' | 'full';\n is_collapsible?: boolean;\n /** Only honored when `is_collapsible` is set. */\n default_collapsed?: boolean;\n /** Only honored when the container is not collapsible. */\n has_header_divider?: boolean;\n}\n\n/**\n * Titled group of child blocks, optionally collapsible. Slack shows\n * `rich_text_title` over `title` when both are set.\n *\n * https://docs.slack.dev/reference/block-kit/blocks/container-block\n */\nexport type SlackContainerBlock = SlackContainerFields &\n (\n | { title: SlackPlainTextObject; rich_text_title?: SlackRichTextBlock }\n | { title?: SlackPlainTextObject; rich_text_title: SlackRichTextBlock }\n );\n\n/** Every block this renderer emits, and what a `slack` renderer returns. */\nexport type SlackBlock = SlackContainerChildBlock | SlackContainerBlock;\n"]}
@@ -6,8 +6,8 @@
6
6
  * 2.0.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.buildCompositionJsonSchema = exports.buildAuthoringJsonSchema = exports.authoringSchemaSubset = exports.assetUrl = exports.NAVIGATION_HREF_RULE = exports.NAVIGATION_HREF_MESSAGE = exports.MAX_INPUT_VALUES = exports.MAX_INPUT_DEPTH = exports.MAX_INPUT_CHARACTERS = exports.BLOCKED_HREF = exports.ASSET_URL_RULE = exports.ASSET_URL_MESSAGE = exports.withoutAnchors = exports.withNodeAnchors = exports.rawDisplayValue = exports.nodeAnchor = exports.layoutRoom = exports.isStructuredValue = exports.formatDisplayValue = exports.createPrimitiveDispatcher = exports.checkLayout = exports.NODE_ANCHOR_ATTRIBUTE = exports.LAYOUT_ROOM_ATTRIBUTE = exports.scopeScript = exports.describeCapabilities = exports.definePrimitivePack = exports.composePacks = exports.z = exports.unresolvedBodyNodeSchema = exports.requiredString = exports.primitiveExamples = exports.formatZodIssues = exports.exampleNodes = exports.definePrimitiveFor = exports.definePrimitive = exports.bindFrame = exports.OPTIONAL_SURFACES = exports.ICON_VARS = exports.someBodyNode = exports.mapCompositionNodes = exports.isVisibleOnSurface = exports.IsomerError = exports.formatValidationError = exports.createChildNodeWalker = exports.CompositionValidationError = exports.SURFACE_NAMES = exports.STRUCTURED_VALUE_FORMATS = exports.ISOMER_ERROR_CODES = exports.BODY_NODE_SURFACES = exports.ALL_NAMED_COLORS = void 0;
10
- exports.warningsForSurface = exports.structuredValueSchema = exports.sanitizeNavigationHref = exports.sanitizeAssetUrl = exports.renderThemeSchema = exports.navigationHref = exports.namedColorSchema = exports.isInputRefusal = exports.getCompositionSchemaForDefinitions = exports.displayValueSchema = exports.createCompositionValidator = exports.createCompositionParser = exports.compositionToRender = exports.checkInputBudget = void 0;
9
+ exports.buildAuthoringJsonSchema = exports.authoringSchemaSubset = exports.assetUrl = exports.NAVIGATION_HREF_RULE = exports.NAVIGATION_HREF_MESSAGE = exports.MAX_INPUT_VALUES = exports.MAX_INPUT_DEPTH = exports.MAX_INPUT_CHARACTERS = exports.BLOCKED_HREF = exports.ASSET_URL_RULE = exports.ASSET_URL_MESSAGE = exports.withoutAnchors = exports.withNodeAnchors = exports.rawDisplayValue = exports.nodeAnchor = exports.layoutRoom = exports.isStructuredValue = exports.formatDisplayValue = exports.createPrimitiveDispatcher = exports.checkLayout = exports.NODE_ANCHOR_ATTRIBUTE = exports.LAYOUT_ROOM_ATTRIBUTE = exports.scopeScript = exports.describeCapabilities = exports.definePrimitivePack = exports.composePacks = exports.UNCATEGORIZED_GROUP_TITLE = exports.z = exports.unresolvedBodyNodeSchema = exports.requiredString = exports.primitiveExamples = exports.formatZodIssues = exports.exampleNodes = exports.definePrimitiveFor = exports.definePrimitive = exports.bindFrame = exports.OPTIONAL_SURFACES = exports.ICON_VARS = exports.someBodyNode = exports.mapCompositionNodes = exports.isVisibleOnSurface = exports.IsomerError = exports.formatValidationError = exports.createChildNodeWalker = exports.CompositionValidationError = exports.SURFACE_NAMES = exports.STRUCTURED_VALUE_FORMATS = exports.ISOMER_ERROR_CODES = exports.BODY_NODE_SURFACES = exports.ALL_NAMED_COLORS = void 0;
10
+ exports.warningsForSurface = exports.structuredValueSchema = exports.sanitizeParsedNavigationHref = exports.sanitizeParsedAssetUrl = exports.sanitizeNavigationHref = exports.sanitizeAssetUrl = exports.renderThemeSchema = exports.navigationHref = exports.namedColorSchema = exports.isInputRefusal = exports.getCompositionSchemaForDefinitions = exports.displayValueSchema = exports.createCompositionValidator = exports.createCompositionParser = exports.compositionToRender = exports.checkInputBudget = exports.buildCompositionJsonSchema = void 0;
11
11
  var composition_1 = require("../composition");
12
12
  Object.defineProperty(exports, "ALL_NAMED_COLORS", { enumerable: true, get: function () { return composition_1.ALL_NAMED_COLORS; } });
13
13
  Object.defineProperty(exports, "BODY_NODE_SURFACES", { enumerable: true, get: function () { return composition_1.BODY_NODE_SURFACES; } });
@@ -34,6 +34,7 @@ Object.defineProperty(exports, "requiredString", { enumerable: true, get: functi
34
34
  Object.defineProperty(exports, "unresolvedBodyNodeSchema", { enumerable: true, get: function () { return define_1.unresolvedBodyNodeSchema; } });
35
35
  Object.defineProperty(exports, "z", { enumerable: true, get: function () { return define_1.z; } });
36
36
  var pack_1 = require("../pack");
37
+ Object.defineProperty(exports, "UNCATEGORIZED_GROUP_TITLE", { enumerable: true, get: function () { return pack_1.UNCATEGORIZED_GROUP_TITLE; } });
37
38
  Object.defineProperty(exports, "composePacks", { enumerable: true, get: function () { return pack_1.composePacks; } });
38
39
  Object.defineProperty(exports, "definePrimitivePack", { enumerable: true, get: function () { return pack_1.definePrimitivePack; } });
39
40
  Object.defineProperty(exports, "describeCapabilities", { enumerable: true, get: function () { return pack_1.describeCapabilities; } });
@@ -75,6 +76,8 @@ Object.defineProperty(exports, "navigationHref", { enumerable: true, get: functi
75
76
  Object.defineProperty(exports, "renderThemeSchema", { enumerable: true, get: function () { return validate_1.renderThemeSchema; } });
76
77
  Object.defineProperty(exports, "sanitizeAssetUrl", { enumerable: true, get: function () { return validate_1.sanitizeAssetUrl; } });
77
78
  Object.defineProperty(exports, "sanitizeNavigationHref", { enumerable: true, get: function () { return validate_1.sanitizeNavigationHref; } });
79
+ Object.defineProperty(exports, "sanitizeParsedAssetUrl", { enumerable: true, get: function () { return validate_1.sanitizeParsedAssetUrl; } });
80
+ Object.defineProperty(exports, "sanitizeParsedNavigationHref", { enumerable: true, get: function () { return validate_1.sanitizeParsedNavigationHref; } });
78
81
  Object.defineProperty(exports, "structuredValueSchema", { enumerable: true, get: function () { return validate_1.structuredValueSchema; } });
79
82
  Object.defineProperty(exports, "warningsForSurface", { enumerable: true, get: function () { return validate_1.warningsForSurface; } });
80
83
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entries/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,8CA6BwB;AAZtB,+GAAA,gBAAgB,OAAA;AAChB,iHAAA,kBAAkB,OAAA;AAClB,iHAAA,kBAAkB,OAAA;AAClB,uHAAA,wBAAwB,OAAA;AACxB,4GAAA,aAAa,OAAA;AACb,yHAAA,0BAA0B,OAAA;AAC1B,oHAAA,qBAAqB,OAAA;AACrB,oHAAA,qBAAqB,OAAA;AACrB,0GAAA,WAAW,OAAA;AACX,iHAAA,kBAAkB,OAAA;AAClB,kHAAA,mBAAmB,OAAA;AACnB,2GAAA,YAAY,OAAA;AAEd,oCA6CmB;AAXjB,mGAAA,SAAS,OAAA;AACT,2GAAA,iBAAiB,OAAA;AACjB,mGAAA,SAAS,OAAA;AACT,yGAAA,eAAe,OAAA;AACf,4GAAA,kBAAkB,OAAA;AAClB,sGAAA,YAAY,OAAA;AACZ,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AACd,kHAAA,wBAAwB,OAAA;AACxB,2FAAA,CAAC,OAAA;AAEH,gCAgBiB;AAJf,oGAAA,YAAY,OAAA;AACZ,2GAAA,mBAAmB,OAAA;AACnB,4GAAA,oBAAoB,OAAA;AACpB,mGAAA,WAAW,OAAA;AAEb,oCAmBmB;AAXjB,+GAAA,qBAAqB,OAAA;AACrB,+GAAA,qBAAqB,OAAA;AACrB,qGAAA,WAAW,OAAA;AACX,mHAAA,yBAAyB,OAAA;AACzB,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AACjB,oGAAA,UAAU,OAAA;AACV,oGAAA,UAAU,OAAA;AACV,yGAAA,eAAe,OAAA;AACf,yGAAA,eAAe,OAAA;AACf,wGAAA,cAAc,OAAA;AAEhB,wCAwCqB;AA1BnB,6GAAA,iBAAiB,OAAA;AACjB,0GAAA,cAAc,OAAA;AACd,wGAAA,YAAY,OAAA;AACZ,gHAAA,oBAAoB,OAAA;AACpB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAChB,mHAAA,uBAAuB,OAAA;AACvB,gHAAA,oBAAoB,OAAA;AACpB,oGAAA,QAAQ,OAAA;AACR,iHAAA,qBAAqB,OAAA;AACrB,oHAAA,wBAAwB,OAAA;AACxB,sHAAA,0BAA0B,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,mHAAA,uBAAuB,OAAA;AACvB,sHAAA,0BAA0B,OAAA;AAC1B,8GAAA,kBAAkB,OAAA;AAClB,8HAAA,kCAAkC,OAAA;AAClC,0GAAA,cAAc,OAAA;AACd,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,4GAAA,gBAAgB,OAAA;AAChB,kHAAA,sBAAsB,OAAA;AACtB,iHAAA,qBAAqB,OAAA;AACrB,8GAAA,kBAAkB,OAAA","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 {\n type ActionEventRef,\n type BodyNodeBase,\n type ChildNodeRef,\n type ChildNodeWalker,\n type Composition,\n type CompositionMeta,\n type DisplayValue,\n type IsomerErrorCode,\n type NamedColor,\n type NamedColorPalette,\n type PrimitiveNode,\n type RenderTheme,\n type StructuredValue,\n type StructuredValueFormat,\n type SurfaceName,\n type ValidationError,\n ALL_NAMED_COLORS,\n BODY_NODE_SURFACES,\n ISOMER_ERROR_CODES,\n STRUCTURED_VALUE_FORMATS,\n SURFACE_NAMES,\n CompositionValidationError,\n createChildNodeWalker,\n formatValidationError,\n IsomerError,\n isVisibleOnSurface,\n mapCompositionNodes,\n someBodyNode,\n} from '../composition';\nexport {\n type AnyPrimitiveDefinition,\n type BoundFrame,\n type DefaultPackTypes,\n type ExampleNode,\n type Frame,\n type FrameBody,\n type FrameComposition,\n type FrameDispatcher,\n type FrameHeader,\n type FrameViewport,\n type NormalizedPrimitiveExample,\n type OptionalSurface,\n type PackTypes,\n type PrimitiveCatalogEntry,\n type PrimitiveChildRef,\n type PrimitiveDefinition,\n type PrimitiveExample,\n type PrimitiveIcon,\n type PrimitiveMetrics,\n type PrimitiveRenderContext,\n type PrimitiveSchema,\n type PrimitiveStyleCollectionContext,\n type PrimitiveStyleCollector,\n type ReactContextArg,\n type Renderer,\n type Renderers,\n type RenderScope,\n type StyledRenderContext,\n type StyleHandle,\n type SurfaceMap,\n type ThemePair,\n type ThemeTokenPath,\n type WithNodeFields,\n ICON_VARS,\n OPTIONAL_SURFACES,\n bindFrame,\n definePrimitive,\n definePrimitiveFor,\n exampleNodes,\n formatZodIssues,\n primitiveExamples,\n requiredString,\n unresolvedBodyNodeSchema,\n z,\n} from '../define';\nexport {\n type AnyPrimitivePack,\n type CapabilitySources,\n type ComposedPacks,\n type EnhancementDefinition,\n type HostCapabilities,\n type PackAuthoringOptions,\n type PackStyleAdapter,\n type PrimitiveGroup,\n type PrimitivePack,\n type PrimitivePackInput,\n type SurfaceSupport,\n composePacks,\n definePrimitivePack,\n describeCapabilities,\n scopeScript,\n} from '../pack';\nexport {\n type FormatDisplayValueOptions,\n type LayoutBox,\n type LayoutFinding,\n type LayoutRect,\n type PayloadMeasurement,\n type PrimitiveDispatcher,\n type PrimitiveDispatcherOptions,\n LAYOUT_ROOM_ATTRIBUTE,\n NODE_ANCHOR_ATTRIBUTE,\n checkLayout,\n createPrimitiveDispatcher,\n formatDisplayValue,\n isStructuredValue,\n layoutRoom,\n nodeAnchor,\n rawDisplayValue,\n withNodeAnchors,\n withoutAnchors,\n} from '../render';\nexport {\n type AuthoringJsonSchemaOptions,\n type CheckedComposition,\n type CheckedValidationResult,\n type CompositionJsonSchemaOptions,\n type CompositionSchemaOptions,\n type CompositionValidatorOptions,\n type InputBudget,\n type InputBudgetCheck,\n type ParsedComposition,\n type UrlSchemaOptions,\n type ValidationErrorMode,\n type ValidationResult,\n type ValidationWarning,\n ASSET_URL_MESSAGE,\n ASSET_URL_RULE,\n BLOCKED_HREF,\n MAX_INPUT_CHARACTERS,\n MAX_INPUT_DEPTH,\n MAX_INPUT_VALUES,\n NAVIGATION_HREF_MESSAGE,\n NAVIGATION_HREF_RULE,\n assetUrl,\n authoringSchemaSubset,\n buildAuthoringJsonSchema,\n buildCompositionJsonSchema,\n checkInputBudget,\n compositionToRender,\n createCompositionParser,\n createCompositionValidator,\n displayValueSchema,\n getCompositionSchemaForDefinitions,\n isInputRefusal,\n namedColorSchema,\n navigationHref,\n renderThemeSchema,\n sanitizeAssetUrl,\n sanitizeNavigationHref,\n structuredValueSchema,\n warningsForSurface,\n} from '../validate';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entries/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,8CA6BwB;AAZtB,+GAAA,gBAAgB,OAAA;AAChB,iHAAA,kBAAkB,OAAA;AAClB,iHAAA,kBAAkB,OAAA;AAClB,uHAAA,wBAAwB,OAAA;AACxB,4GAAA,aAAa,OAAA;AACb,yHAAA,0BAA0B,OAAA;AAC1B,oHAAA,qBAAqB,OAAA;AACrB,oHAAA,qBAAqB,OAAA;AACrB,0GAAA,WAAW,OAAA;AACX,iHAAA,kBAAkB,OAAA;AAClB,kHAAA,mBAAmB,OAAA;AACnB,2GAAA,YAAY,OAAA;AAEd,oCA6CmB;AAXjB,mGAAA,SAAS,OAAA;AACT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A;AACd,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,4GAAA,gBAAgB,OAAA;AAChB,kHAAA,sBAAsB,OAAA;AACtB,kHAAA,sBAAsB,OAAA;AACtB,wHAAA,4BAA4B,OAAA;AAC5B,iHAAA,qBAAqB,OAAA;AACrB,8GAAA,kBAAkB,OAAA","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 {\n type ActionEventRef,\n type BodyNodeBase,\n type ChildNodeRef,\n type ChildNodeWalker,\n type Composition,\n type CompositionMeta,\n type DisplayValue,\n type IsomerErrorCode,\n type NamedColor,\n type NamedColorPalette,\n type PrimitiveNode,\n type RenderTheme,\n type StructuredValue,\n type StructuredValueFormat,\n type SurfaceName,\n type ValidationError,\n ALL_NAMED_COLORS,\n BODY_NODE_SURFACES,\n ISOMER_ERROR_CODES,\n STRUCTURED_VALUE_FORMATS,\n SURFACE_NAMES,\n CompositionValidationError,\n createChildNodeWalker,\n formatValidationError,\n IsomerError,\n isVisibleOnSurface,\n mapCompositionNodes,\n someBodyNode,\n} from '../composition';\nexport {\n type AnyPrimitiveDefinition,\n type BoundFrame,\n type DefaultPackTypes,\n type ExampleNode,\n type Frame,\n type FrameBody,\n type FrameComposition,\n type FrameDispatcher,\n type FrameHeader,\n type FrameViewport,\n type NormalizedPrimitiveExample,\n type OptionalSurface,\n type PackTypes,\n type PrimitiveCatalogEntry,\n type PrimitiveChildRef,\n type PrimitiveDefinition,\n type PrimitiveExample,\n type PrimitiveIcon,\n type PrimitiveMetrics,\n type PrimitiveRenderContext,\n type PrimitiveSchema,\n type PrimitiveStyleCollectionContext,\n type PrimitiveStyleCollector,\n type ReactContextArg,\n type Renderer,\n type Renderers,\n type RenderScope,\n type StyledRenderContext,\n type StyleHandle,\n type SurfaceMap,\n type ThemePair,\n type ThemeTokenPath,\n type WithNodeFields,\n ICON_VARS,\n OPTIONAL_SURFACES,\n bindFrame,\n definePrimitive,\n definePrimitiveFor,\n exampleNodes,\n formatZodIssues,\n primitiveExamples,\n requiredString,\n unresolvedBodyNodeSchema,\n z,\n} from '../define';\nexport {\n type AnyPrimitivePack,\n type CapabilitySources,\n type ComposedPacks,\n type EnhancementDefinition,\n type HostCapabilities,\n type PackAuthoringOptions,\n type PackStyleAdapter,\n type PrimitiveGroup,\n type PrimitivePack,\n type PrimitivePackInput,\n type SurfaceSupport,\n UNCATEGORIZED_GROUP_TITLE,\n composePacks,\n definePrimitivePack,\n describeCapabilities,\n scopeScript,\n} from '../pack';\nexport {\n type FormatDisplayValueOptions,\n type LayoutBox,\n type LayoutFinding,\n type LayoutRect,\n type PayloadMeasurement,\n type PrimitiveDispatcher,\n type PrimitiveDispatcherOptions,\n LAYOUT_ROOM_ATTRIBUTE,\n NODE_ANCHOR_ATTRIBUTE,\n checkLayout,\n createPrimitiveDispatcher,\n formatDisplayValue,\n isStructuredValue,\n layoutRoom,\n nodeAnchor,\n rawDisplayValue,\n withNodeAnchors,\n withoutAnchors,\n} from '../render';\nexport {\n type AuthoringJsonSchemaOptions,\n type CheckedComposition,\n type CheckedValidationResult,\n type CompositionJsonSchemaOptions,\n type CompositionSchemaOptions,\n type CompositionValidatorOptions,\n type InputBudget,\n type InputBudgetCheck,\n type ParsedComposition,\n type UrlSchemaOptions,\n type ValidationErrorMode,\n type ValidationResult,\n type ValidationWarning,\n ASSET_URL_MESSAGE,\n ASSET_URL_RULE,\n BLOCKED_HREF,\n MAX_INPUT_CHARACTERS,\n MAX_INPUT_DEPTH,\n MAX_INPUT_VALUES,\n NAVIGATION_HREF_MESSAGE,\n NAVIGATION_HREF_RULE,\n assetUrl,\n authoringSchemaSubset,\n buildAuthoringJsonSchema,\n buildCompositionJsonSchema,\n checkInputBudget,\n compositionToRender,\n createCompositionParser,\n createCompositionValidator,\n displayValueSchema,\n getCompositionSchemaForDefinitions,\n isInputRefusal,\n namedColorSchema,\n navigationHref,\n renderThemeSchema,\n sanitizeAssetUrl,\n sanitizeNavigationHref,\n sanitizeParsedAssetUrl,\n sanitizeParsedNavigationHref,\n structuredValueSchema,\n warningsForSurface,\n} from '../validate';\n"]}
@@ -6,9 +6,11 @@
6
6
  * 2.0.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.serializeMarkdown = exports.renderMarkdownEnvelope = exports.md = void 0;
9
+ exports.splitAuthoredMarkdown = exports.serializeMarkdown = exports.renderMarkdownEnvelope = exports.md = exports.exceedsParseBudget = void 0;
10
10
  var markdown_1 = require("../render/markdown");
11
+ Object.defineProperty(exports, "exceedsParseBudget", { enumerable: true, get: function () { return markdown_1.exceedsParseBudget; } });
11
12
  Object.defineProperty(exports, "md", { enumerable: true, get: function () { return markdown_1.md; } });
12
13
  Object.defineProperty(exports, "renderMarkdownEnvelope", { enumerable: true, get: function () { return markdown_1.renderMarkdownEnvelope; } });
13
14
  Object.defineProperty(exports, "serializeMarkdown", { enumerable: true, get: function () { return markdown_1.serializeMarkdown; } });
15
+ Object.defineProperty(exports, "splitAuthoredMarkdown", { enumerable: true, get: function () { return markdown_1.splitAuthoredMarkdown; } });
14
16
  //# sourceMappingURL=markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../src/entries/markdown.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AASH,+CAM4B;AAH1B,8FAAA,EAAE,OAAA;AACF,kHAAA,sBAAsB,OAAA;AACtB,6GAAA,iBAAiB,OAAA","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 {\n type MarkdownBlock,\n type MarkdownContent,\n type MarkdownInline,\n type MarkdownInlineInput,\n} from '../define';\n\nexport {\n type MarkdownEnvelopeDispatcher,\n type MarkdownEnvelopeOptions,\n md,\n renderMarkdownEnvelope,\n serializeMarkdown,\n} from '../render/markdown';\n"]}
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../src/entries/markdown.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AASH,+CAU4B;AAL1B,8GAAA,kBAAkB,OAAA;AAClB,8FAAA,EAAE,OAAA;AACF,kHAAA,sBAAsB,OAAA;AACtB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA","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 {\n type MarkdownBlock,\n type MarkdownContent,\n type MarkdownInline,\n type MarkdownInlineInput,\n} from '../define';\n\nexport {\n type AuthoredMarkdownSegment,\n type MarkdownEnvelopeDispatcher,\n type MarkdownEnvelopeOptions,\n type SplitAuthoredMarkdownOptions,\n exceedsParseBudget,\n md,\n renderMarkdownEnvelope,\n serializeMarkdown,\n splitAuthoredMarkdown,\n} from '../render/markdown';\n"]}
@@ -6,7 +6,7 @@
6
6
  * 2.0.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.wrapCompositionContent = exports.renderCompositionContent = exports.applyEnhancements = exports.measureDom = exports.findNodeElementPairs = exports.runEnhancementScript = void 0;
9
+ exports.wrapCompositionContent = exports.renderMarkdownContent = exports.renderCompositionContent = exports.applyEnhancements = exports.measureDom = exports.findNodeElementPairs = exports.runEnhancementScript = void 0;
10
10
  var enhancements_1 = require("../pack/enhancements");
11
11
  Object.defineProperty(exports, "runEnhancementScript", { enumerable: true, get: function () { return enhancements_1.runEnhancementScript; } });
12
12
  var anchors_1 = require("../render/anchors");
@@ -16,5 +16,6 @@ Object.defineProperty(exports, "measureDom", { enumerable: true, get: function (
16
16
  var react_1 = require("../render/react");
17
17
  Object.defineProperty(exports, "applyEnhancements", { enumerable: true, get: function () { return react_1.applyEnhancements; } });
18
18
  Object.defineProperty(exports, "renderCompositionContent", { enumerable: true, get: function () { return react_1.renderCompositionContent; } });
19
+ Object.defineProperty(exports, "renderMarkdownContent", { enumerable: true, get: function () { return react_1.renderMarkdownContent; } });
19
20
  Object.defineProperty(exports, "wrapCompositionContent", { enumerable: true, get: function () { return react_1.wrapCompositionContent; } });
20
21
  //# sourceMappingURL=react.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/entries/react.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,qDAA4D;AAAnD,oHAAA,oBAAoB,OAAA;AAC7B,6CAAyD;AAAhD,+GAAA,oBAAoB,OAAA;AAC7B,qDAAmD;AAA1C,yGAAA,UAAU,OAAA;AACnB,yCAOyB;AAHvB,0GAAA,iBAAiB,OAAA;AACjB,iHAAA,wBAAwB,OAAA;AACxB,+GAAA,sBAAsB,OAAA","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 { runEnhancementScript } from '../pack/enhancements';\nexport { findNodeElementPairs } from '../render/anchors';\nexport { measureDom } from '../render/measure_dom';\nexport {\n type CompositionWrapperOptions,\n type ReactContentDispatcher,\n type ReactContentOptions,\n applyEnhancements,\n renderCompositionContent,\n wrapCompositionContent,\n} from '../render/react';\n"]}
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/entries/react.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,qDAA4D;AAAnD,oHAAA,oBAAoB,OAAA;AAC7B,6CAAyD;AAAhD,+GAAA,oBAAoB,OAAA;AAC7B,qDAAmD;AAA1C,yGAAA,UAAU,OAAA;AACnB,yCAQyB;AAJvB,0GAAA,iBAAiB,OAAA;AACjB,iHAAA,wBAAwB,OAAA;AACxB,8GAAA,qBAAqB,OAAA;AACrB,+GAAA,sBAAsB,OAAA","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 { runEnhancementScript } from '../pack/enhancements';\nexport { findNodeElementPairs } from '../render/anchors';\nexport { measureDom } from '../render/measure_dom';\nexport {\n type CompositionWrapperOptions,\n type ReactContentDispatcher,\n type ReactContentOptions,\n applyEnhancements,\n renderCompositionContent,\n renderMarkdownContent,\n wrapCompositionContent,\n} from '../render/react';\n"]}
@@ -6,7 +6,7 @@
6
6
  * 2.0.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.strike = exports.slackLinkUrl = exports.renderSlackEnvelope = exports.markdownContentToSlackBlocks = exports.link = exports.italic = exports.isSlackReachableImageUrl = exports.escapeMrkdwn = exports.createSlackAssetCollector = exports.codeBlock = exports.code = exports.clampSlackText = exports.bold = exports.SLACK_LIMITS = void 0;
9
+ exports.unmodeledSlackBlock = exports.strike = exports.slackLinkUrl = exports.slackContainer = exports.renderSlackEnvelope = exports.markdownContentToSlackBlocks = exports.link = exports.italic = exports.isUnmodeledSlackBlock = exports.isSlackReachableImageUrl = exports.isModeledSlackBlockType = exports.escapeMrkdwn = exports.createSlackAssetCollector = exports.codeBlock = exports.code = exports.clampSlackText = exports.bold = exports.SLACK_LIMITS = void 0;
10
10
  var slack_1 = require("../render/slack");
11
11
  Object.defineProperty(exports, "SLACK_LIMITS", { enumerable: true, get: function () { return slack_1.SLACK_LIMITS; } });
12
12
  Object.defineProperty(exports, "bold", { enumerable: true, get: function () { return slack_1.bold; } });
@@ -15,11 +15,15 @@ Object.defineProperty(exports, "code", { enumerable: true, get: function () { re
15
15
  Object.defineProperty(exports, "codeBlock", { enumerable: true, get: function () { return slack_1.codeBlock; } });
16
16
  Object.defineProperty(exports, "createSlackAssetCollector", { enumerable: true, get: function () { return slack_1.createSlackAssetCollector; } });
17
17
  Object.defineProperty(exports, "escapeMrkdwn", { enumerable: true, get: function () { return slack_1.escapeMrkdwn; } });
18
+ Object.defineProperty(exports, "isModeledSlackBlockType", { enumerable: true, get: function () { return slack_1.isModeledSlackBlockType; } });
18
19
  Object.defineProperty(exports, "isSlackReachableImageUrl", { enumerable: true, get: function () { return slack_1.isSlackReachableImageUrl; } });
20
+ Object.defineProperty(exports, "isUnmodeledSlackBlock", { enumerable: true, get: function () { return slack_1.isUnmodeledSlackBlock; } });
19
21
  Object.defineProperty(exports, "italic", { enumerable: true, get: function () { return slack_1.italic; } });
20
22
  Object.defineProperty(exports, "link", { enumerable: true, get: function () { return slack_1.link; } });
21
23
  Object.defineProperty(exports, "markdownContentToSlackBlocks", { enumerable: true, get: function () { return slack_1.markdownContentToSlackBlocks; } });
22
24
  Object.defineProperty(exports, "renderSlackEnvelope", { enumerable: true, get: function () { return slack_1.renderSlackEnvelope; } });
25
+ Object.defineProperty(exports, "slackContainer", { enumerable: true, get: function () { return slack_1.slackContainer; } });
23
26
  Object.defineProperty(exports, "slackLinkUrl", { enumerable: true, get: function () { return slack_1.slackLinkUrl; } });
24
27
  Object.defineProperty(exports, "strike", { enumerable: true, get: function () { return slack_1.strike; } });
28
+ Object.defineProperty(exports, "unmodeledSlackBlock", { enumerable: true, get: function () { return slack_1.unmodeledSlackBlock; } });
25
29
  //# sourceMappingURL=slack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slack.js","sourceRoot":"","sources":["../../../src/entries/slack.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yCA4DyB;AAdvB,qGAAA,YAAY,OAAA;AACZ,6FAAA,IAAI,OAAA;AACJ,uGAAA,cAAc,OAAA;AACd,6FAAA,IAAI,OAAA;AACJ,kGAAA,SAAS,OAAA;AACT,kHAAA,yBAAyB,OAAA;AACzB,qGAAA,YAAY,OAAA;AACZ,iHAAA,wBAAwB,OAAA;AACxB,+FAAA,MAAM,OAAA;AACN,6FAAA,IAAI,OAAA;AACJ,qHAAA,4BAA4B,OAAA;AAC5B,4GAAA,mBAAmB,OAAA;AACnB,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA","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 {\n type SlackActionElement,\n type SlackActionsBlock,\n type SlackAssetCollector,\n type SlackAssetRequest,\n type SlackBlock,\n type SlackButtonElement,\n type SlackCheckboxesElement,\n type SlackContextBlock,\n type SlackDividerBlock,\n type SlackEnvelopeDispatcher,\n type SlackEnvelopeOptions,\n type SlackEnvelopeResult,\n type SlackFileReference,\n type SlackHeaderBlock,\n type SlackHeaderLevel,\n type SlackImageBlock,\n type SlackImageElement,\n type SlackMrkdwnTextObject,\n type SlackMultiStaticSelectElement,\n type SlackOptionGroup,\n type SlackOptionObject,\n type SlackOverflowElement,\n type SlackPlainTextObject,\n type SlackRadioButtonsElement,\n type SlackRawTextElement,\n type SlackRichTextBlock,\n type SlackRichTextBlockElement,\n type SlackRichTextInline,\n type SlackRichTextLink,\n type SlackRichTextList,\n type SlackRichTextPreformatted,\n type SlackRichTextQuote,\n type SlackRichTextSection,\n type SlackRichTextStyle,\n type SlackRichTextTag,\n type SlackRichTextText,\n type SlackSectionAccessory,\n type SlackSectionBlock,\n type SlackStaticSelectElement,\n type SlackTableBlock,\n type SlackTableCell,\n type SlackTableColumnSetting,\n type SlackTagColor,\n type SlackTextObject,\n type SlackVideoBlock,\n SLACK_LIMITS,\n bold,\n clampSlackText,\n code,\n codeBlock,\n createSlackAssetCollector,\n escapeMrkdwn,\n isSlackReachableImageUrl,\n italic,\n link,\n markdownContentToSlackBlocks,\n renderSlackEnvelope,\n slackLinkUrl,\n strike,\n} from '../render/slack';\n"]}
1
+ {"version":3,"file":"slack.js","sourceRoot":"","sources":["../../../src/entries/slack.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yCAoEyB;AAlBvB,qGAAA,YAAY,OAAA;AACZ,6FAAA,IAAI,OAAA;AACJ,uGAAA,cAAc,OAAA;AACd,6FAAA,IAAI,OAAA;AACJ,kGAAA,SAAS,OAAA;AACT,kHAAA,yBAAyB,OAAA;AACzB,qGAAA,YAAY,OAAA;AACZ,gHAAA,uBAAuB,OAAA;AACvB,iHAAA,wBAAwB,OAAA;AACxB,8GAAA,qBAAqB,OAAA;AACrB,+FAAA,MAAM,OAAA;AACN,6FAAA,IAAI,OAAA;AACJ,qHAAA,4BAA4B,OAAA;AAC5B,4GAAA,mBAAmB,OAAA;AACnB,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,4GAAA,mBAAmB,OAAA","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 {\n type SlackActionElement,\n type SlackActionsBlock,\n type SlackAssetCollector,\n type SlackAssetRequest,\n type SlackBlock,\n type SlackButtonElement,\n type SlackCheckboxesElement,\n type SlackContainerBlock,\n type SlackContainerChildBlock,\n type SlackContainerOptions,\n type SlackContextBlock,\n type SlackDividerBlock,\n type SlackEnvelopeDispatcher,\n type SlackEnvelopeOptions,\n type SlackEnvelopeResult,\n type SlackFileReference,\n type SlackHeaderBlock,\n type SlackHeaderLevel,\n type SlackImageBlock,\n type SlackImageElement,\n type SlackLinkOptions,\n type SlackMrkdwnTextObject,\n type SlackMultiStaticSelectElement,\n type SlackOptionGroup,\n type SlackOptionObject,\n type SlackOverflowElement,\n type SlackPlainTextObject,\n type SlackRadioButtonsElement,\n type SlackRawTextElement,\n type SlackRichTextBlock,\n type SlackRichTextBlockElement,\n type SlackRichTextInline,\n type SlackRichTextLink,\n type SlackRichTextList,\n type SlackRichTextPreformatted,\n type SlackRichTextQuote,\n type SlackRichTextSection,\n type SlackRichTextStyle,\n type SlackRichTextTag,\n type SlackRichTextText,\n type SlackSectionAccessory,\n type SlackSectionBlock,\n type SlackStaticSelectElement,\n type SlackTableBlock,\n type SlackTableCell,\n type SlackTableColumnSetting,\n type SlackTagColor,\n type SlackTextObject,\n type SlackVideoBlock,\n SLACK_LIMITS,\n bold,\n clampSlackText,\n code,\n codeBlock,\n createSlackAssetCollector,\n escapeMrkdwn,\n isModeledSlackBlockType,\n isSlackReachableImageUrl,\n isUnmodeledSlackBlock,\n italic,\n link,\n markdownContentToSlackBlocks,\n renderSlackEnvelope,\n slackContainer,\n slackLinkUrl,\n strike,\n unmodeledSlackBlock,\n} from '../render/slack';\n"]}