@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,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable codes for {@link IsomerError}, {@link CompositionValidationError},
|
|
3
|
+
* and the runtime's `RegisteredViewInputError`. Hosts branch on `code`, not
|
|
4
|
+
* on `message`. Codes name the condition, not the throwing module: duplicate
|
|
5
|
+
* type at `definePrimitivePack`, `composePacks`, and `createIsomerRuntime` is the same
|
|
6
|
+
* `DUPLICATE_PRIMITIVE_TYPE`; the message names the layer.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ISOMER_ERROR_CODES: {
|
|
9
|
+
readonly AMBIGUOUS_FRAME: "AMBIGUOUS_FRAME";
|
|
10
|
+
readonly AMBIGUOUS_STYLE_ADAPTER: "AMBIGUOUS_STYLE_ADAPTER";
|
|
11
|
+
readonly AUTHOR_TYPE_MISMATCH: "AUTHOR_TYPE_MISMATCH";
|
|
12
|
+
readonly AUTHORED_SCHEMA_REUSED: "AUTHORED_SCHEMA_REUSED";
|
|
13
|
+
readonly COMPOSITION_INVALID: "COMPOSITION_INVALID";
|
|
14
|
+
readonly CYCLIC_COMPOSITION: "CYCLIC_COMPOSITION";
|
|
15
|
+
readonly DUPLICATE_AUTHORED_CHILD: "DUPLICATE_AUTHORED_CHILD";
|
|
16
|
+
readonly DUPLICATE_ENHANCEMENT: "DUPLICATE_ENHANCEMENT";
|
|
17
|
+
readonly DUPLICATE_PACK_ID: "DUPLICATE_PACK_ID";
|
|
18
|
+
readonly DUPLICATE_PRIMITIVE_TYPE: "DUPLICATE_PRIMITIVE_TYPE";
|
|
19
|
+
readonly DUPLICATE_VIEW: "DUPLICATE_VIEW";
|
|
20
|
+
readonly EMPTY_FRAMES: "EMPTY_FRAMES";
|
|
21
|
+
readonly EMPTY_PACK: "EMPTY_PACK";
|
|
22
|
+
readonly EMPTY_PACKS: "EMPTY_PACKS";
|
|
23
|
+
readonly EMPTY_PAGES: "EMPTY_PAGES";
|
|
24
|
+
readonly EMPTY_VOCABULARY: "EMPTY_VOCABULARY";
|
|
25
|
+
readonly ENHANCEMENT_ROOT_MISSING: "ENHANCEMENT_ROOT_MISSING";
|
|
26
|
+
readonly EXPECTED_AUTHOR_COMPONENT: "EXPECTED_AUTHOR_COMPONENT";
|
|
27
|
+
readonly EXPECTED_JSX_ELEMENT: "EXPECTED_JSX_ELEMENT";
|
|
28
|
+
readonly EXPECTED_TEXT_CHILDREN: "EXPECTED_TEXT_CHILDREN";
|
|
29
|
+
readonly INCOMPATIBLE_STYLE_COLLECTOR: "INCOMPATIBLE_STYLE_COLLECTOR";
|
|
30
|
+
readonly INPUT_NOT_PLAIN_DATA: "INPUT_NOT_PLAIN_DATA";
|
|
31
|
+
readonly INPUT_OVER_BUDGET: "INPUT_OVER_BUDGET";
|
|
32
|
+
readonly INVALID_BODY_NODE: "INVALID_BODY_NODE";
|
|
33
|
+
readonly INVALID_FRAME_BODY: "INVALID_FRAME_BODY";
|
|
34
|
+
readonly MISSING_AUTHORED_TEXT: "MISSING_AUTHORED_TEXT";
|
|
35
|
+
readonly MISSING_STYLE_ADAPTER: "MISSING_STYLE_ADAPTER";
|
|
36
|
+
readonly RESERVED_NODE_FIELD: "RESERVED_NODE_FIELD";
|
|
37
|
+
readonly UNEXPECTED_CHILDREN: "UNEXPECTED_CHILDREN";
|
|
38
|
+
readonly UNKNOWN_FRAME: "UNKNOWN_FRAME";
|
|
39
|
+
readonly UNKNOWN_PRIMITIVE_TYPE: "UNKNOWN_PRIMITIVE_TYPE";
|
|
40
|
+
readonly UNKNOWN_SURFACE: "UNKNOWN_SURFACE";
|
|
41
|
+
readonly UNKNOWN_VIEW: "UNKNOWN_VIEW";
|
|
42
|
+
readonly UNSUPPORTED_CHILD_PATH: "UNSUPPORTED_CHILD_PATH";
|
|
43
|
+
readonly VIEW_INPUT_INVALID: "VIEW_INPUT_INVALID";
|
|
44
|
+
readonly VOCABULARY_UNRESOLVED: "VOCABULARY_UNRESOLVED";
|
|
45
|
+
};
|
|
46
|
+
/** One of {@link ISOMER_ERROR_CODES}. */
|
|
47
|
+
export type IsomerErrorCode = (typeof ISOMER_ERROR_CODES)[keyof typeof ISOMER_ERROR_CODES];
|
|
48
|
+
/**
|
|
49
|
+
* Thrown for construction and authoring failures that are not a
|
|
50
|
+
* `CompositionValidationError`.
|
|
51
|
+
*
|
|
52
|
+
* Identify it by `name` and `code`, never `instanceof`: the SDK ships both
|
|
53
|
+
* ESM and CJS builds, so a host can hold two copies of this class and an
|
|
54
|
+
* identity check would miss one.
|
|
55
|
+
*/
|
|
56
|
+
export declare class IsomerError extends Error {
|
|
57
|
+
readonly code: IsomerErrorCode;
|
|
58
|
+
constructor(code: IsomerErrorCode, message: string);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/composition/error.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCrB,CAAC;AAEX,yCAAyC;AACzC,MAAM,MAAM,eAAe,GACzB,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D;;;;;;;GAOG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;gBAEnB,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;CAKnD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Stable codes for {@link IsomerError}, {@link CompositionValidationError},
|
|
9
|
+
* and the runtime's `RegisteredViewInputError`. Hosts branch on `code`, not
|
|
10
|
+
* on `message`. Codes name the condition, not the throwing module: duplicate
|
|
11
|
+
* type at `definePrimitivePack`, `composePacks`, and `createIsomerRuntime` is the same
|
|
12
|
+
* `DUPLICATE_PRIMITIVE_TYPE`; the message names the layer.
|
|
13
|
+
*/
|
|
14
|
+
export const ISOMER_ERROR_CODES = {
|
|
15
|
+
AMBIGUOUS_FRAME: 'AMBIGUOUS_FRAME',
|
|
16
|
+
AMBIGUOUS_STYLE_ADAPTER: 'AMBIGUOUS_STYLE_ADAPTER',
|
|
17
|
+
AUTHOR_TYPE_MISMATCH: 'AUTHOR_TYPE_MISMATCH',
|
|
18
|
+
AUTHORED_SCHEMA_REUSED: 'AUTHORED_SCHEMA_REUSED',
|
|
19
|
+
COMPOSITION_INVALID: 'COMPOSITION_INVALID',
|
|
20
|
+
CYCLIC_COMPOSITION: 'CYCLIC_COMPOSITION',
|
|
21
|
+
DUPLICATE_AUTHORED_CHILD: 'DUPLICATE_AUTHORED_CHILD',
|
|
22
|
+
DUPLICATE_ENHANCEMENT: 'DUPLICATE_ENHANCEMENT',
|
|
23
|
+
DUPLICATE_PACK_ID: 'DUPLICATE_PACK_ID',
|
|
24
|
+
DUPLICATE_PRIMITIVE_TYPE: 'DUPLICATE_PRIMITIVE_TYPE',
|
|
25
|
+
DUPLICATE_VIEW: 'DUPLICATE_VIEW',
|
|
26
|
+
EMPTY_FRAMES: 'EMPTY_FRAMES',
|
|
27
|
+
EMPTY_PACK: 'EMPTY_PACK',
|
|
28
|
+
EMPTY_PACKS: 'EMPTY_PACKS',
|
|
29
|
+
EMPTY_PAGES: 'EMPTY_PAGES',
|
|
30
|
+
EMPTY_VOCABULARY: 'EMPTY_VOCABULARY',
|
|
31
|
+
ENHANCEMENT_ROOT_MISSING: 'ENHANCEMENT_ROOT_MISSING',
|
|
32
|
+
EXPECTED_AUTHOR_COMPONENT: 'EXPECTED_AUTHOR_COMPONENT',
|
|
33
|
+
EXPECTED_JSX_ELEMENT: 'EXPECTED_JSX_ELEMENT',
|
|
34
|
+
EXPECTED_TEXT_CHILDREN: 'EXPECTED_TEXT_CHILDREN',
|
|
35
|
+
INCOMPATIBLE_STYLE_COLLECTOR: 'INCOMPATIBLE_STYLE_COLLECTOR',
|
|
36
|
+
INPUT_NOT_PLAIN_DATA: 'INPUT_NOT_PLAIN_DATA',
|
|
37
|
+
INPUT_OVER_BUDGET: 'INPUT_OVER_BUDGET',
|
|
38
|
+
INVALID_BODY_NODE: 'INVALID_BODY_NODE',
|
|
39
|
+
INVALID_FRAME_BODY: 'INVALID_FRAME_BODY',
|
|
40
|
+
MISSING_AUTHORED_TEXT: 'MISSING_AUTHORED_TEXT',
|
|
41
|
+
MISSING_STYLE_ADAPTER: 'MISSING_STYLE_ADAPTER',
|
|
42
|
+
RESERVED_NODE_FIELD: 'RESERVED_NODE_FIELD',
|
|
43
|
+
UNEXPECTED_CHILDREN: 'UNEXPECTED_CHILDREN',
|
|
44
|
+
UNKNOWN_FRAME: 'UNKNOWN_FRAME',
|
|
45
|
+
UNKNOWN_PRIMITIVE_TYPE: 'UNKNOWN_PRIMITIVE_TYPE',
|
|
46
|
+
UNKNOWN_SURFACE: 'UNKNOWN_SURFACE',
|
|
47
|
+
UNKNOWN_VIEW: 'UNKNOWN_VIEW',
|
|
48
|
+
UNSUPPORTED_CHILD_PATH: 'UNSUPPORTED_CHILD_PATH',
|
|
49
|
+
VIEW_INPUT_INVALID: 'VIEW_INPUT_INVALID',
|
|
50
|
+
VOCABULARY_UNRESOLVED: 'VOCABULARY_UNRESOLVED',
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Thrown for construction and authoring failures that are not a
|
|
54
|
+
* `CompositionValidationError`.
|
|
55
|
+
*
|
|
56
|
+
* Identify it by `name` and `code`, never `instanceof`: the SDK ships both
|
|
57
|
+
* ESM and CJS builds, so a host can hold two copies of this class and an
|
|
58
|
+
* identity check would miss one.
|
|
59
|
+
*/
|
|
60
|
+
export class IsomerError extends Error {
|
|
61
|
+
code;
|
|
62
|
+
constructor(code, message) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = 'IsomerError';
|
|
65
|
+
this.code = code;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/composition/error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,eAAe,EAAE,iBAAiB;IAClC,uBAAuB,EAAE,yBAAyB;IAClD,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,mBAAmB,EAAE,qBAAqB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,wBAAwB,EAAE,0BAA0B;IACpD,qBAAqB,EAAE,uBAAuB;IAC9C,iBAAiB,EAAE,mBAAmB;IACtC,wBAAwB,EAAE,0BAA0B;IACpD,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,gBAAgB,EAAE,kBAAkB;IACpC,wBAAwB,EAAE,0BAA0B;IACpD,yBAAyB,EAAE,2BAA2B;IACtD,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,4BAA4B,EAAE,8BAA8B;IAC5D,oBAAoB,EAAE,sBAAsB;IAC5C,iBAAiB,EAAE,mBAAmB;IACtC,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,qBAAqB,EAAE,uBAAuB;IAC9C,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,aAAa,EAAE,eAAe;IAC9B,sBAAsB,EAAE,wBAAwB;IAChD,eAAe,EAAE,iBAAiB;IAClC,YAAY,EAAE,cAAc;IAC5B,sBAAsB,EAAE,wBAAwB;IAChD,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,uBAAuB;CACtC,CAAC;AAMX;;;;;;;GAOG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAkB;IAE/B,YAAY,IAAqB,EAAE,OAAe;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n/**\n * Stable codes for {@link IsomerError}, {@link CompositionValidationError},\n * and the runtime's `RegisteredViewInputError`. Hosts branch on `code`, not\n * on `message`. Codes name the condition, not the throwing module: duplicate\n * type at `definePrimitivePack`, `composePacks`, and `createIsomerRuntime` is the same\n * `DUPLICATE_PRIMITIVE_TYPE`; the message names the layer.\n */\nexport const ISOMER_ERROR_CODES = {\n AMBIGUOUS_FRAME: 'AMBIGUOUS_FRAME',\n AMBIGUOUS_STYLE_ADAPTER: 'AMBIGUOUS_STYLE_ADAPTER',\n AUTHOR_TYPE_MISMATCH: 'AUTHOR_TYPE_MISMATCH',\n AUTHORED_SCHEMA_REUSED: 'AUTHORED_SCHEMA_REUSED',\n COMPOSITION_INVALID: 'COMPOSITION_INVALID',\n CYCLIC_COMPOSITION: 'CYCLIC_COMPOSITION',\n DUPLICATE_AUTHORED_CHILD: 'DUPLICATE_AUTHORED_CHILD',\n DUPLICATE_ENHANCEMENT: 'DUPLICATE_ENHANCEMENT',\n DUPLICATE_PACK_ID: 'DUPLICATE_PACK_ID',\n DUPLICATE_PRIMITIVE_TYPE: 'DUPLICATE_PRIMITIVE_TYPE',\n DUPLICATE_VIEW: 'DUPLICATE_VIEW',\n EMPTY_FRAMES: 'EMPTY_FRAMES',\n EMPTY_PACK: 'EMPTY_PACK',\n EMPTY_PACKS: 'EMPTY_PACKS',\n EMPTY_PAGES: 'EMPTY_PAGES',\n EMPTY_VOCABULARY: 'EMPTY_VOCABULARY',\n ENHANCEMENT_ROOT_MISSING: 'ENHANCEMENT_ROOT_MISSING',\n EXPECTED_AUTHOR_COMPONENT: 'EXPECTED_AUTHOR_COMPONENT',\n EXPECTED_JSX_ELEMENT: 'EXPECTED_JSX_ELEMENT',\n EXPECTED_TEXT_CHILDREN: 'EXPECTED_TEXT_CHILDREN',\n INCOMPATIBLE_STYLE_COLLECTOR: 'INCOMPATIBLE_STYLE_COLLECTOR',\n INPUT_NOT_PLAIN_DATA: 'INPUT_NOT_PLAIN_DATA',\n INPUT_OVER_BUDGET: 'INPUT_OVER_BUDGET',\n INVALID_BODY_NODE: 'INVALID_BODY_NODE',\n INVALID_FRAME_BODY: 'INVALID_FRAME_BODY',\n MISSING_AUTHORED_TEXT: 'MISSING_AUTHORED_TEXT',\n MISSING_STYLE_ADAPTER: 'MISSING_STYLE_ADAPTER',\n RESERVED_NODE_FIELD: 'RESERVED_NODE_FIELD',\n UNEXPECTED_CHILDREN: 'UNEXPECTED_CHILDREN',\n UNKNOWN_FRAME: 'UNKNOWN_FRAME',\n UNKNOWN_PRIMITIVE_TYPE: 'UNKNOWN_PRIMITIVE_TYPE',\n UNKNOWN_SURFACE: 'UNKNOWN_SURFACE',\n UNKNOWN_VIEW: 'UNKNOWN_VIEW',\n UNSUPPORTED_CHILD_PATH: 'UNSUPPORTED_CHILD_PATH',\n VIEW_INPUT_INVALID: 'VIEW_INPUT_INVALID',\n VOCABULARY_UNRESOLVED: 'VOCABULARY_UNRESOLVED',\n} as const;\n\n/** One of {@link ISOMER_ERROR_CODES}. */\nexport type IsomerErrorCode =\n (typeof ISOMER_ERROR_CODES)[keyof typeof ISOMER_ERROR_CODES];\n\n/**\n * Thrown for construction and authoring failures that are not a\n * `CompositionValidationError`.\n *\n * Identify it by `name` and `code`, never `instanceof`: the SDK ships both\n * ESM and CJS builds, so a host can hold two copies of this class and an\n * identity check would miss one.\n */\nexport class IsomerError extends Error {\n readonly code: IsomerErrorCode;\n\n constructor(code: IsomerErrorCode, message: string) {\n super(message);\n this.name = 'IsomerError';\n this.code = code;\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { type ActionEventRef } from './action_event.js';
|
|
2
|
+
export { type BodyNodeBase, type ChildNodeRef, type ChildNodeWalker, type SurfaceName, BODY_NODE_SURFACES, createChildNodeWalker, isVisibleOnSurface, someBodyNode, } from './body_node_base.js';
|
|
3
|
+
export { type Composition, type CompositionMeta } from './composition.js';
|
|
4
|
+
export { type IsomerErrorCode, ISOMER_ERROR_CODES, IsomerError } from './error.js';
|
|
5
|
+
export { mapCompositionNodes } from './map_nodes.js';
|
|
6
|
+
export { type NamedColor, type NamedColorPalette, type RenderTheme, ALL_NAMED_COLORS, } from './named_color.js';
|
|
7
|
+
export { type PrimitiveNode } from './node.js';
|
|
8
|
+
export { nameText, oneLine, quoteText } from './one_line.js';
|
|
9
|
+
export { type DisplayValue, type StructuredValue, type StructuredValueFormat, STRUCTURED_VALUE_FORMATS, } from './structured_value.js';
|
|
10
|
+
export { type ValidationError, CompositionValidationError, formatValidationError, } from './validation_error.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composition/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,KAAK,eAAe,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,eAAe,EACpB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { BODY_NODE_SURFACES, createChildNodeWalker, isVisibleOnSurface, someBodyNode, } from './body_node_base.js';
|
|
8
|
+
export { ISOMER_ERROR_CODES, IsomerError } from './error.js';
|
|
9
|
+
export { mapCompositionNodes } from './map_nodes.js';
|
|
10
|
+
export { ALL_NAMED_COLORS, } from './named_color.js';
|
|
11
|
+
export { nameText, oneLine, quoteText } from './one_line.js';
|
|
12
|
+
export { STRUCTURED_VALUE_FORMATS, } from './structured_value.js';
|
|
13
|
+
export { CompositionValidationError, formatValidationError, } from './validation_error.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/composition/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAKL,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAwB,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAIL,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAIL,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,oBAAoB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport { type ActionEventRef } from './action_event';\nexport {\n type BodyNodeBase,\n type ChildNodeRef,\n type ChildNodeWalker,\n type SurfaceName,\n BODY_NODE_SURFACES,\n createChildNodeWalker,\n isVisibleOnSurface,\n someBodyNode,\n} from './body_node_base';\nexport { type Composition, type CompositionMeta } from './composition';\nexport { type IsomerErrorCode, ISOMER_ERROR_CODES, IsomerError } from './error';\nexport { mapCompositionNodes } from './map_nodes';\nexport {\n type NamedColor,\n type NamedColorPalette,\n type RenderTheme,\n ALL_NAMED_COLORS,\n} from './named_color';\nexport { type PrimitiveNode } from './node';\nexport { nameText, oneLine, quoteText } from './one_line';\nexport {\n type DisplayValue,\n type StructuredValue,\n type StructuredValueFormat,\n STRUCTURED_VALUE_FORMATS,\n} from './structured_value';\nexport {\n type ValidationError,\n CompositionValidationError,\n formatValidationError,\n} from './validation_error';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChildNodeWalker } from './body_node_base.js';
|
|
2
|
+
import type { Composition } from './composition.js';
|
|
3
|
+
import type { PrimitiveNode } from './node.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rebuilds `composition`'s body with `fn` applied to every node, including
|
|
6
|
+
* the nested children `walk` yields.
|
|
7
|
+
*
|
|
8
|
+
* Post-order: a container reaches `fn` after its children have been mapped,
|
|
9
|
+
* so `fn` sees the finished replacements in place. Build `walk` with
|
|
10
|
+
* {@link createChildNodeWalker} over every pack in the composition.
|
|
11
|
+
* A child path is the dotted `field` / `field[index]` form the SDK documents
|
|
12
|
+
* (`items[0].node`); any other shape throws `UNSUPPORTED_CHILD_PATH`.
|
|
13
|
+
* Walked without recursion, so depth is bounded by memory, not the call stack; a node nested in itself throws `CYCLIC_COMPOSITION`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const mapCompositionNodes: <TNode extends PrimitiveNode = PrimitiveNode>(composition: Composition<TNode>, walk: ChildNodeWalker, fn: (node: PrimitiveNode) => PrimitiveNode) => Composition<TNode>;
|
|
16
|
+
//# sourceMappingURL=map_nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map_nodes.d.ts","sourceRoot":"","sources":["../../src/composition/map_nodes.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAiD5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC9B,KAAK,SAAS,aAAa,GAAG,aAAa,EAE3C,aAAa,WAAW,CAAC,KAAK,CAAC,EAC/B,MAAM,eAAe,EACrB,IAAI,CAAC,IAAI,EAAE,aAAa,KAAK,aAAa,KACzC,WAAW,CAAC,KAAK,CA2CnB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { IsomerError } from './error.js';
|
|
8
|
+
/** One dotted step of a child path: `field` or `field[index]`. */
|
|
9
|
+
const PATH_STEP = /^([A-Za-z_$][\w$]*)(?:\[(\d+)\])?$/;
|
|
10
|
+
const unsupportedPath = (path) => new IsomerError('UNSUPPORTED_CHILD_PATH', `mapCompositionNodes: cannot rewrite child at path "${path}"; expected dotted "field" or "field[index]" steps`);
|
|
11
|
+
/** `parent` with the value at `steps` replaced, every touched object and array copied. */
|
|
12
|
+
const withValueAt = (parent, steps, value, path) => {
|
|
13
|
+
const [step, ...rest] = steps;
|
|
14
|
+
const match = step === undefined ? null : PATH_STEP.exec(step);
|
|
15
|
+
if (!match || typeof parent !== 'object' || parent === null) {
|
|
16
|
+
throw unsupportedPath(path);
|
|
17
|
+
}
|
|
18
|
+
const field = match[1];
|
|
19
|
+
const record = parent;
|
|
20
|
+
if (match[2] === undefined) {
|
|
21
|
+
const next = rest.length === 0 ? value : withValueAt(record[field], rest, value, path);
|
|
22
|
+
return { ...record, [field]: next };
|
|
23
|
+
}
|
|
24
|
+
const index = Number(match[2]);
|
|
25
|
+
const current = record[field];
|
|
26
|
+
if (!Array.isArray(current)) {
|
|
27
|
+
throw unsupportedPath(path);
|
|
28
|
+
}
|
|
29
|
+
const array = [...current];
|
|
30
|
+
array[index] =
|
|
31
|
+
rest.length === 0 ? value : withValueAt(array[index], rest, value, path);
|
|
32
|
+
return { ...record, [field]: array };
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Rebuilds `composition`'s body with `fn` applied to every node, including
|
|
36
|
+
* the nested children `walk` yields.
|
|
37
|
+
*
|
|
38
|
+
* Post-order: a container reaches `fn` after its children have been mapped,
|
|
39
|
+
* so `fn` sees the finished replacements in place. Build `walk` with
|
|
40
|
+
* {@link createChildNodeWalker} over every pack in the composition.
|
|
41
|
+
* A child path is the dotted `field` / `field[index]` form the SDK documents
|
|
42
|
+
* (`items[0].node`); any other shape throws `UNSUPPORTED_CHILD_PATH`.
|
|
43
|
+
* Walked without recursion, so depth is bounded by memory, not the call stack; a node nested in itself throws `CYCLIC_COMPOSITION`.
|
|
44
|
+
*/
|
|
45
|
+
export const mapCompositionNodes = (composition, walk, fn) => {
|
|
46
|
+
const mapNode = (root) => {
|
|
47
|
+
const open = new Set();
|
|
48
|
+
const stack = [];
|
|
49
|
+
const enter = (node) => {
|
|
50
|
+
if (open.has(node)) {
|
|
51
|
+
throw new IsomerError('CYCLIC_COMPOSITION', 'mapCompositionNodes: a node is nested in itself');
|
|
52
|
+
}
|
|
53
|
+
open.add(node);
|
|
54
|
+
stack.push({ node, children: walk(node), next: 0, result: node });
|
|
55
|
+
};
|
|
56
|
+
enter(root);
|
|
57
|
+
for (;;) {
|
|
58
|
+
const frame = stack[stack.length - 1];
|
|
59
|
+
const child = frame.children[frame.next];
|
|
60
|
+
if (child) {
|
|
61
|
+
enter(child.node);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
stack.pop();
|
|
65
|
+
open.delete(frame.node);
|
|
66
|
+
const mapped = fn(frame.result);
|
|
67
|
+
const parent = stack[stack.length - 1];
|
|
68
|
+
if (!parent) {
|
|
69
|
+
return mapped;
|
|
70
|
+
}
|
|
71
|
+
const { path } = parent.children[parent.next];
|
|
72
|
+
parent.result = withValueAt(parent.result, path.split('.'), mapped, path);
|
|
73
|
+
parent.next += 1;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
...composition,
|
|
78
|
+
body: composition.body.map((node) => mapNode(node)),
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=map_nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map_nodes.js","sourceRoot":"","sources":["../../src/composition/map_nodes.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nimport type { ChildNodeRef, ChildNodeWalker } from './body_node_base';\nimport type { Composition } from './composition';\nimport { IsomerError } from './error';\nimport type { PrimitiveNode } from './node';\n\n/** One dotted step of a child path: `field` or `field[index]`. */\nconst PATH_STEP = /^([A-Za-z_$][\\w$]*)(?:\\[(\\d+)\\])?$/;\n\nconst unsupportedPath = (path: string): IsomerError =>\n new IsomerError(\n 'UNSUPPORTED_CHILD_PATH',\n `mapCompositionNodes: cannot rewrite child at path \"${path}\"; expected dotted \"field\" or \"field[index]\" steps`\n );\n\n/** `parent` with the value at `steps` replaced, every touched object and array copied. */\nconst withValueAt = (\n parent: unknown,\n steps: readonly string[],\n value: unknown,\n path: string\n): unknown => {\n const [step, ...rest] = steps;\n const match = step === undefined ? null : PATH_STEP.exec(step);\n if (!match || typeof parent !== 'object' || parent === null) {\n throw unsupportedPath(path);\n }\n const field = match[1] as string;\n const record = parent as Record<string, unknown>;\n if (match[2] === undefined) {\n const next =\n rest.length === 0 ? value : withValueAt(record[field], rest, value, path);\n return { ...record, [field]: next };\n }\n const index = Number(match[2]);\n const current = record[field];\n if (!Array.isArray(current)) {\n throw unsupportedPath(path);\n }\n const array = [...(current as unknown[])];\n array[index] =\n rest.length === 0 ? value : withValueAt(array[index], rest, value, path);\n return { ...record, [field]: array };\n};\n\n/** A node being mapped: its children, how many are done, and its copy so far. */\ninterface Frame {\n node: PrimitiveNode;\n children: ChildNodeRef[];\n next: number;\n result: PrimitiveNode;\n}\n\n/**\n * Rebuilds `composition`'s body with `fn` applied to every node, including\n * the nested children `walk` yields.\n *\n * Post-order: a container reaches `fn` after its children have been mapped,\n * so `fn` sees the finished replacements in place. Build `walk` with\n * {@link createChildNodeWalker} over every pack in the composition.\n * A child path is the dotted `field` / `field[index]` form the SDK documents\n * (`items[0].node`); any other shape throws `UNSUPPORTED_CHILD_PATH`.\n * Walked without recursion, so depth is bounded by memory, not the call stack; a node nested in itself throws `CYCLIC_COMPOSITION`.\n */\nexport const mapCompositionNodes = <\n TNode extends PrimitiveNode = PrimitiveNode,\n>(\n composition: Composition<TNode>,\n walk: ChildNodeWalker,\n fn: (node: PrimitiveNode) => PrimitiveNode\n): Composition<TNode> => {\n const mapNode = (root: PrimitiveNode): PrimitiveNode => {\n const open = new Set<PrimitiveNode>();\n const stack: Frame[] = [];\n const enter = (node: PrimitiveNode) => {\n if (open.has(node)) {\n throw new IsomerError(\n 'CYCLIC_COMPOSITION',\n 'mapCompositionNodes: a node is nested in itself'\n );\n }\n open.add(node);\n stack.push({ node, children: walk(node), next: 0, result: node });\n };\n enter(root);\n for (;;) {\n const frame = stack[stack.length - 1]!;\n const child = frame.children[frame.next];\n if (child) {\n enter(child.node as PrimitiveNode);\n continue;\n }\n stack.pop();\n open.delete(frame.node);\n const mapped = fn(frame.result);\n const parent = stack[stack.length - 1];\n if (!parent) {\n return mapped;\n }\n const { path } = parent.children[parent.next]!;\n parent.result = withValueAt(\n parent.result,\n path.split('.'),\n mapped,\n path\n ) as PrimitiveNode;\n parent.next += 1;\n }\n };\n return {\n ...composition,\n body: composition.body.map((node) => mapNode(node) as TNode),\n };\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Portable color names shared by primitive packs and renderers. An exact subset of EUI's `NamedColor`. */
|
|
2
|
+
export type NamedColor = 'neutral' | 'primary' | 'accent' | 'success' | 'warning' | 'risk' | 'danger';
|
|
3
|
+
/** Every {@link NamedColor}, and the source `namedColorSchema` derives from. */
|
|
4
|
+
export declare const ALL_NAMED_COLORS: readonly NamedColor[];
|
|
5
|
+
/** Light/dark preference. `auto` resolves light wherever media queries are unavailable. */
|
|
6
|
+
export type RenderTheme = 'auto' | 'light' | 'dark';
|
|
7
|
+
/** A pack's colors by name. Partial: an unmapped name falls back to the renderer's default. */
|
|
8
|
+
export type NamedColorPalette = Partial<Record<NamedColor, string>>;
|
|
9
|
+
//# sourceMappingURL=named_color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named_color.d.ts","sourceRoot":"","sources":["../../src/composition/named_color.ts"],"names":[],"mappings":"AAOA,2GAA2G;AAC3G,MAAM,MAAM,UAAU,GACpB,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/E,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAQjD,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD,+FAA+F;AAC/F,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
/** Every {@link NamedColor}, and the source `namedColorSchema` derives from. */
|
|
8
|
+
export const ALL_NAMED_COLORS = [
|
|
9
|
+
'neutral',
|
|
10
|
+
'primary',
|
|
11
|
+
'accent',
|
|
12
|
+
'success',
|
|
13
|
+
'warning',
|
|
14
|
+
'risk',
|
|
15
|
+
'danger',
|
|
16
|
+
];
|
|
17
|
+
//# sourceMappingURL=named_color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named_color.js","sourceRoot":"","sources":["../../src/composition/named_color.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAA0B;IACrD,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;CACT,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n/** Portable color names shared by primitive packs and renderers. An exact subset of EUI's `NamedColor`. */\nexport type NamedColor =\n 'neutral' | 'primary' | 'accent' | 'success' | 'warning' | 'risk' | 'danger';\n\n/** Every {@link NamedColor}, and the source `namedColorSchema` derives from. */\nexport const ALL_NAMED_COLORS: readonly NamedColor[] = [\n 'neutral',\n 'primary',\n 'accent',\n 'success',\n 'warning',\n 'risk',\n 'danger',\n];\n\n/** Light/dark preference. `auto` resolves light wherever media queries are unavailable. */\nexport type RenderTheme = 'auto' | 'light' | 'dark';\n\n/** A pack's colors by name. Partial: an unmapped name falls back to the renderer's default. */\nexport type NamedColorPalette = Partial<Record<NamedColor, string>>;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BodyNodeBase } from './body_node_base.js';
|
|
2
|
+
/**
|
|
3
|
+
* One node in a `Composition`'s body, erased to its discriminator.
|
|
4
|
+
*
|
|
5
|
+
* A pack narrows `type` to its own literal union; the SDK holds this form
|
|
6
|
+
* because a heterogeneous inventory has no single node type to name.
|
|
7
|
+
*/
|
|
8
|
+
export interface PrimitiveNode extends BodyNodeBase {
|
|
9
|
+
type: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/composition/node.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/composition/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nimport type { BodyNodeBase } from './body_node_base';\n\n/**\n * One node in a `Composition`'s body, erased to its discriminator.\n *\n * A pack narrows `type` to its own literal union; the SDK holds this form\n * because a heterogeneous inventory has no single node type to name.\n */\nexport interface PrimitiveNode extends BodyNodeBase {\n type: string;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** `text` on one line: each run of whitespace holding a line terminator becomes one space, and other whitespace stays as is. */
|
|
2
|
+
export declare const oneLine: (text: string) => string;
|
|
3
|
+
/** `text` as a JSON string on one line: `JSON.stringify` leaves U+2028 and U+2029 raw. */
|
|
4
|
+
export declare const quoteText: (text: string) => string;
|
|
5
|
+
/** A name for a one-line message: as it is when plain, else as {@link quoteText} quotes it. */
|
|
6
|
+
export declare const nameText: (name: string) => string;
|
|
7
|
+
//# sourceMappingURL=one_line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one_line.d.ts","sourceRoot":"","sources":["../../src/composition/one_line.ts"],"names":[],"mappings":"AASA,gIAAgI;AAChI,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MACoC,CAAC;AAE5E,0FAA0F;AAC1F,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAGP,CAAC;AAInC,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,MACQ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
const LINE_TERMINATOR_RE = /[\r\n\u2028\u2029]/;
|
|
8
|
+
/** `text` on one line: each run of whitespace holding a line terminator becomes one space, and other whitespace stays as is. */
|
|
9
|
+
export const oneLine = (text) => text.replace(/\s+/g, (run) => (LINE_TERMINATOR_RE.test(run) ? ' ' : run));
|
|
10
|
+
/** `text` as a JSON string on one line: `JSON.stringify` leaves U+2028 and U+2029 raw. */
|
|
11
|
+
export const quoteText = (text) => JSON.stringify(text)
|
|
12
|
+
.replace(/\u2028/g, '\\u2028')
|
|
13
|
+
.replace(/\u2029/g, '\\u2029');
|
|
14
|
+
const PLAIN_NAME = /^[\w$-]+$/;
|
|
15
|
+
/** A name for a one-line message: as it is when plain, else as {@link quoteText} quotes it. */
|
|
16
|
+
export const nameText = (name) => PLAIN_NAME.test(name) ? name : quoteText(name);
|
|
17
|
+
//# sourceMappingURL=one_line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one_line.js","sourceRoot":"","sources":["../../src/composition/one_line.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD,gIAAgI;AAChI,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE,CAC9C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAU,EAAE,CAChD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KACjB,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;KAC7B,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAEnC,MAAM,UAAU,GAAG,WAAW,CAAC;AAE/B,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE,CAC/C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nconst LINE_TERMINATOR_RE = /[\\r\\n\\u2028\\u2029]/;\n\n/** `text` on one line: each run of whitespace holding a line terminator becomes one space, and other whitespace stays as is. */\nexport const oneLine = (text: string): string =>\n text.replace(/\\s+/g, (run) => (LINE_TERMINATOR_RE.test(run) ? ' ' : run));\n\n/** `text` as a JSON string on one line: `JSON.stringify` leaves U+2028 and U+2029 raw. */\nexport const quoteText = (text: string): string =>\n JSON.stringify(text)\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n\nconst PLAIN_NAME = /^[\\w$-]+$/;\n\n/** A name for a one-line message: as it is when plain, else as {@link quoteText} quotes it. */\nexport const nameText = (name: string): string =>\n PLAIN_NAME.test(name) ? name : quoteText(name);\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Format hints a {@link StructuredValue} may carry. */
|
|
2
|
+
export declare const STRUCTURED_VALUE_FORMATS: readonly ["number", "compact", "percent", "currency", "bytes", "duration", "date", "relativeTime"];
|
|
3
|
+
/** One of {@link STRUCTURED_VALUE_FORMATS}. */
|
|
4
|
+
export type StructuredValueFormat = (typeof STRUCTURED_VALUE_FORMATS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* A raw quantity plus a format hint, so every surface renders the same string.
|
|
7
|
+
*
|
|
8
|
+
* Formatting happens once, in `formatDisplayValue`, rather than per renderer —
|
|
9
|
+
* otherwise the text and Slack surfaces drift on rounding.
|
|
10
|
+
*/
|
|
11
|
+
export interface StructuredValue {
|
|
12
|
+
/** Unformatted, in base units — a `percent` of `0.42` renders as 42%. */
|
|
13
|
+
raw: number | string;
|
|
14
|
+
/** How to render `raw`. Absent passes a string through and gives a number default formatting. */
|
|
15
|
+
format?: StructuredValueFormat;
|
|
16
|
+
/**
|
|
17
|
+
* Fraction digits for numeric formats. `number`, `percent`, and `currency`
|
|
18
|
+
* pad to it; omitted, `number` and `percent` keep at most two and `currency`
|
|
19
|
+
* two. `compact` and `bytes` drop trailing zeros and keep one when omitted.
|
|
20
|
+
*/
|
|
21
|
+
precision?: number;
|
|
22
|
+
/** Three-letter currency code for `currency`; defaults to USD. */
|
|
23
|
+
currency?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A value-bearing field: preformatted prose, or a {@link StructuredValue} to format. */
|
|
26
|
+
export type DisplayValue = string | StructuredValue;
|
|
27
|
+
//# sourceMappingURL=structured_value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured_value.d.ts","sourceRoot":"","sources":["../../src/composition/structured_value.ts"],"names":[],"mappings":"AAOA,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,oGAS3B,CAAC;AAEX,+CAA+C;AAC/C,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,iGAAiG;IACjG,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,yFAAyF;AACzF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
/** Format hints a {@link StructuredValue} may carry. */
|
|
8
|
+
export const STRUCTURED_VALUE_FORMATS = [
|
|
9
|
+
'number',
|
|
10
|
+
'compact',
|
|
11
|
+
'percent',
|
|
12
|
+
'currency',
|
|
13
|
+
'bytes',
|
|
14
|
+
'duration',
|
|
15
|
+
'date',
|
|
16
|
+
'relativeTime',
|
|
17
|
+
];
|
|
18
|
+
//# sourceMappingURL=structured_value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured_value.js","sourceRoot":"","sources":["../../src/composition/structured_value.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wDAAwD;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;IACV,OAAO;IACP,UAAU;IACV,MAAM;IACN,cAAc;CACN,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n/** Format hints a {@link StructuredValue} may carry. */\nexport const STRUCTURED_VALUE_FORMATS = [\n 'number',\n 'compact',\n 'percent',\n 'currency',\n 'bytes',\n 'duration',\n 'date',\n 'relativeTime',\n] as const;\n\n/** One of {@link STRUCTURED_VALUE_FORMATS}. */\nexport type StructuredValueFormat = (typeof STRUCTURED_VALUE_FORMATS)[number];\n\n/**\n * A raw quantity plus a format hint, so every surface renders the same string.\n *\n * Formatting happens once, in `formatDisplayValue`, rather than per renderer —\n * otherwise the text and Slack surfaces drift on rounding.\n */\nexport interface StructuredValue {\n /** Unformatted, in base units — a `percent` of `0.42` renders as 42%. */\n raw: number | string;\n /** How to render `raw`. Absent passes a string through and gives a number default formatting. */\n format?: StructuredValueFormat;\n /**\n * Fraction digits for numeric formats. `number`, `percent`, and `currency`\n * pad to it; omitted, `number` and `percent` keep at most two and `currency`\n * two. `compact` and `bytes` drop trailing zeros and keep one when omitted.\n */\n precision?: number;\n /** Three-letter currency code for `currency`; defaults to USD. */\n currency?: string;\n}\n\n/** A value-bearing field: preformatted prose, or a {@link StructuredValue} to format. */\nexport type DisplayValue = string | StructuredValue;\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type IsomerErrorCode } from './error.js';
|
|
2
|
+
/**
|
|
3
|
+
* One fatal validation finding.
|
|
4
|
+
*
|
|
5
|
+
* `path` locates the offending value (`body[3].items[0].label`) and is empty
|
|
6
|
+
* for a finding about the document as a whole. `message` is a predicate
|
|
7
|
+
* (`is required`, `must be one of: a, b`) so the two read as one sentence
|
|
8
|
+
* through {@link formatValidationError}.
|
|
9
|
+
*/
|
|
10
|
+
export interface ValidationError {
|
|
11
|
+
path: string;
|
|
12
|
+
message: string;
|
|
13
|
+
/** The `type` of the innermost primitive node `path` lands in, when there is one. */
|
|
14
|
+
nodeType?: string;
|
|
15
|
+
/** Set only on a refusal from `checkInputBudget`: `INPUT_OVER_BUDGET` or `INPUT_NOT_PLAIN_DATA`. */
|
|
16
|
+
code?: IsomerErrorCode;
|
|
17
|
+
}
|
|
18
|
+
/** `<path> (in <nodeType>) <message>`, or the message alone for a root finding. */
|
|
19
|
+
export declare const formatValidationError: ({ path, message, nodeType, }: ValidationError) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Thrown when a `Composition` fails validation, carrying every finding
|
|
22
|
+
* rather than only the first.
|
|
23
|
+
*
|
|
24
|
+
* Identify it by `name`, `code`, and `errors`, never `instanceof`: the SDK
|
|
25
|
+
* ships both ESM and CJS builds, so a host can hold two copies of this class
|
|
26
|
+
* and an identity check would miss one.
|
|
27
|
+
*/
|
|
28
|
+
export declare class CompositionValidationError extends Error {
|
|
29
|
+
readonly code: "COMPOSITION_INVALID";
|
|
30
|
+
readonly errors: ValidationError[];
|
|
31
|
+
constructor(errors: ValidationError[]);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=validation_error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation_error.d.ts","sourceRoot":"","sources":["../../src/composition/validation_error.ts"],"names":[],"mappings":"AAOA,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAGnE;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,GAAI,8BAInC,eAAe,KAAG,MAOpB,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,wBAA0C;IACvD,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC;gBAEvB,MAAM,EAAE,eAAe,EAAE;CAStC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { ISOMER_ERROR_CODES } from './error.js';
|
|
8
|
+
import { nameText } from './one_line.js';
|
|
9
|
+
/** `<path> (in <nodeType>) <message>`, or the message alone for a root finding. */
|
|
10
|
+
export const formatValidationError = ({ path, message, nodeType, }) => {
|
|
11
|
+
if (!path) {
|
|
12
|
+
return message;
|
|
13
|
+
}
|
|
14
|
+
return nodeType === undefined
|
|
15
|
+
? `${path} ${message}`
|
|
16
|
+
: `${path} (in ${nameText(nodeType)}) ${message}`;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Thrown when a `Composition` fails validation, carrying every finding
|
|
20
|
+
* rather than only the first.
|
|
21
|
+
*
|
|
22
|
+
* Identify it by `name`, `code`, and `errors`, never `instanceof`: the SDK
|
|
23
|
+
* ships both ESM and CJS builds, so a host can hold two copies of this class
|
|
24
|
+
* and an identity check would miss one.
|
|
25
|
+
*/
|
|
26
|
+
export class CompositionValidationError extends Error {
|
|
27
|
+
code = ISOMER_ERROR_CODES.COMPOSITION_INVALID;
|
|
28
|
+
errors;
|
|
29
|
+
constructor(errors) {
|
|
30
|
+
super(`Invalid Composition:\n ${errors.map(formatValidationError).join('\n ') || '(no detail)'}`);
|
|
31
|
+
this.name = 'CompositionValidationError';
|
|
32
|
+
this.errors = errors;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=validation_error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation_error.js","sourceRoot":"","sources":["../../src/composition/validation_error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAwB,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmBtC,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,IAAI,EACJ,OAAO,EACP,QAAQ,GACQ,EAAU,EAAE;IAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,QAAQ,KAAK,SAAS;QAC3B,CAAC,CAAC,GAAG,IAAI,IAAI,OAAO,EAAE;QACtB,CAAC,CAAC,GAAG,IAAI,QAAQ,QAAQ,CAAC,QAAQ,CAAC,KAAK,OAAO,EAAE,CAAC;AACtD,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,kBAAkB,CAAC,mBAAmB,CAAC;IAC9C,MAAM,CAAoB;IAEnC,YAAY,MAAyB;QACnC,KAAK,CACH,2BACE,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,aACpD,EAAE,CACH,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nimport { ISOMER_ERROR_CODES, type IsomerErrorCode } from './error';\nimport { nameText } from './one_line';\n\n/**\n * One fatal validation finding.\n *\n * `path` locates the offending value (`body[3].items[0].label`) and is empty\n * for a finding about the document as a whole. `message` is a predicate\n * (`is required`, `must be one of: a, b`) so the two read as one sentence\n * through {@link formatValidationError}.\n */\nexport interface ValidationError {\n path: string;\n message: string;\n /** The `type` of the innermost primitive node `path` lands in, when there is one. */\n nodeType?: string;\n /** Set only on a refusal from `checkInputBudget`: `INPUT_OVER_BUDGET` or `INPUT_NOT_PLAIN_DATA`. */\n code?: IsomerErrorCode;\n}\n\n/** `<path> (in <nodeType>) <message>`, or the message alone for a root finding. */\nexport const formatValidationError = ({\n path,\n message,\n nodeType,\n}: ValidationError): string => {\n if (!path) {\n return message;\n }\n return nodeType === undefined\n ? `${path} ${message}`\n : `${path} (in ${nameText(nodeType)}) ${message}`;\n};\n\n/**\n * Thrown when a `Composition` fails validation, carrying every finding\n * rather than only the first.\n *\n * Identify it by `name`, `code`, and `errors`, never `instanceof`: the SDK\n * ships both ESM and CJS builds, so a host can hold two copies of this class\n * and an identity check would miss one.\n */\nexport class CompositionValidationError extends Error {\n readonly code = ISOMER_ERROR_CODES.COMPOSITION_INVALID;\n readonly errors: ValidationError[];\n\n constructor(errors: ValidationError[]) {\n super(\n `Invalid Composition:\\n ${\n errors.map(formatValidationError).join('\\n ') || '(no detail)'\n }`\n );\n this.name = 'CompositionValidationError';\n this.errors = errors;\n }\n}\n"]}
|