@elastic/isomer-sdk 0.0.0 → 0.1.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.
- package/LICENSE.txt +93 -0
- package/NOTICE.txt +1861 -0
- package/README.md +58 -0
- package/THIRD_PARTY_LICENSES.md +957 -0
- package/dist/author/authored_fields.d.ts +103 -0
- package/dist/author/authored_fields.d.ts.map +1 -0
- package/dist/author/authored_fields.js +183 -0
- package/dist/author/authored_fields.js.map +1 -0
- package/dist/author/index.d.ts +5 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +10 -0
- package/dist/author/index.js.map +1 -0
- package/dist/author/jsx.d.ts +21 -0
- package/dist/author/jsx.d.ts.map +1 -0
- package/dist/author/jsx.js +20 -0
- package/dist/author/jsx.js.map +1 -0
- package/dist/author/jsx_shim.d.ts +116 -0
- package/dist/author/jsx_shim.d.ts.map +1 -0
- package/dist/author/jsx_shim.js +353 -0
- package/dist/author/jsx_shim.js.map +1 -0
- package/dist/author/prompt.d.ts +58 -0
- package/dist/author/prompt.d.ts.map +1 -0
- package/dist/author/prompt.js +148 -0
- package/dist/author/prompt.js.map +1 -0
- package/dist/cjs/author/authored_fields.js +189 -0
- package/dist/cjs/author/authored_fields.js.map +1 -0
- package/dist/cjs/author/index.js +20 -0
- package/dist/cjs/author/index.js.map +1 -0
- package/dist/cjs/author/jsx.js +24 -0
- package/dist/cjs/author/jsx.js.map +1 -0
- package/dist/cjs/author/jsx_shim.js +359 -0
- package/dist/cjs/author/jsx_shim.js.map +1 -0
- package/dist/cjs/author/prompt.js +153 -0
- package/dist/cjs/author/prompt.js.map +1 -0
- package/dist/cjs/composition/action_event.js +9 -0
- package/dist/cjs/composition/action_event.js.map +1 -0
- package/dist/cjs/composition/body_node_base.js +105 -0
- package/dist/cjs/composition/body_node_base.js.map +1 -0
- package/dist/cjs/composition/composition.js +9 -0
- package/dist/cjs/composition/composition.js.map +1 -0
- package/dist/cjs/composition/error.js +72 -0
- package/dist/cjs/composition/error.js.map +1 -0
- package/dist/cjs/composition/index.js +31 -0
- package/dist/cjs/composition/index.js.map +1 -0
- package/dist/cjs/composition/map_nodes.js +85 -0
- package/dist/cjs/composition/map_nodes.js.map +1 -0
- package/dist/cjs/composition/named_color.js +20 -0
- package/dist/cjs/composition/named_color.js.map +1 -0
- package/dist/cjs/composition/node.js +9 -0
- package/dist/cjs/composition/node.js.map +1 -0
- package/dist/cjs/composition/one_line.js +23 -0
- package/dist/cjs/composition/one_line.js.map +1 -0
- package/dist/cjs/composition/structured_value.js +21 -0
- package/dist/cjs/composition/structured_value.js.map +1 -0
- package/dist/cjs/composition/validation_error.js +40 -0
- package/dist/cjs/composition/validation_error.js.map +1 -0
- package/dist/cjs/define/frame.js +32 -0
- package/dist/cjs/define/frame.js.map +1 -0
- package/dist/cjs/define/index.js +25 -0
- package/dist/cjs/define/index.js.map +1 -0
- package/dist/cjs/define/markdown_content.js +12 -0
- package/dist/cjs/define/markdown_content.js.map +1 -0
- package/dist/cjs/define/primitive_module.js +107 -0
- package/dist/cjs/define/primitive_module.js.map +1 -0
- package/dist/cjs/define/slack_assets.js +9 -0
- package/dist/cjs/define/slack_assets.js.map +1 -0
- package/dist/cjs/define/slack_blocks.js +9 -0
- package/dist/cjs/define/slack_blocks.js.map +1 -0
- package/dist/cjs/define/zod_format.js +122 -0
- package/dist/cjs/define/zod_format.js.map +1 -0
- package/dist/cjs/define/zod_helpers.js +26 -0
- package/dist/cjs/define/zod_helpers.js.map +1 -0
- package/dist/cjs/entries/html.js +12 -0
- package/dist/cjs/entries/html.js.map +1 -0
- package/dist/cjs/entries/index.js +75 -0
- package/dist/cjs/entries/index.js.map +1 -0
- package/dist/cjs/entries/markdown.js +14 -0
- package/dist/cjs/entries/markdown.js.map +1 -0
- package/dist/cjs/entries/react.js +20 -0
- package/dist/cjs/entries/react.js.map +1 -0
- package/dist/cjs/entries/slack.js +26 -0
- package/dist/cjs/entries/slack.js.map +1 -0
- package/dist/cjs/entries/text.js +12 -0
- package/dist/cjs/entries/text.js.map +1 -0
- package/dist/cjs/pack/capabilities.js +34 -0
- package/dist/cjs/pack/capabilities.js.map +1 -0
- package/dist/cjs/pack/compose.js +56 -0
- package/dist/cjs/pack/compose.js.map +1 -0
- package/dist/cjs/pack/enhancements.js +65 -0
- package/dist/cjs/pack/enhancements.js.map +1 -0
- package/dist/cjs/pack/index.js +18 -0
- package/dist/cjs/pack/index.js.map +1 -0
- package/dist/cjs/pack/primitive_pack.js +85 -0
- package/dist/cjs/pack/primitive_pack.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/render/anchors.js +167 -0
- package/dist/cjs/render/anchors.js.map +1 -0
- package/dist/cjs/render/context_view.js +54 -0
- package/dist/cjs/render/context_view.js.map +1 -0
- package/dist/cjs/render/format_display_value.js +143 -0
- package/dist/cjs/render/format_display_value.js.map +1 -0
- package/dist/cjs/render/format_number.js +46 -0
- package/dist/cjs/render/format_number.js.map +1 -0
- package/dist/cjs/render/html/enhancements.js +30 -0
- package/dist/cjs/render/html/enhancements.js.map +1 -0
- package/dist/cjs/render/html/envelope.js +218 -0
- package/dist/cjs/render/html/envelope.js.map +1 -0
- package/dist/cjs/render/html/index.js +12 -0
- package/dist/cjs/render/html/index.js.map +1 -0
- package/dist/cjs/render/index.js +25 -0
- package/dist/cjs/render/index.js.map +1 -0
- package/dist/cjs/render/layout_check.js +133 -0
- package/dist/cjs/render/layout_check.js.map +1 -0
- package/dist/cjs/render/markdown/builder.js +189 -0
- package/dist/cjs/render/markdown/builder.js.map +1 -0
- package/dist/cjs/render/markdown/envelope.js +33 -0
- package/dist/cjs/render/markdown/envelope.js.map +1 -0
- package/dist/cjs/render/markdown/format.js +190 -0
- package/dist/cjs/render/markdown/format.js.map +1 -0
- package/dist/cjs/render/markdown/index.js +15 -0
- package/dist/cjs/render/markdown/index.js.map +1 -0
- package/dist/cjs/render/measure_dom.js +61 -0
- package/dist/cjs/render/measure_dom.js.map +1 -0
- package/dist/cjs/render/payload.js +13 -0
- package/dist/cjs/render/payload.js.map +1 -0
- package/dist/cjs/render/primitive_dispatch.js +187 -0
- package/dist/cjs/render/primitive_dispatch.js.map +1 -0
- package/dist/cjs/render/react/content.js +44 -0
- package/dist/cjs/render/react/content.js.map +1 -0
- package/dist/cjs/render/react/enhancements.js +32 -0
- package/dist/cjs/render/react/enhancements.js.map +1 -0
- package/dist/cjs/render/react/index.js +15 -0
- package/dist/cjs/render/react/index.js.map +1 -0
- package/dist/cjs/render/slack/assets.js +45 -0
- package/dist/cjs/render/slack/assets.js.map +1 -0
- package/dist/cjs/render/slack/blocks.js +80 -0
- package/dist/cjs/render/slack/blocks.js.map +1 -0
- package/dist/cjs/render/slack/envelope.js +551 -0
- package/dist/cjs/render/slack/envelope.js.map +1 -0
- package/dist/cjs/render/slack/format.js +825 -0
- package/dist/cjs/render/slack/format.js.map +1 -0
- package/dist/cjs/render/slack/index.js +31 -0
- package/dist/cjs/render/slack/index.js.map +1 -0
- package/dist/cjs/render/slack/markdown_content.js +358 -0
- package/dist/cjs/render/slack/markdown_content.js.map +1 -0
- package/dist/cjs/render/text/envelope.js +21 -0
- package/dist/cjs/render/text/envelope.js.map +1 -0
- package/dist/cjs/render/text/index.js +12 -0
- package/dist/cjs/render/text/index.js.map +1 -0
- package/dist/cjs/testing/conformance.js +296 -0
- package/dist/cjs/testing/conformance.js.map +1 -0
- package/dist/cjs/testing/index.js +16 -0
- package/dist/cjs/testing/index.js.map +1 -0
- package/dist/cjs/testing/registration.js +140 -0
- package/dist/cjs/testing/registration.js.map +1 -0
- package/dist/cjs/validate/authoring_schema.js +296 -0
- package/dist/cjs/validate/authoring_schema.js.map +1 -0
- package/dist/cjs/validate/composition_schema.js +135 -0
- package/dist/cjs/validate/composition_schema.js.map +1 -0
- package/dist/cjs/validate/index.js +52 -0
- package/dist/cjs/validate/index.js.map +1 -0
- package/dist/cjs/validate/input_budget.js +156 -0
- package/dist/cjs/validate/input_budget.js.map +1 -0
- package/dist/cjs/validate/json_schema.js +72 -0
- package/dist/cjs/validate/json_schema.js.map +1 -0
- package/dist/cjs/validate/node_issues.js +65 -0
- package/dist/cjs/validate/node_issues.js.map +1 -0
- package/dist/cjs/validate/url.js +116 -0
- package/dist/cjs/validate/url.js.map +1 -0
- package/dist/cjs/validate/validation.js +208 -0
- package/dist/cjs/validate/validation.js.map +1 -0
- package/dist/cjs/validate/value_schemas.js +53 -0
- package/dist/cjs/validate/value_schemas.js.map +1 -0
- package/dist/composition/action_event.d.ts +13 -0
- package/dist/composition/action_event.d.ts.map +1 -0
- package/dist/composition/action_event.js +8 -0
- package/dist/composition/action_event.js.map +1 -0
- package/dist/composition/body_node_base.d.ts +71 -0
- package/dist/composition/body_node_base.d.ts.map +1 -0
- package/dist/composition/body_node_base.js +97 -0
- package/dist/composition/body_node_base.js.map +1 -0
- package/dist/composition/composition.d.ts +71 -0
- package/dist/composition/composition.d.ts.map +1 -0
- package/dist/composition/composition.js +8 -0
- package/dist/composition/composition.js.map +1 -0
- package/dist/composition/error.d.ts +60 -0
- package/dist/composition/error.d.ts.map +1 -0
- package/dist/composition/error.js +68 -0
- package/dist/composition/error.js.map +1 -0
- package/dist/composition/index.d.ts +11 -0
- package/dist/composition/index.d.ts.map +1 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/composition/map_nodes.d.ts +16 -0
- package/dist/composition/map_nodes.d.ts.map +1 -0
- package/dist/composition/map_nodes.js +81 -0
- package/dist/composition/map_nodes.js.map +1 -0
- package/dist/composition/named_color.d.ts +9 -0
- package/dist/composition/named_color.d.ts.map +1 -0
- package/dist/composition/named_color.js +17 -0
- package/dist/composition/named_color.js.map +1 -0
- package/dist/composition/node.d.ts +11 -0
- package/dist/composition/node.d.ts.map +1 -0
- package/dist/composition/node.js +8 -0
- package/dist/composition/node.js.map +1 -0
- package/dist/composition/one_line.d.ts +7 -0
- package/dist/composition/one_line.d.ts.map +1 -0
- package/dist/composition/one_line.js +17 -0
- package/dist/composition/one_line.js.map +1 -0
- package/dist/composition/structured_value.d.ts +27 -0
- package/dist/composition/structured_value.d.ts.map +1 -0
- package/dist/composition/structured_value.js +18 -0
- package/dist/composition/structured_value.js.map +1 -0
- package/dist/composition/validation_error.d.ts +33 -0
- package/dist/composition/validation_error.d.ts.map +1 -0
- package/dist/composition/validation_error.js +35 -0
- package/dist/composition/validation_error.js.map +1 -0
- package/dist/define/frame.d.ts +166 -0
- package/dist/define/frame.d.ts.map +1 -0
- package/dist/define/frame.js +28 -0
- package/dist/define/frame.js.map +1 -0
- package/dist/define/index.d.ts +8 -0
- package/dist/define/index.d.ts.map +1 -0
- package/dist/define/index.js +11 -0
- package/dist/define/index.js.map +1 -0
- package/dist/define/markdown_content.d.ts +15 -0
- package/dist/define/markdown_content.d.ts.map +1 -0
- package/dist/define/markdown_content.js +9 -0
- package/dist/define/markdown_content.js.map +1 -0
- package/dist/define/primitive_module.d.ts +421 -0
- package/dist/define/primitive_module.d.ts.map +1 -0
- package/dist/define/primitive_module.js +101 -0
- package/dist/define/primitive_module.js.map +1 -0
- package/dist/define/slack_assets.d.ts +28 -0
- package/dist/define/slack_assets.d.ts.map +1 -0
- package/dist/define/slack_assets.js +8 -0
- package/dist/define/slack_assets.js.map +1 -0
- package/dist/define/slack_blocks.d.ts +234 -0
- package/dist/define/slack_blocks.d.ts.map +1 -0
- package/dist/define/slack_blocks.js +8 -0
- package/dist/define/slack_blocks.js.map +1 -0
- package/dist/define/zod_format.d.ts +33 -0
- package/dist/define/zod_format.d.ts.map +1 -0
- package/dist/define/zod_format.js +114 -0
- package/dist/define/zod_format.js.map +1 -0
- package/dist/define/zod_helpers.d.ts +10 -0
- package/dist/define/zod_helpers.d.ts.map +1 -0
- package/dist/define/zod_helpers.js +22 -0
- package/dist/define/zod_helpers.js.map +1 -0
- package/dist/entries/html.d.ts +3 -0
- package/dist/entries/html.d.ts.map +1 -0
- package/dist/entries/html.js +8 -0
- package/dist/entries/html.js.map +1 -0
- package/dist/entries/index.d.ts +6 -0
- package/dist/entries/index.d.ts.map +1 -0
- package/dist/entries/index.js +12 -0
- package/dist/entries/index.js.map +1 -0
- package/dist/entries/markdown.d.ts +3 -0
- package/dist/entries/markdown.d.ts.map +1 -0
- package/dist/entries/markdown.js +8 -0
- package/dist/entries/markdown.js.map +1 -0
- package/dist/entries/react.d.ts +5 -0
- package/dist/entries/react.d.ts.map +1 -0
- package/dist/entries/react.js +11 -0
- package/dist/entries/react.js.map +1 -0
- package/dist/entries/slack.d.ts +2 -0
- package/dist/entries/slack.d.ts.map +1 -0
- package/dist/entries/slack.js +8 -0
- package/dist/entries/slack.js.map +1 -0
- package/dist/entries/text.d.ts +2 -0
- package/dist/entries/text.d.ts.map +1 -0
- package/dist/entries/text.js +8 -0
- package/dist/entries/text.js.map +1 -0
- package/dist/pack/capabilities.d.ts +27 -0
- package/dist/pack/capabilities.d.ts.map +1 -0
- package/dist/pack/capabilities.js +30 -0
- package/dist/pack/capabilities.js.map +1 -0
- package/dist/pack/compose.d.ts +21 -0
- package/dist/pack/compose.d.ts.map +1 -0
- package/dist/pack/compose.js +52 -0
- package/dist/pack/compose.js.map +1 -0
- package/dist/pack/enhancements.d.ts +65 -0
- package/dist/pack/enhancements.d.ts.map +1 -0
- package/dist/pack/enhancements.js +59 -0
- package/dist/pack/enhancements.js.map +1 -0
- package/dist/pack/index.d.ts +5 -0
- package/dist/pack/index.d.ts.map +1 -0
- package/dist/pack/index.js +11 -0
- package/dist/pack/index.js.map +1 -0
- package/dist/pack/primitive_pack.d.ts +155 -0
- package/dist/pack/primitive_pack.d.ts.map +1 -0
- package/dist/pack/primitive_pack.js +81 -0
- package/dist/pack/primitive_pack.js.map +1 -0
- package/dist/render/anchors.d.ts +82 -0
- package/dist/render/anchors.d.ts.map +1 -0
- package/dist/render/anchors.js +153 -0
- package/dist/render/anchors.js.map +1 -0
- package/dist/render/context_view.d.ts +10 -0
- package/dist/render/context_view.d.ts.map +1 -0
- package/dist/render/context_view.js +49 -0
- package/dist/render/context_view.js.map +1 -0
- package/dist/render/format_display_value.d.ts +20 -0
- package/dist/render/format_display_value.d.ts.map +1 -0
- package/dist/render/format_display_value.js +137 -0
- package/dist/render/format_display_value.js.map +1 -0
- package/dist/render/format_number.d.ts +9 -0
- package/dist/render/format_number.d.ts.map +1 -0
- package/dist/render/format_number.js +42 -0
- package/dist/render/format_number.js.map +1 -0
- package/dist/render/html/enhancements.d.ts +10 -0
- package/dist/render/html/enhancements.d.ts.map +1 -0
- package/dist/render/html/enhancements.js +25 -0
- package/dist/render/html/enhancements.js.map +1 -0
- package/dist/render/html/envelope.d.ts +182 -0
- package/dist/render/html/envelope.d.ts.map +1 -0
- package/dist/render/html/envelope.js +214 -0
- package/dist/render/html/envelope.js.map +1 -0
- package/dist/render/html/index.d.ts +3 -0
- package/dist/render/html/index.d.ts.map +1 -0
- package/dist/render/html/index.js +8 -0
- package/dist/render/html/index.js.map +1 -0
- package/dist/render/index.d.ts +6 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +11 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/layout_check.d.ts +43 -0
- package/dist/render/layout_check.d.ts.map +1 -0
- package/dist/render/layout_check.js +129 -0
- package/dist/render/layout_check.js.map +1 -0
- package/dist/render/markdown/builder.d.ts +48 -0
- package/dist/render/markdown/builder.d.ts.map +1 -0
- package/dist/render/markdown/builder.js +183 -0
- package/dist/render/markdown/builder.js.map +1 -0
- package/dist/render/markdown/envelope.d.ts +20 -0
- package/dist/render/markdown/envelope.d.ts.map +1 -0
- package/dist/render/markdown/envelope.js +29 -0
- package/dist/render/markdown/envelope.js.map +1 -0
- package/dist/render/markdown/format.d.ts +3 -0
- package/dist/render/markdown/format.d.ts.map +1 -0
- package/dist/render/markdown/format.js +186 -0
- package/dist/render/markdown/format.js.map +1 -0
- package/dist/render/markdown/index.d.ts +3 -0
- package/dist/render/markdown/index.d.ts.map +1 -0
- package/dist/render/markdown/index.js +9 -0
- package/dist/render/markdown/index.js.map +1 -0
- package/dist/render/measure_dom.d.ts +10 -0
- package/dist/render/measure_dom.d.ts.map +1 -0
- package/dist/render/measure_dom.js +57 -0
- package/dist/render/measure_dom.js.map +1 -0
- package/dist/render/payload.d.ts +16 -0
- package/dist/render/payload.d.ts.map +1 -0
- package/dist/render/payload.js +9 -0
- package/dist/render/payload.js.map +1 -0
- package/dist/render/primitive_dispatch.d.ts +72 -0
- package/dist/render/primitive_dispatch.d.ts.map +1 -0
- package/dist/render/primitive_dispatch.js +183 -0
- package/dist/render/primitive_dispatch.js.map +1 -0
- package/dist/render/react/content.d.ts +40 -0
- package/dist/render/react/content.d.ts.map +1 -0
- package/dist/render/react/content.js +39 -0
- package/dist/render/react/content.js.map +1 -0
- package/dist/render/react/enhancements.d.ts +15 -0
- package/dist/render/react/enhancements.d.ts.map +1 -0
- package/dist/render/react/enhancements.js +28 -0
- package/dist/render/react/enhancements.js.map +1 -0
- package/dist/render/react/index.d.ts +3 -0
- package/dist/render/react/index.d.ts.map +1 -0
- package/dist/render/react/index.js +9 -0
- package/dist/render/react/index.js.map +1 -0
- package/dist/render/slack/assets.d.ts +16 -0
- package/dist/render/slack/assets.d.ts.map +1 -0
- package/dist/render/slack/assets.js +40 -0
- package/dist/render/slack/assets.js.map +1 -0
- package/dist/render/slack/blocks.d.ts +72 -0
- package/dist/render/slack/blocks.d.ts.map +1 -0
- package/dist/render/slack/blocks.js +77 -0
- package/dist/render/slack/blocks.js.map +1 -0
- package/dist/render/slack/envelope.d.ts +52 -0
- package/dist/render/slack/envelope.d.ts.map +1 -0
- package/dist/render/slack/envelope.js +547 -0
- package/dist/render/slack/envelope.js.map +1 -0
- package/dist/render/slack/format.d.ts +95 -0
- package/dist/render/slack/format.d.ts.map +1 -0
- package/dist/render/slack/format.js +807 -0
- package/dist/render/slack/format.js.map +1 -0
- package/dist/render/slack/index.d.ts +6 -0
- package/dist/render/slack/index.d.ts.map +1 -0
- package/dist/render/slack/index.js +12 -0
- package/dist/render/slack/index.js.map +1 -0
- package/dist/render/slack/markdown_content.d.ts +11 -0
- package/dist/render/slack/markdown_content.d.ts.map +1 -0
- package/dist/render/slack/markdown_content.js +354 -0
- package/dist/render/slack/markdown_content.js.map +1 -0
- package/dist/render/text/envelope.d.ts +15 -0
- package/dist/render/text/envelope.d.ts.map +1 -0
- package/dist/render/text/envelope.js +17 -0
- package/dist/render/text/envelope.js.map +1 -0
- package/dist/render/text/index.d.ts +2 -0
- package/dist/render/text/index.d.ts.map +1 -0
- package/dist/render/text/index.js +8 -0
- package/dist/render/text/index.js.map +1 -0
- package/dist/testing/conformance.d.ts +140 -0
- package/dist/testing/conformance.d.ts.map +1 -0
- package/dist/testing/conformance.js +287 -0
- package/dist/testing/conformance.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +9 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/registration.d.ts +32 -0
- package/dist/testing/registration.d.ts.map +1 -0
- package/dist/testing/registration.js +103 -0
- package/dist/testing/registration.js.map +1 -0
- package/dist/validate/authoring_schema.d.ts +27 -0
- package/dist/validate/authoring_schema.d.ts.map +1 -0
- package/dist/validate/authoring_schema.js +291 -0
- package/dist/validate/authoring_schema.js.map +1 -0
- package/dist/validate/composition_schema.d.ts +80 -0
- package/dist/validate/composition_schema.d.ts.map +1 -0
- package/dist/validate/composition_schema.js +127 -0
- package/dist/validate/composition_schema.js.map +1 -0
- package/dist/validate/index.d.ts +9 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +15 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/validate/input_budget.d.ts +35 -0
- package/dist/validate/input_budget.d.ts.map +1 -0
- package/dist/validate/input_budget.js +151 -0
- package/dist/validate/input_budget.js.map +1 -0
- package/dist/validate/json_schema.d.ts +32 -0
- package/dist/validate/json_schema.d.ts.map +1 -0
- package/dist/validate/json_schema.js +68 -0
- package/dist/validate/json_schema.js.map +1 -0
- package/dist/validate/node_issues.d.ts +12 -0
- package/dist/validate/node_issues.d.ts.map +1 -0
- package/dist/validate/node_issues.js +61 -0
- package/dist/validate/node_issues.js.map +1 -0
- package/dist/validate/url.d.ts +50 -0
- package/dist/validate/url.d.ts.map +1 -0
- package/dist/validate/url.js +107 -0
- package/dist/validate/url.js.map +1 -0
- package/dist/validate/validation.d.ts +105 -0
- package/dist/validate/validation.d.ts.map +1 -0
- package/dist/validate/validation.js +200 -0
- package/dist/validate/validation.js.map +1 -0
- package/dist/validate/value_schemas.d.ts +53 -0
- package/dist/validate/value_schemas.d.ts.map +1 -0
- package/dist/validate/value_schemas.js +50 -0
- package/dist/validate/value_schemas.js.map +1 -0
- package/package.json +118 -5
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
6
|
+
* 2.0.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.renderTextEnvelope = void 0;
|
|
10
|
+
var envelope_1 = require("./envelope");
|
|
11
|
+
Object.defineProperty(exports, "renderTextEnvelope", { enumerable: true, get: function () { return envelope_1.renderTextEnvelope; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/render/text/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uCAIoB;AADlB,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 TextEnvelopeDispatcher,\n type TextEnvelopeOptions,\n renderTextEnvelope,\n} from './envelope';\n"]}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
6
|
+
* 2.0.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.primitiveConformanceCases = exports.runPrimitiveInventoryConformance = exports.primitiveConformanceRows = exports.examplesFromDefinitions = exports.CONFORMANCE_FOREIGN_MARKER = void 0;
|
|
13
|
+
// The behaviour every primitive definition owes its callers, expressed once.
|
|
14
|
+
//
|
|
15
|
+
// Framework-agnostic on purpose: only `node:assert/strict` and Node builtins,
|
|
16
|
+
// so this ships on a public entry without dragging vitest into a vocabulary
|
|
17
|
+
// package's dependency set. Each pack drives the array with `it.each`, so a
|
|
18
|
+
// second vocabulary costs one package and one test file.
|
|
19
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
20
|
+
const anchors_1 = require("../render/anchors");
|
|
21
|
+
const input_budget_1 = require("../validate/input_budget");
|
|
22
|
+
/**
|
|
23
|
+
* The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}
|
|
24
|
+
* hands a container must render text/markdown containing this string, or the
|
|
25
|
+
* cross-pack nesting case cannot tell a dropped child from an empty one.
|
|
26
|
+
*/
|
|
27
|
+
exports.CONFORMANCE_FOREIGN_MARKER = '__isomer_conformance_foreign__';
|
|
28
|
+
/** Every definition's examples, flattened to one row each. */
|
|
29
|
+
const examplesFromDefinitions = (definitions) => definitions.flatMap((definition) => definition.examples.map((node, exampleIndex) => ({
|
|
30
|
+
definition,
|
|
31
|
+
type: definition.type,
|
|
32
|
+
exampleIndex,
|
|
33
|
+
node,
|
|
34
|
+
})));
|
|
35
|
+
exports.examplesFromDefinitions = examplesFromDefinitions;
|
|
36
|
+
/** Every example crossed with every case, shaped for `it.each`. */
|
|
37
|
+
const primitiveConformanceRows = (definitions) => (0, exports.examplesFromDefinitions)(definitions).flatMap((example) => exports.primitiveConformanceCases.map((conformanceCase) => ({
|
|
38
|
+
...example,
|
|
39
|
+
...conformanceCase,
|
|
40
|
+
})));
|
|
41
|
+
exports.primitiveConformanceRows = primitiveConformanceRows;
|
|
42
|
+
/**
|
|
43
|
+
* Asserts the inventory itself holds up: the pack has examples, every
|
|
44
|
+
* definition contributes one, each example's `type` matches its definition,
|
|
45
|
+
* and `catalog.example` is within the input budget and parses or matches a
|
|
46
|
+
* published example.
|
|
47
|
+
*/
|
|
48
|
+
const runPrimitiveInventoryConformance = (definitions) => {
|
|
49
|
+
const examples = (0, exports.examplesFromDefinitions)(definitions);
|
|
50
|
+
strict_1.default.ok(examples.length > 0, 'expected at least one primitive example');
|
|
51
|
+
for (const definition of definitions) {
|
|
52
|
+
strict_1.default.ok(definition.examples.length > 0, `${definition.type} primitive must expose at least one example`);
|
|
53
|
+
const checked = (0, input_budget_1.checkInputBudget)(definition.catalog.example);
|
|
54
|
+
if (!checked.valid) {
|
|
55
|
+
strict_1.default.fail(`${definition.type} catalog.example must be within the input budget: ${checked.error.message}`);
|
|
56
|
+
}
|
|
57
|
+
const catalogExample = checked.value;
|
|
58
|
+
const matchesPublished = definition.examples.some((node) => {
|
|
59
|
+
const published = (0, input_budget_1.checkInputBudget)(node);
|
|
60
|
+
return (published.valid &&
|
|
61
|
+
JSON.stringify(published.value) === JSON.stringify(catalogExample));
|
|
62
|
+
});
|
|
63
|
+
if (matchesPublished) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const parsed = definition.schema.safeParse(catalogExample);
|
|
67
|
+
strict_1.default.ok(parsed.success, `${definition.type} catalog.example must parse against its schema or match a published example`);
|
|
68
|
+
}
|
|
69
|
+
for (const { type, node } of examples) {
|
|
70
|
+
strict_1.default.equal(node.type, type);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.runPrimitiveInventoryConformance = runPrimitiveInventoryConformance;
|
|
74
|
+
const previewHint = (type, exampleIndex) => `Failing example: \`${type}\` definition, examples[${exampleIndex}].`;
|
|
75
|
+
const renderedClassNames = (html) => {
|
|
76
|
+
const classNames = new Set();
|
|
77
|
+
for (const match of html.matchAll(/\bclass="([^"]+)"/g)) {
|
|
78
|
+
match[1]
|
|
79
|
+
.split(/\s+/)
|
|
80
|
+
.filter(Boolean)
|
|
81
|
+
.forEach((className) => classNames.add(className));
|
|
82
|
+
}
|
|
83
|
+
return [...classNames].sort();
|
|
84
|
+
};
|
|
85
|
+
/** The node anchor values in serialized `html`, in document order. */
|
|
86
|
+
const renderedAnchors = (html) => {
|
|
87
|
+
const attribute = new RegExp(`\\s${anchors_1.NODE_ANCHOR_ATTRIBUTE}="([^"]*)"`);
|
|
88
|
+
// Only opening tags: the serializer escapes `<`, `>`, and `"` in text and attribute values.
|
|
89
|
+
return [...html.matchAll(/<[a-zA-Z][^>]*>/g)].flatMap(([tag]) => {
|
|
90
|
+
const [, value] = attribute.exec(tag) ?? [];
|
|
91
|
+
return value === undefined ? [] : [value];
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const cssEscapeClass = (className) => className.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '\\$1');
|
|
95
|
+
const cssHasClassSelector = (css, className) => new RegExp(`\\.${cssEscapeClass(className)}(?![\\w-])`).test(css);
|
|
96
|
+
/**
|
|
97
|
+
* Every assertion a primitive owes its callers, for a pack to drive with
|
|
98
|
+
* `it.each`.
|
|
99
|
+
*/
|
|
100
|
+
exports.primitiveConformanceCases = [
|
|
101
|
+
{
|
|
102
|
+
name: 'validates as a primitive node and inside a composition',
|
|
103
|
+
run: ({ type, exampleIndex, node }, harness) => {
|
|
104
|
+
const hint = previewHint(type, exampleIndex);
|
|
105
|
+
const primitiveErrors = [...harness.validateNode(node)];
|
|
106
|
+
strict_1.default.deepEqual(primitiveErrors, [], hint);
|
|
107
|
+
const result = harness.validateComposition(harness.wrapComposition(node));
|
|
108
|
+
strict_1.default.equal(result.valid, true, hint);
|
|
109
|
+
strict_1.default.deepEqual(result.errors, [], hint);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'renders through React without throwing',
|
|
114
|
+
run: ({ node }, harness) => {
|
|
115
|
+
const rendered = harness.renderReact(node);
|
|
116
|
+
strict_1.default.notEqual(rendered, undefined);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'collects styles without throwing',
|
|
121
|
+
run: ({ node }, harness) => {
|
|
122
|
+
strict_1.default.doesNotThrow(() => harness.collectStyles(node));
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'a container recurses through scope for a node from another pack',
|
|
127
|
+
run: ({ definition, node }, harness) => {
|
|
128
|
+
if (!definition.children || !harness.nestForeignChild) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const nested = harness.nestForeignChild(node);
|
|
132
|
+
strict_1.default.notEqual(harness.renderReact(nested), undefined);
|
|
133
|
+
strict_1.default.ok(harness.renderText(nested).includes(exports.CONFORMANCE_FOREIGN_MARKER));
|
|
134
|
+
strict_1.default.ok(harness.renderMarkdown(nested).includes(exports.CONFORMANCE_FOREIGN_MARKER));
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'renders through plain text with non-empty output',
|
|
139
|
+
run: ({ node }, harness) => {
|
|
140
|
+
const text = harness.renderText(node);
|
|
141
|
+
strict_1.default.equal(typeof text, 'string');
|
|
142
|
+
strict_1.default.ok(text.trim().length > 0);
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'renders through markdown with non-empty output',
|
|
147
|
+
run: ({ node }, harness) => {
|
|
148
|
+
const markdown = harness.renderMarkdown(node);
|
|
149
|
+
strict_1.default.equal(typeof markdown, 'string');
|
|
150
|
+
strict_1.default.ok(markdown.trim().length > 0);
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'renders through Slack dispatch returning at least one block',
|
|
155
|
+
run: ({ node }, harness) => {
|
|
156
|
+
const blocks = harness.renderSlack(node);
|
|
157
|
+
strict_1.default.ok(blocks.length > 0);
|
|
158
|
+
for (const block of blocks) {
|
|
159
|
+
strict_1.default.equal(typeof block, 'object');
|
|
160
|
+
strict_1.default.equal(typeof block.type, 'string');
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'renders through SVG primitive dispatch without throwing',
|
|
166
|
+
run: ({ type, exampleIndex, node }, harness) => {
|
|
167
|
+
if (!harness.renderSvg) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
strict_1.default.doesNotThrow(() => harness.renderSvg?.(node, `conformance-${type}-${exampleIndex}`));
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'reports a positive finite SVG height estimate',
|
|
175
|
+
run: ({ node }, harness) => {
|
|
176
|
+
if (harness.sizesFromNodeHeights === false ||
|
|
177
|
+
!harness.estimateSvgHeight) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const height = harness.estimateSvgHeight(node);
|
|
181
|
+
strict_1.default.equal(Number.isFinite(height), true);
|
|
182
|
+
strict_1.default.ok(height > 0);
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'renders through renderHTML wrapped in a minimal composition',
|
|
187
|
+
run: ({ node }, harness) => {
|
|
188
|
+
if (!harness.renderHTML) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const result = harness.renderHTML(harness.wrapComposition(node));
|
|
192
|
+
strict_1.default.deepEqual(result.validationErrors, []);
|
|
193
|
+
strict_1.default.ok(result.html.includes('<section'));
|
|
194
|
+
strict_1.default.equal(result.measurement.js, 0);
|
|
195
|
+
strict_1.default.ok(result.measurement.total > 0);
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'renders no node anchors unless asked',
|
|
200
|
+
run: ({ node }, harness) => {
|
|
201
|
+
if (!harness.renderHTML) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const { body } = harness.renderHTML(harness.wrapComposition(node));
|
|
205
|
+
strict_1.default.deepEqual(renderedAnchors(body), []);
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'renders a node anchor on every node when asked',
|
|
210
|
+
run: ({ type, exampleIndex, node }, harness) => {
|
|
211
|
+
if (!harness.renderHTML || !harness.anchorWalk) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const composition = harness.wrapComposition(node);
|
|
215
|
+
const { body } = harness.renderHTML(composition, { anchors: true });
|
|
216
|
+
const expected = (0, anchors_1.anchoredNodes)(composition.body, harness.anchorWalk).flatMap((anchored) => {
|
|
217
|
+
const anchoredType = (0, anchors_1.nodeType)(anchored);
|
|
218
|
+
return anchoredType === undefined ? [] : [(0, anchors_1.anchorValue)(anchoredType)];
|
|
219
|
+
});
|
|
220
|
+
strict_1.default.deepEqual(renderedAnchors(body), expected, `Expected one anchor per node, in walker order. ${previewHint(type, exampleIndex)}`);
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'emits CSS where every var(...) reference has a matching declaration',
|
|
225
|
+
run: ({ node }, harness) => {
|
|
226
|
+
if (!harness.renderHTML || !harness.assertVarRefsHaveDeclarations) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const result = harness.renderHTML(harness.wrapComposition(node), {
|
|
230
|
+
css: 'separate',
|
|
231
|
+
});
|
|
232
|
+
harness.assertVarRefsHaveDeclarations(result.css);
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'reaches every rendered readable class in compact CSS collection',
|
|
237
|
+
run: ({ type, exampleIndex, node }, harness) => {
|
|
238
|
+
if (!harness.renderHTML) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const result = harness.renderHTML(harness.wrapComposition(node), {
|
|
242
|
+
css: 'separate',
|
|
243
|
+
names: 'readable',
|
|
244
|
+
});
|
|
245
|
+
const missing = renderedClassNames(result.body).filter((className) => !cssHasClassSelector(result.css, className));
|
|
246
|
+
const hint = `Missing CSS for ${type} example #${exampleIndex}: ` +
|
|
247
|
+
`${missing.join(', ') || '(none)'}. ` +
|
|
248
|
+
previewHint(type, exampleIndex);
|
|
249
|
+
strict_1.default.deepEqual(missing, [], hint);
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: 'renders through renderText wrapped in a minimal composition',
|
|
254
|
+
run: ({ node }, harness) => {
|
|
255
|
+
const text = harness.renderTextComposition(harness.wrapComposition(node));
|
|
256
|
+
strict_1.default.ok(text.length > 0);
|
|
257
|
+
strict_1.default.ok(text.includes('CONFORMANCE FIXTURE'));
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'renders through renderMarkdown wrapped in a minimal composition',
|
|
262
|
+
run: ({ node }, harness) => {
|
|
263
|
+
const markdown = harness.renderMarkdownComposition(harness.wrapComposition(node));
|
|
264
|
+
strict_1.default.ok(markdown.length > 0);
|
|
265
|
+
strict_1.default.ok(markdown.includes('# Conformance fixture'));
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'renders through renderSlack wrapped in a minimal composition',
|
|
270
|
+
run: ({ node }, harness) => {
|
|
271
|
+
const result = harness.renderSlackComposition(harness.wrapComposition(node));
|
|
272
|
+
strict_1.default.ok(result.blocks.length > 0);
|
|
273
|
+
strict_1.default.ok(result.text.length > 0);
|
|
274
|
+
const first = result.blocks[0];
|
|
275
|
+
strict_1.default.ok(first);
|
|
276
|
+
if (first.type !== 'header') {
|
|
277
|
+
strict_1.default.fail(`expected a header block, got ${first.type}`);
|
|
278
|
+
}
|
|
279
|
+
strict_1.default.equal(first.text.type, 'plain_text');
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: 'renders through renderSVG wrapped in a minimal composition',
|
|
284
|
+
run: async ({ node }, harness) => {
|
|
285
|
+
if (!harness.renderSVGComposition) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const result = await harness.renderSVGComposition(harness.wrapComposition(node));
|
|
289
|
+
strict_1.default.deepEqual(result.validationErrors, []);
|
|
290
|
+
strict_1.default.ok(result.svg.includes('<svg'));
|
|
291
|
+
strict_1.default.ok(result.svg.includes('</svg>'));
|
|
292
|
+
strict_1.default.ok(result.measurement.total > 0);
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
];
|
|
296
|
+
//# sourceMappingURL=conformance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.js","sourceRoot":"","sources":["../../../src/testing/conformance.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,yDAAyD;AAEzD,gEAAwC;AASxC,+CAK2B;AAG3B,2DAA4D;AAG5D;;;;GAIG;AACU,QAAA,0BAA0B,GAAG,gCAAgC,CAAC;AA8H3E,8DAA8D;AACvD,MAAM,uBAAuB,GAAG,CACrC,WAA8C,EACN,EAAE,CAC1C,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CACjC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;IAC/C,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;YACpC,gBAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAClC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/B,gBAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;YACjB,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC5B,gBAAM,CAAC,IAAI,CAAC,gCAAgC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5D,CAAC;YACD,gBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;KACF;IACD;QACE,IAAI,EAAE,4DAA4D;QAClE,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE;YAC/B,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBAClC,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAC/C,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAC9B,CAAC;YACF,gBAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YAC9C,gBAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACvC,gBAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;YACzC,gBAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;KACF;CACF,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// The behaviour every primitive definition owes its callers, expressed once.\n//\n// Framework-agnostic on purpose: only `node:assert/strict` and Node builtins,\n// so this ships on a public entry without dragging vitest into a vocabulary\n// package's dependency set. Each pack drives the array with `it.each`, so a\n// second vocabulary costs one package and one test file.\n\nimport assert from 'node:assert/strict';\n\nimport type { ChildNodeWalker } from '../composition/body_node_base';\nimport type { Composition } from '../composition/composition';\nimport type { ValidationError } from '../composition/validation_error';\nimport type {\n AnyPrimitiveDefinition,\n PrimitiveNode,\n} from '../define/primitive_module';\nimport {\n anchoredNodes,\n anchorValue,\n NODE_ANCHOR_ATTRIBUTE,\n nodeType,\n} from '../render/anchors';\nimport type { HTMLRenderResult } from '../render/html/envelope';\nimport type { SlackBlock } from '../render/slack/blocks';\nimport { checkInputBudget } from '../validate/input_budget';\nimport type { ValidationResult } from '../validate/validation';\n\n/**\n * The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}\n * hands a container must render text/markdown containing this string, or the\n * cross-pack nesting case cannot tell a dropped child from an empty one.\n */\nexport const CONFORMANCE_FOREIGN_MARKER = '__isomer_conformance_foreign__';\n\n/** One example node, paired with the definition that published it. */\nexport interface PrimitiveConformanceExample {\n readonly definition: AnyPrimitiveDefinition;\n /** Always `definition.type`, lifted onto the row so `it.each` titles can read it. */\n readonly type: string;\n /** Index into {@link AnyPrimitiveDefinition.examples}, and half of the preview hint a failure prints. */\n readonly exampleIndex: number;\n readonly node: PrimitiveNode;\n}\n\n/** The subset of a host's HTML render options the cases exercise. */\nexport interface PrimitiveConformanceHtmlOptions {\n /** `'separate'` must move the stylesheet out of the markup and into `css`; the CSS cases assert against that field. */\n readonly css?: 'inline' | 'separate';\n /** `'readable'` must emit human-legible class names, which the CSS coverage case matches back against the emitted selectors. */\n readonly names?: string;\n /** Must render node anchors, as the `anchors` HTML render option does. */\n readonly anchors?: boolean;\n}\n\n/** The subset of a host's SVG render result the cases assert on. */\nexport interface PrimitiveConformanceSvgResult {\n /** Must be empty for every published example. */\n readonly validationErrors: readonly ValidationError[];\n readonly svg: string;\n /** `total` is the rendered byte size, and must be positive. */\n readonly measurement: { readonly total: number };\n}\n\n/** The subset of a host's Slack render result the cases assert on. */\nexport interface PrimitiveConformanceSlackResult {\n readonly blocks: readonly SlackBlock[];\n /** Notification fallback text. Must be non-empty. */\n readonly text: string;\n}\n\n/**\n * Pack-owned render and validation bindings. The cases cannot import a\n * vocabulary package, so the pack closes over its dispatcher, frame, and\n * theme when it builds this object.\n *\n * Unsuffixed members take a single node; the `Composition`-suffixed ones take\n * a whole {@link Composition}. Optional members gate the cases that need\n * them, so a pack supplies only what its surfaces can answer.\n */\nexport interface PrimitiveConformanceHarness {\n /**\n * The smallest composition that carries one node. Its `title` must be\n * `'Conformance fixture'`, which the envelope cases look for as\n * `CONFORMANCE FIXTURE` in text and `# Conformance fixture` in markdown.\n */\n wrapComposition(node: PrimitiveNode): Composition;\n /** Validation errors for the node on its own. Must be empty for every published example. */\n validateNode(node: PrimitiveNode): readonly ValidationError[];\n /** Whole-composition validation. Must be `valid` with no `errors` for a wrapped example. */\n validateComposition(composition: Composition): ValidationResult;\n /** Must return something other than `undefined`; the case does not mount the element. */\n renderReact(node: PrimitiveNode): unknown;\n /** Drives the pack's style collection for one node. Must not throw. */\n collectStyles(node: PrimitiveNode): void;\n /** Must return a string with non-whitespace content. */\n renderText(node: PrimitiveNode): string;\n /** Must return a string with non-whitespace content. */\n renderMarkdown(node: PrimitiveNode): string;\n /** Must return at least one block, each an object with a string `type`. */\n renderSlack(node: PrimitiveNode): readonly SlackBlock[];\n /** `key` is unique per example and only has to survive into the React tree. Must not throw. Omit for a pack with no `svg` path. */\n renderSvg?(node: PrimitiveNode, key: string): unknown;\n /** Must be finite and greater than zero, so a frame can lay the node out unrendered. Omit for a pack with no `svg` path. */\n estimateSvgHeight?(node: PrimitiveNode): number;\n /**\n * Set `false` for packs whose frame is fixed-size (`sizesFromNodeHeights: false`).\n * Skips the positive-finite height assertion, which no fixed-frame pack can satisfy.\n */\n sizesFromNodeHeights?: boolean;\n /**\n * For a container example, returns `container` with one of its children\n * replaced by a node from a pack the harness composed in only for this\n * check — never one `container`'s own pack registers. That node's `text`\n * and `markdown` renderers must emit {@link CONFORMANCE_FOREIGN_MARKER}.\n * Omit to skip the cross-pack nesting case.\n */\n nestForeignChild?(container: PrimitiveNode): PrimitiveNode;\n /**\n * Must honor {@link PrimitiveConformanceHtmlOptions}. Cases assert the\n * markup wraps the body in a `<section>`, that `measurement.js` is zero, and\n * that `validationErrors` is empty. Omit to skip the HTML cases.\n */\n renderHTML?(\n composition: Composition,\n options?: PrimitiveConformanceHtmlOptions\n ): HTMLRenderResult;\n /**\n * The child walker over every definition the harness renders with. Set it\n * once every `react` renderer spreads `nodeAnchor` on its root; the anchor\n * case then asserts each node renders one.\n */\n anchorWalk?: ChildNodeWalker;\n /** Must throw when `css` references a `var(--name)` it never declares. Omit to skip the CSS variable case. */\n assertVarRefsHaveDeclarations?(css: string): void;\n /** Whole-composition text render, title envelope included. */\n renderTextComposition(composition: Composition): string;\n /** Whole-composition markdown render, title heading included. */\n renderMarkdownComposition(composition: Composition): string;\n /** Must lead with a `plain_text` header block carrying the composition title. */\n renderSlackComposition(\n composition: Composition\n ): PrimitiveConformanceSlackResult;\n /** Must resolve to complete `<svg>`/`</svg>` markup with no validation errors. Omit for a pack with no frame. */\n renderSVGComposition?(\n composition: Composition\n ): Promise<PrimitiveConformanceSvgResult>;\n}\n\n/** One assertion, run once per example. */\nexport interface PrimitiveConformanceCase {\n readonly name: string;\n /** Signals failure by throwing. May be async, so a pack must await it. */\n readonly run: (\n example: PrimitiveConformanceExample,\n harness: PrimitiveConformanceHarness\n ) => void | Promise<void>;\n}\n\n/** Every definition's examples, flattened to one row each. */\nexport const examplesFromDefinitions = (\n definitions: readonly AnyPrimitiveDefinition[]\n): readonly PrimitiveConformanceExample[] =>\n definitions.flatMap((definition) =>\n definition.examples.map((node, exampleIndex) => ({\n definition,\n type: definition.type,\n exampleIndex,\n node,\n }))\n );\n\n/** Every example crossed with every case, shaped for `it.each`. */\nexport const primitiveConformanceRows = (\n definitions: readonly AnyPrimitiveDefinition[]\n): readonly (PrimitiveConformanceExample & PrimitiveConformanceCase)[] =>\n examplesFromDefinitions(definitions).flatMap((example) =>\n primitiveConformanceCases.map((conformanceCase) => ({\n ...example,\n ...conformanceCase,\n }))\n );\n\n/**\n * Asserts the inventory itself holds up: the pack has examples, every\n * definition contributes one, each example's `type` matches its definition,\n * and `catalog.example` is within the input budget and parses or matches a\n * published example.\n */\nexport const runPrimitiveInventoryConformance = (\n definitions: readonly AnyPrimitiveDefinition[]\n): void => {\n const examples = examplesFromDefinitions(definitions);\n assert.ok(examples.length > 0, 'expected at least one primitive example');\n for (const definition of definitions) {\n assert.ok(\n definition.examples.length > 0,\n `${definition.type} primitive must expose at least one example`\n );\n const checked = checkInputBudget(definition.catalog.example);\n if (!checked.valid) {\n assert.fail(\n `${definition.type} catalog.example must be within the input budget: ${checked.error.message}`\n );\n }\n const catalogExample = checked.value;\n const matchesPublished = definition.examples.some((node) => {\n const published = checkInputBudget(node);\n return (\n published.valid &&\n JSON.stringify(published.value) === JSON.stringify(catalogExample)\n );\n });\n if (matchesPublished) {\n continue;\n }\n const parsed = definition.schema.safeParse(catalogExample);\n assert.ok(\n parsed.success,\n `${definition.type} catalog.example must parse against its schema or match a published example`\n );\n }\n for (const { type, node } of examples) {\n assert.equal(node.type, type);\n }\n};\n\nconst previewHint = (type: string, exampleIndex: number): string =>\n `Failing example: \\`${type}\\` definition, examples[${exampleIndex}].`;\n\nconst renderedClassNames = (html: string): string[] => {\n const classNames = new Set<string>();\n for (const match of html.matchAll(/\\bclass=\"([^\"]+)\"/g)) {\n match[1]!\n .split(/\\s+/)\n .filter(Boolean)\n .forEach((className) => classNames.add(className));\n }\n return [...classNames].sort();\n};\n\n/** The node anchor values in serialized `html`, in document order. */\nconst renderedAnchors = (html: string): string[] => {\n const attribute = new RegExp(`\\\\s${NODE_ANCHOR_ATTRIBUTE}=\"([^\"]*)\"`);\n // Only opening tags: the serializer escapes `<`, `>`, and `\"` in text and attribute values.\n return [...html.matchAll(/<[a-zA-Z][^>]*>/g)].flatMap(([tag]) => {\n const [, value] = attribute.exec(tag) ?? [];\n return value === undefined ? [] : [value];\n });\n};\n\nconst cssEscapeClass = (className: string): string =>\n className.replace(/([!\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~])/g, '\\\\$1');\n\nconst cssHasClassSelector = (css: string, className: string): boolean =>\n new RegExp(`\\\\.${cssEscapeClass(className)}(?![\\\\w-])`).test(css);\n\n/**\n * Every assertion a primitive owes its callers, for a pack to drive with\n * `it.each`.\n */\nexport const primitiveConformanceCases: readonly PrimitiveConformanceCase[] = [\n {\n name: 'validates as a primitive node and inside a composition',\n run: ({ type, exampleIndex, node }, harness) => {\n const hint = previewHint(type, exampleIndex);\n const primitiveErrors = [...harness.validateNode(node)];\n assert.deepEqual(primitiveErrors, [], hint);\n const result = harness.validateComposition(harness.wrapComposition(node));\n assert.equal(result.valid, true, hint);\n assert.deepEqual(result.errors, [], hint);\n },\n },\n {\n name: 'renders through React without throwing',\n run: ({ node }, harness) => {\n const rendered = harness.renderReact(node);\n assert.notEqual(rendered, undefined);\n },\n },\n {\n name: 'collects styles without throwing',\n run: ({ node }, harness) => {\n assert.doesNotThrow(() => harness.collectStyles(node));\n },\n },\n {\n name: 'a container recurses through scope for a node from another pack',\n run: ({ definition, node }, harness) => {\n if (!definition.children || !harness.nestForeignChild) {\n return;\n }\n const nested = harness.nestForeignChild(node);\n assert.notEqual(harness.renderReact(nested), undefined);\n assert.ok(\n harness.renderText(nested).includes(CONFORMANCE_FOREIGN_MARKER)\n );\n assert.ok(\n harness.renderMarkdown(nested).includes(CONFORMANCE_FOREIGN_MARKER)\n );\n },\n },\n {\n name: 'renders through plain text with non-empty output',\n run: ({ node }, harness) => {\n const text = harness.renderText(node);\n assert.equal(typeof text, 'string');\n assert.ok(text.trim().length > 0);\n },\n },\n {\n name: 'renders through markdown with non-empty output',\n run: ({ node }, harness) => {\n const markdown = harness.renderMarkdown(node);\n assert.equal(typeof markdown, 'string');\n assert.ok(markdown.trim().length > 0);\n },\n },\n {\n name: 'renders through Slack dispatch returning at least one block',\n run: ({ node }, harness) => {\n const blocks = harness.renderSlack(node);\n assert.ok(blocks.length > 0);\n for (const block of blocks) {\n assert.equal(typeof block, 'object');\n assert.equal(typeof block.type, 'string');\n }\n },\n },\n {\n name: 'renders through SVG primitive dispatch without throwing',\n run: ({ type, exampleIndex, node }, harness) => {\n if (!harness.renderSvg) {\n return;\n }\n assert.doesNotThrow(() =>\n harness.renderSvg?.(node, `conformance-${type}-${exampleIndex}`)\n );\n },\n },\n {\n name: 'reports a positive finite SVG height estimate',\n run: ({ node }, harness) => {\n if (\n harness.sizesFromNodeHeights === false ||\n !harness.estimateSvgHeight\n ) {\n return;\n }\n const height = harness.estimateSvgHeight(node);\n assert.equal(Number.isFinite(height), true);\n assert.ok(height > 0);\n },\n },\n {\n name: 'renders through renderHTML wrapped in a minimal composition',\n run: ({ node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node));\n assert.deepEqual(result.validationErrors, []);\n assert.ok(result.html.includes('<section'));\n assert.equal(result.measurement.js, 0);\n assert.ok(result.measurement.total > 0);\n },\n },\n {\n name: 'renders no node anchors unless asked',\n run: ({ node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const { body } = harness.renderHTML(harness.wrapComposition(node));\n assert.deepEqual(renderedAnchors(body), []);\n },\n },\n {\n name: 'renders a node anchor on every node when asked',\n run: ({ type, exampleIndex, node }, harness) => {\n if (!harness.renderHTML || !harness.anchorWalk) {\n return;\n }\n const composition = harness.wrapComposition(node);\n const { body } = harness.renderHTML(composition, { anchors: true });\n const expected = anchoredNodes(\n composition.body,\n harness.anchorWalk\n ).flatMap((anchored) => {\n const anchoredType = nodeType(anchored);\n return anchoredType === undefined ? [] : [anchorValue(anchoredType)];\n });\n assert.deepEqual(\n renderedAnchors(body),\n expected,\n `Expected one anchor per node, in walker order. ${previewHint(type, exampleIndex)}`\n );\n },\n },\n {\n name: 'emits CSS where every var(...) reference has a matching declaration',\n run: ({ node }, harness) => {\n if (!harness.renderHTML || !harness.assertVarRefsHaveDeclarations) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node), {\n css: 'separate',\n });\n harness.assertVarRefsHaveDeclarations(result.css);\n },\n },\n {\n name: 'reaches every rendered readable class in compact CSS collection',\n run: ({ type, exampleIndex, node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node), {\n css: 'separate',\n names: 'readable',\n });\n const missing = renderedClassNames(result.body).filter(\n (className) => !cssHasClassSelector(result.css, className)\n );\n const hint =\n `Missing CSS for ${type} example #${exampleIndex}: ` +\n `${missing.join(', ') || '(none)'}. ` +\n previewHint(type, exampleIndex);\n assert.deepEqual(missing, [], hint);\n },\n },\n {\n name: 'renders through renderText wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const text = harness.renderTextComposition(harness.wrapComposition(node));\n assert.ok(text.length > 0);\n assert.ok(text.includes('CONFORMANCE FIXTURE'));\n },\n },\n {\n name: 'renders through renderMarkdown wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const markdown = harness.renderMarkdownComposition(\n harness.wrapComposition(node)\n );\n assert.ok(markdown.length > 0);\n assert.ok(markdown.includes('# Conformance fixture'));\n },\n },\n {\n name: 'renders through renderSlack wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const result = harness.renderSlackComposition(\n harness.wrapComposition(node)\n );\n assert.ok(result.blocks.length > 0);\n assert.ok(result.text.length > 0);\n const first = result.blocks[0];\n assert.ok(first);\n if (first.type !== 'header') {\n assert.fail(`expected a header block, got ${first.type}`);\n }\n assert.equal(first.text.type, 'plain_text');\n },\n },\n {\n name: 'renders through renderSVG wrapped in a minimal composition',\n run: async ({ node }, harness) => {\n if (!harness.renderSVGComposition) {\n return;\n }\n const result = await harness.renderSVGComposition(\n harness.wrapComposition(node)\n );\n assert.deepEqual(result.validationErrors, []);\n assert.ok(result.svg.includes('<svg'));\n assert.ok(result.svg.includes('</svg>'));\n assert.ok(result.measurement.total > 0);\n },\n },\n];\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
6
|
+
* 2.0.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.assertPackRegistrationComplete = exports.runPrimitiveInventoryConformance = exports.primitiveConformanceRows = exports.CONFORMANCE_FOREIGN_MARKER = void 0;
|
|
10
|
+
var conformance_1 = require("./conformance");
|
|
11
|
+
Object.defineProperty(exports, "CONFORMANCE_FOREIGN_MARKER", { enumerable: true, get: function () { return conformance_1.CONFORMANCE_FOREIGN_MARKER; } });
|
|
12
|
+
Object.defineProperty(exports, "primitiveConformanceRows", { enumerable: true, get: function () { return conformance_1.primitiveConformanceRows; } });
|
|
13
|
+
Object.defineProperty(exports, "runPrimitiveInventoryConformance", { enumerable: true, get: function () { return conformance_1.runPrimitiveInventoryConformance; } });
|
|
14
|
+
var registration_1 = require("./registration");
|
|
15
|
+
Object.defineProperty(exports, "assertPackRegistrationComplete", { enumerable: true, get: function () { return registration_1.assertPackRegistrationComplete; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,6CAUuB;AAHrB,yHAAA,0BAA0B,OAAA;AAC1B,uHAAA,wBAAwB,OAAA;AACxB,+HAAA,gCAAgC,OAAA;AAElC,+CAGwB;AADtB,8HAAA,8BAA8B,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 PrimitiveConformanceCase,\n type PrimitiveConformanceExample,\n type PrimitiveConformanceHarness,\n type PrimitiveConformanceHtmlOptions,\n type PrimitiveConformanceSlackResult,\n type PrimitiveConformanceSvgResult,\n CONFORMANCE_FOREIGN_MARKER,\n primitiveConformanceRows,\n runPrimitiveInventoryConformance,\n} from './conformance';\nexport {\n type PackRegistrationOptions,\n assertPackRegistrationComplete,\n} from './registration';\n"]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
6
|
+
* 2.0.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.assertPackRegistrationComplete = void 0;
|
|
43
|
+
// Node-only, and reached only through the `./testing` entry: this reads the
|
|
44
|
+
// filesystem, which no rendering path may do.
|
|
45
|
+
const node_fs_1 = require("node:fs");
|
|
46
|
+
const node_path_1 = require("node:path");
|
|
47
|
+
const node_url_1 = require("node:url");
|
|
48
|
+
const ENTRY_FILES = ['index.tsx', 'index.ts'];
|
|
49
|
+
/** Duck-typed so a definition from a different copy of the sdk still matches. */
|
|
50
|
+
const isPrimitiveDefinition = (value) => {
|
|
51
|
+
if (typeof value !== 'object' || value === null) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const { type, catalog, schema, renderers } = value;
|
|
55
|
+
return (typeof type === 'string' &&
|
|
56
|
+
typeof catalog === 'object' &&
|
|
57
|
+
catalog !== null &&
|
|
58
|
+
typeof schema === 'object' &&
|
|
59
|
+
schema !== null &&
|
|
60
|
+
typeof renderers === 'object' &&
|
|
61
|
+
renderers !== null);
|
|
62
|
+
};
|
|
63
|
+
const entryFileIn = (dir) => {
|
|
64
|
+
for (const name of ENTRY_FILES) {
|
|
65
|
+
const candidate = (0, node_path_1.join)(dir, name);
|
|
66
|
+
try {
|
|
67
|
+
if ((0, node_fs_1.statSync)(candidate).isFile()) {
|
|
68
|
+
return candidate;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// Not this name; try the next.
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
const subdirectoriesOf = (root, ignore) => (0, node_fs_1.readdirSync)(root, { withFileTypes: true })
|
|
78
|
+
.filter((entry) => entry.isDirectory() && !ignore.includes(entry.name))
|
|
79
|
+
.map((entry) => entry.name)
|
|
80
|
+
.sort();
|
|
81
|
+
/**
|
|
82
|
+
* Fails when the primitives directory and the pack's registry disagree: a
|
|
83
|
+
* subdirectory with no entry file or no exported definition, a defined type
|
|
84
|
+
* nothing registers, or a registered type no directory defines. Each problem
|
|
85
|
+
* line carries its fix.
|
|
86
|
+
*
|
|
87
|
+
* A pack keeps two hand-written lists, the registry array and the body-node
|
|
88
|
+
* union, and nothing in the type system relates either to the directory they
|
|
89
|
+
* describe. A primitive absent from both lists leaves them agreeing with each
|
|
90
|
+
* other, so it compiles and every other test passes while the primitive is
|
|
91
|
+
* unreachable. This is the check that notices.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* await assertPackRegistrationComplete({
|
|
96
|
+
* primitivesDir: new URL('./primitives/', import.meta.url),
|
|
97
|
+
* registered: slideDeckPrimitives,
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
const assertPackRegistrationComplete = async ({ primitivesDir, registered, ignore = [], }) => {
|
|
102
|
+
const root = typeof primitivesDir === 'string'
|
|
103
|
+
? primitivesDir
|
|
104
|
+
: (0, node_url_1.fileURLToPath)(primitivesDir);
|
|
105
|
+
const registeredTypes = new Set(registered.map(({ type }) => type));
|
|
106
|
+
const problems = [];
|
|
107
|
+
const foundTypes = new Set();
|
|
108
|
+
for (const folder of subdirectoriesOf(root, ignore)) {
|
|
109
|
+
const entry = entryFileIn((0, node_path_1.join)(root, folder));
|
|
110
|
+
if (!entry) {
|
|
111
|
+
problems.push(`${folder}/ has no ${ENTRY_FILES.join(' or ')}; add one or pass it in \`ignore\`.`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const module = (await Promise.resolve(`${(0, node_url_1.pathToFileURL)(entry).href}`).then(s => __importStar(require(s))));
|
|
115
|
+
const exported = Object.entries(module).filter(([, value]) => isPrimitiveDefinition(value));
|
|
116
|
+
if (exported.length === 0) {
|
|
117
|
+
problems.push(`${folder}/ exports no primitive definition; add one or pass it in \`ignore\`.`);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
for (const [exportName, definition] of exported) {
|
|
121
|
+
foundTypes.add(definition.type);
|
|
122
|
+
if (registeredTypes.has(definition.type)) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
problems.push(`${folder}/ defines "${definition.type}" but nothing registers it.\n` +
|
|
126
|
+
` Import \`${exportName}\` from './${folder}' and add it to the registry array,\n` +
|
|
127
|
+
` then add its node type to the pack's body-node union.`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
for (const { type } of registered) {
|
|
131
|
+
if (!foundTypes.has(type)) {
|
|
132
|
+
problems.push(`"${type}" is registered but no directory under ${root} defines it.`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (problems.length > 0) {
|
|
136
|
+
throw new Error(`Pack registration is incomplete:\n${problems.map((line) => `- ${line}`).join('\n')}`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports.assertPackRegistrationComplete = assertPackRegistrationComplete;
|
|
140
|
+
//# sourceMappingURL=registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/testing/registration.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;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KAAK,CAAC,EAAE,EAAE,CAC3D,qBAAqB,CAAC,KAAK,CAAC,CACc,CAAC;QAE7C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CACX,GAAG,MAAM,sEAAsE,CAChF,CAAC;YACF,SAAS;QACX,CAAC;QAED,KAAK,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,QAAQ,EAAE,CAAC;YAChD,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzC,SAAS;YACX,CAAC;YACD,QAAQ,CAAC,IAAI,CACX,GAAG,MAAM,cAAc,UAAU,CAAC,IAAI,+BAA+B;gBACnE,cAAc,UAAU,cAAc,MAAM,uCAAuC;gBACnF,yDAAyD,CAC5D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CACX,IAAI,IAAI,0CAA0C,IAAI,cAAc,CACrE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,qCAAqC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACtF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AA/DW,QAAA,8BAA8B,kCA+DzC","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// Node-only, and reached only through the `./testing` entry: this reads the\n// filesystem, which no rendering path may do.\n\nimport { readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\n\nimport type { AnyPrimitiveDefinition } from '../define/primitive_module';\n\n/** What {@link assertPackRegistrationComplete} needs to compare a pack against its directory. */\nexport interface PackRegistrationOptions {\n /** Directory whose subdirectories are one primitive each. A `URL` is resolved with `fileURLToPath`. */\n primitivesDir: URL | string;\n /** The pack's registry array, as passed to `definePrimitivePack`. */\n registered: readonly AnyPrimitiveDefinition[];\n /** Subdirectory names that hold no primitive. */\n ignore?: readonly string[];\n}\n\nconst ENTRY_FILES = ['index.tsx', 'index.ts'] as const;\n\n/** Duck-typed so a definition from a different copy of the sdk still matches. */\nconst isPrimitiveDefinition = (\n value: unknown\n): value is AnyPrimitiveDefinition => {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const { type, catalog, schema, renderers } = value as Record<string, unknown>;\n return (\n typeof type === 'string' &&\n typeof catalog === 'object' &&\n catalog !== null &&\n typeof schema === 'object' &&\n schema !== null &&\n typeof renderers === 'object' &&\n renderers !== null\n );\n};\n\nconst entryFileIn = (dir: string): string | undefined => {\n for (const name of ENTRY_FILES) {\n const candidate = join(dir, name);\n try {\n if (statSync(candidate).isFile()) {\n return candidate;\n }\n } catch {\n // Not this name; try the next.\n }\n }\n return undefined;\n};\n\nconst subdirectoriesOf = (root: string, ignore: readonly string[]): string[] =>\n readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory() && !ignore.includes(entry.name))\n .map((entry) => entry.name)\n .sort();\n\n/**\n * Fails when the primitives directory and the pack's registry disagree: a\n * subdirectory with no entry file or no exported definition, a defined type\n * nothing registers, or a registered type no directory defines. Each problem\n * line carries its fix.\n *\n * A pack keeps two hand-written lists, the registry array and the body-node\n * union, and nothing in the type system relates either to the directory they\n * describe. A primitive absent from both lists leaves them agreeing with each\n * other, so it compiles and every other test passes while the primitive is\n * unreachable. This is the check that notices.\n *\n * @example\n * ```ts\n * await assertPackRegistrationComplete({\n * primitivesDir: new URL('./primitives/', import.meta.url),\n * registered: slideDeckPrimitives,\n * });\n * ```\n */\nexport const assertPackRegistrationComplete = async ({\n primitivesDir,\n registered,\n ignore = [],\n}: PackRegistrationOptions): Promise<void> => {\n const root =\n typeof primitivesDir === 'string'\n ? primitivesDir\n : fileURLToPath(primitivesDir);\n const registeredTypes = new Set(registered.map(({ type }) => type));\n const problems: string[] = [];\n const foundTypes = new Set<string>();\n\n for (const folder of subdirectoriesOf(root, ignore)) {\n const entry = entryFileIn(join(root, folder));\n if (!entry) {\n problems.push(\n `${folder}/ has no ${ENTRY_FILES.join(' or ')}; add one or pass it in \\`ignore\\`.`\n );\n continue;\n }\n\n const module = (await import(pathToFileURL(entry).href)) as Record<\n string,\n unknown\n >;\n const exported = Object.entries(module).filter(([, value]) =>\n isPrimitiveDefinition(value)\n ) as Array<[string, AnyPrimitiveDefinition]>;\n\n if (exported.length === 0) {\n problems.push(\n `${folder}/ exports no primitive definition; add one or pass it in \\`ignore\\`.`\n );\n continue;\n }\n\n for (const [exportName, definition] of exported) {\n foundTypes.add(definition.type);\n if (registeredTypes.has(definition.type)) {\n continue;\n }\n problems.push(\n `${folder}/ defines \"${definition.type}\" but nothing registers it.\\n` +\n ` Import \\`${exportName}\\` from './${folder}' and add it to the registry array,\\n` +\n ` then add its node type to the pack's body-node union.`\n );\n }\n }\n\n for (const { type } of registered) {\n if (!foundTypes.has(type)) {\n problems.push(\n `\"${type}\" is registered but no directory under ${root} defines it.`\n );\n }\n }\n\n if (problems.length > 0) {\n throw new Error(\n `Pack registration is incomplete:\\n${problems.map((line) => `- ${line}`).join('\\n')}`\n );\n }\n};\n"]}
|