@canonical/design-system 0.2.4 → 0.43.0-experimental.1
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 +166 -0
- package/README.md +255 -14
- package/data/apps/component/file_tree.ttl +2 -0
- package/data/apps/component/key_value_pair.ttl +2 -0
- package/data/apps/component/navigation.ttl +2 -0
- package/data/apps/component/notification.ttl +2 -0
- package/data/apps/component/side_navigation.ttl +2 -0
- package/data/apps/component/skeleton_loading.ttl +2 -0
- package/data/apps/component/status_bar.ttl +2 -0
- package/data/apps/component/toolbar.ttl +2 -0
- package/data/apps/group/key_value_pairs.ttl +2 -0
- package/data/apps/group/notifications.ttl +2 -0
- package/data/apps/layout/application_layout.ttl +2 -0
- package/data/apps/layout/content_layout.ttl +2 -0
- package/data/apps/layout/empty_layout.ttl +2 -0
- package/data/apps/layout/empty_state.ttl +13 -0
- package/data/apps/layout/list_page_layout.ttl +2 -0
- package/data/apps/layout/settings_page_layout.ttl +2 -0
- package/data/apps/layout/view_layout.ttl +2 -0
- package/data/apps/pattern/action_bar.ttl +4 -2
- package/data/apps/pattern/code_diff.ttl +2 -0
- package/data/apps/pattern/{data_table.ttl → datatable.ttl} +27 -25
- package/data/apps/pattern/destructive_modal.ttl +2 -0
- package/data/apps/pattern/drawer.ttl +2 -0
- package/data/apps/pattern/keyboard_shortcuts.ttl +2 -0
- package/data/apps/pattern/notification_center.ttl +4 -2
- package/data/apps/pattern/side_panel.ttl +39 -4
- package/data/apps/pattern/sidepanel_stacked.ttl +2 -0
- package/data/apps/subcomponent/data_table-action_bar.ttl +7 -5
- package/data/apps/subcomponent/data_table-body_cell.ttl +27 -25
- package/data/apps/subcomponent/data_table-group_header_row.ttl +10 -8
- package/data/apps/subcomponent/data_table-header_cell.ttl +13 -11
- package/data/apps/subcomponent/data_table-pagination_bar.ttl +11 -9
- package/data/apps/subcomponent/data_table-persistent_selection.ttl +12 -10
- package/data/apps/subcomponent/data_table-settings_menu.ttl +17 -15
- package/data/apps/subcomponent/drawer-content.ttl +2 -0
- package/data/apps/subcomponent/drawer-footer.ttl +2 -0
- package/data/apps/subcomponent/drawer-header.ttl +2 -0
- package/data/apps/subcomponent/file_tree-node.ttl +2 -0
- package/data/apps/subcomponent/log.ttl +2 -0
- package/data/apps/subcomponent/side_panel-content.ttl +3 -1
- package/data/apps/subcomponent/side_panel-footer.ttl +3 -1
- package/data/apps/subcomponent/side_panel-header.ttl +3 -1
- package/data/apps.ttl +2 -0
- package/data/apps_anbox/component/theme_switcher.ttl +2 -0
- package/data/apps_anbox/pattern/side_menu.ttl +2 -0
- package/data/apps_anbox.ttl +2 -0
- package/data/apps_debcrafters/component/deb_package_card.ttl +12 -0
- package/data/apps_debcrafters/component/example.ttl +2 -0
- package/data/apps_debcrafters/component/my_fancy_component.ttl +2 -0
- package/data/apps_debcrafters.ttl +2 -0
- package/data/apps_juju/pattern/single_select_multi_layered.ttl +2 -0
- package/data/apps_juju.ttl +2 -0
- package/data/apps_landscape/component/checkbox_group.ttl +110 -0
- package/data/apps_landscape/component/code_editor.ttl +134 -0
- package/data/apps_landscape/component/cron_schedule.ttl +40 -0
- package/data/apps_landscape/component/expandable_radio_group.ttl +106 -0
- package/data/apps_landscape/component/expandable_truncation.ttl +50 -0
- package/data/apps_landscape/component/form_section.ttl +33 -0
- package/data/apps_landscape/component/gpg_key_field.ttl +86 -0
- package/data/apps_landscape/component/grouped_select.ttl +137 -0
- package/data/apps_landscape/component/loading_state.ttl +30 -0
- package/data/apps_landscape/component/managed_file_input.ttl +75 -0
- package/data/apps_landscape/component/multi_select_field.ttl +323 -0
- package/data/apps_landscape/component/pass_rate_filter.ttl +13 -0
- package/data/apps_landscape/component/password_constraints.ttl +3 -0
- package/data/apps_landscape/component/progress_bar.ttl +100 -0
- package/data/apps_landscape/component/read_only_field.ttl +46 -0
- package/data/apps_landscape/component/search_help_popup.ttl +51 -0
- package/data/apps_landscape/component/search_query_editor.ttl +149 -0
- package/data/apps_landscape/component/tag_multi_select.ttl +52 -0
- package/data/apps_landscape/pattern/content_blocks.ttl +70 -0
- package/data/apps_landscape/pattern/dashboard_page_composition.ttl +110 -0
- package/data/apps_landscape/pattern/delivery_scheduling.ttl +24 -0
- package/data/apps_landscape/pattern/form_field_help.ttl +67 -0
- package/data/apps_landscape/pattern/header_search_controls.ttl +106 -0
- package/data/apps_landscape/pattern/ignorable_notification.ttl +60 -0
- package/data/apps_landscape/pattern/information_grid.ttl +93 -0
- package/data/apps_landscape/pattern/instance_association.ttl +29 -0
- package/data/apps_landscape/pattern/process_flow.ttl +52 -0
- package/data/apps_landscape/pattern/progressively_expandable_table.ttl +158 -0
- package/data/apps_landscape/pattern/recurring_schedule.ttl +21 -0
- package/data/apps_landscape/pattern/responsive_action_group.ttl +77 -0
- package/data/apps_landscape/pattern/responsive_header_actions.ttl +83 -0
- package/data/apps_landscape/pattern/responsive_table_filters.ttl +61 -0
- package/data/apps_landscape/pattern/side_panel_form_actions.ttl +126 -0
- package/data/apps_landscape/pattern/sortable_list.ttl +50 -0
- package/data/apps_landscape/pattern/table_filter.ttl +201 -0
- package/data/apps_landscape/pattern/table_filter_chips.ttl +174 -0
- package/data/apps_landscape/pattern/table_pagination.ttl +220 -0
- package/data/apps_landscape/pattern/typed_confirmation_modal.ttl +88 -0
- package/data/apps_landscape/subcomponent/bold_substring.ttl +30 -0
- package/data/apps_landscape/subcomponent/inline_cell_input.ttl +36 -0
- package/data/apps_landscape/subcomponent/label_with_description.ttl +46 -0
- package/data/apps_landscape/subcomponent/nested_dropdown_item.ttl +61 -0
- package/data/apps_landscape/subcomponent/pluralized_bold_count.ttl +36 -0
- package/data/apps_landscape/subcomponent/select_all_results_prompt.ttl +56 -0
- package/data/apps_landscape.ttl +2 -0
- package/data/apps_launchpad/component/accordion.ttl +12 -0
- package/data/apps_launchpad/component/avatar.ttl +4 -2
- package/data/apps_launchpad/component/badge.ttl +4 -2
- package/data/apps_launchpad/component/breadcrumbs.ttl +2 -0
- package/data/apps_launchpad/component/button.ttl +4 -2
- package/data/apps_launchpad/component/checkbox_input.ttl +6 -4
- package/data/apps_launchpad/component/chip.ttl +2 -0
- package/data/apps_launchpad/component/combobox.ttl +4 -2
- package/data/apps_launchpad/component/description_list.ttl +2 -0
- package/data/apps_launchpad/component/drawer.ttl +6 -4
- package/data/apps_launchpad/component/link.ttl +12 -0
- package/data/apps_launchpad/component/log.ttl +2 -0
- package/data/apps_launchpad/component/markdown_editor.ttl +12 -0
- package/data/apps_launchpad/component/modal.ttl +7 -5
- package/data/apps_launchpad/component/pagination.ttl +12 -0
- package/data/apps_launchpad/component/popover.ttl +12 -0
- package/data/apps_launchpad/component/radio_input.ttl +6 -4
- package/data/apps_launchpad/component/relative_timestamp.ttl +12 -0
- package/data/apps_launchpad/component/select_input.ttl +2 -0
- package/data/apps_launchpad/component/spinner.ttl +12 -0
- package/data/apps_launchpad/component/switch.ttl +6 -4
- package/data/apps_launchpad/component/table.ttl +12 -0
- package/data/apps_launchpad/component/text_input.ttl +9 -7
- package/data/apps_launchpad/component/textarea_input.ttl +10 -8
- package/data/apps_launchpad/component/timestamp.ttl +12 -0
- package/data/apps_launchpad/component/tooltip.ttl +4 -2
- package/data/apps_launchpad/subcomponent/combobox-checkbox_option.ttl +2 -0
- package/data/apps_launchpad/subcomponent/combobox-footer.ttl +2 -0
- package/data/apps_launchpad/subcomponent/combobox-group.ttl +2 -0
- package/data/apps_launchpad/subcomponent/combobox-helper.ttl +2 -0
- package/data/apps_launchpad/subcomponent/combobox-loading.ttl +4 -2
- package/data/apps_launchpad/subcomponent/combobox-no_results.ttl +2 -0
- package/data/apps_launchpad/subcomponent/combobox-radio_option.ttl +2 -0
- package/data/apps_launchpad/subcomponent/combobox-search.ttl +6 -4
- package/data/apps_launchpad/subcomponent/description_list-item.ttl +2 -0
- package/data/apps_launchpad/subcomponent/log-line.ttl +2 -0
- package/data/apps_launchpad/subcomponent/modal-content-body.ttl +2 -0
- package/data/apps_launchpad/subcomponent/modal-content-footer.ttl +2 -0
- package/data/apps_launchpad/subcomponent/modal-content-header-close_button.ttl +2 -0
- package/data/apps_launchpad/subcomponent/modal-content-header.ttl +2 -0
- package/data/apps_launchpad/subcomponent/modal-content.ttl +4 -2
- package/data/apps_launchpad/subcomponent/side_panel-content-body.ttl +2 -0
- package/data/apps_launchpad/subcomponent/side_panel-content-footer.ttl +2 -0
- package/data/apps_launchpad/subcomponent/side_panel-content-header-close_button.ttl +2 -0
- package/data/apps_launchpad/subcomponent/side_panel-content-header.ttl +2 -0
- package/data/apps_launchpad/subcomponent/side_panel-content.ttl +2 -0
- package/data/apps_launchpad.ttl +2 -0
- package/data/apps_lxd/component/back_link.ttl +2 -0
- package/data/apps_lxd/component/code_snippet_with_copy_button.ttl +2 -0
- package/data/apps_lxd/component/confirmation_checkbox.ttl +2 -0
- package/data/apps_lxd/component/doc_link.ttl +4 -2
- package/data/apps_lxd/component/meter.ttl +6 -4
- package/data/apps_lxd/component/output_field.ttl +2 -0
- package/data/apps_lxd/component/rename_header.ttl +17 -15
- package/data/apps_lxd/component/tab_links.ttl +6 -4
- package/data/apps_lxd/subcomponent/copy_to_clipboard.ttl +2 -0
- package/data/apps_lxd/view/network_topology.ttl +2 -0
- package/data/apps_lxd.ttl +2 -0
- package/data/apps_notary.ttl +2 -0
- package/data/apps_portal/component/badge.ttl +2 -0
- package/data/apps_portal/component/credit_card_input.ttl +2 -0
- package/data/apps_portal/component/key_value_pair.ttl +2 -0
- package/data/apps_portal/layout/details_view.ttl +18 -0
- package/data/apps_portal/pattern/purchase_summary.ttl +2 -0
- package/data/apps_portal/subcomponent/read_only_modal.ttl +2 -0
- package/data/apps_portal.ttl +2 -0
- package/data/apps_support/component/data_spotlight.ttl +12 -0
- package/data/apps_support/subcomponent/ai_prompt_input.ttl +12 -0
- package/data/apps_support.ttl +6 -0
- package/data/apps_workplaceengineering/component/complex_multi_select.ttl +13 -0
- package/data/apps_workplaceengineering/component/label-highlight.ttl +3 -1
- package/data/apps_workplaceengineering/component/rule.ttl +2 -0
- package/data/apps_workplaceengineering/component/skip_link.ttl +2 -0
- package/data/apps_workplaceengineering/component/theme_switcher.ttl +2 -0
- package/data/apps_workplaceengineering/pattern/callout_numbers_card.ttl +2 -0
- package/data/apps_workplaceengineering/pattern/confirmation_modal.ttl +12 -0
- package/data/apps_workplaceengineering/pattern/event_timeline.ttl +2 -0
- package/data/apps_workplaceengineering/pattern/group_card.ttl +2 -0
- package/data/apps_workplaceengineering/pattern/travel_provider_card.ttl +2 -0
- package/data/apps_workplaceengineering/subcomponent/multi_select_input.ttl +12 -0
- package/data/apps_workplaceengineering.ttl +2 -0
- package/data/concept/Foundations-Baseline.ttl +11 -0
- package/data/concept/Foundations-Density--the-form-channel.ttl +11 -0
- package/data/concept/Foundations-Grid--Layout.ttl +11 -0
- package/data/concept/Foundations-Spacing/-Element-vs-container-owned.ttl +11 -0
- package/data/concept/Foundations-Spacing.ttl +11 -0
- package/data/concept/Foundations-Surfaces.ttl +11 -0
- package/data/concept/Foundations-Typography.ttl +11 -0
- package/data/concept/{How-to-differentiate-components-variantsinheritance.ttl → How-to-differentiate-types-of-UI-blocks-.ttl} +5 -3
- package/data/concept/How-to-indicate-required-fields-in-forms.ttl +11 -0
- package/data/concept/How-to-support-modifiers-in-a-component.ttl +11 -0
- package/data/concept/Intentional-friction.ttl +11 -0
- package/data/concept/Question-mark-vs-information-icon.ttl +3 -1
- package/data/concept/Understanding-the-modifier-contract.ttl +11 -0
- package/data/concepttype/Explanation.ttl +2 -0
- package/data/concepttype/How-to-guide.ttl +2 -0
- package/data/concepttype/Reference.ttl +2 -0
- package/data/concepttype/Tutorial.ttl +2 -0
- package/data/documentation/layout/documentation_layout.ttl +2 -0
- package/data/documentation/pattern/library_side_navigation.ttl +3 -1
- package/data/documentation.ttl +2 -0
- package/data/global/component/accordion.ttl +180 -1
- package/data/global/component/announcement.ttl +13 -2
- package/data/global/component/avatar.ttl +2 -0
- package/data/global/component/badge.ttl +4 -2
- package/data/global/component/breadcrumbs.ttl +77 -2
- package/data/global/component/button.ttl +197 -2
- package/data/global/component/button_link.ttl +2 -0
- package/data/global/component/card.ttl +150 -3
- package/data/global/component/checkbox_field.ttl +269 -2
- package/data/global/component/chip.ttl +3 -1
- package/data/global/component/choices_field.ttl +373 -2
- package/data/global/component/code_snippet-content.ttl +3 -1
- package/data/global/component/code_snippet-header.ttl +21 -2
- package/data/global/component/code_snippet.ttl +28 -1
- package/data/global/component/color_field.ttl +2 -0
- package/data/global/component/combobox_field.ttl +470 -3
- package/data/global/component/contextual_menu.ttl +2 -0
- package/data/global/component/data_tooltip.ttl +149 -2
- package/data/global/component/date_field.ttl +158 -3
- package/data/global/component/date_time_field.ttl +157 -2
- package/data/global/component/drag_and_drop_list.ttl +13 -0
- package/data/global/component/dropdown_button.ttl +2 -0
- package/data/global/component/file_upload_field.ttl +230 -3
- package/data/global/component/heading.ttl +62 -3
- package/data/global/component/hidden_field.ttl +3 -1
- package/data/global/component/icon.ttl +3 -1
- package/data/global/component/icon_in_container.ttl +2 -0
- package/data/global/component/inline_code.ttl +2 -0
- package/data/global/component/keyboard_key.ttl +77 -2
- package/data/global/component/markdown_field.ttl +2 -0
- package/data/global/component/mode_switcher.ttl +2 -0
- package/data/global/component/month_field.ttl +2 -0
- package/data/global/component/notification_inline.ttl +2 -0
- package/data/global/component/notification_toast.ttl +2 -0
- package/data/global/component/number_field.ttl +2 -0
- package/data/global/component/pagination.ttl +2 -0
- package/data/global/component/password_field.ttl +189 -2
- package/data/global/component/phone_field.ttl +173 -2
- package/data/global/component/popover.ttl +2 -0
- package/data/global/component/range_field.ttl +165 -2
- package/data/global/component/rating_field.ttl +2 -0
- package/data/global/component/relative_timestamp.ttl +2 -0
- package/data/global/component/rich_choices_field.ttl +205 -2
- package/data/global/component/rich_text_field.ttl +2 -0
- package/data/global/component/search_field.ttl +2 -0
- package/data/global/component/segmented_control_field.ttl +2 -0
- package/data/global/component/select_field.ttl +158 -3
- package/data/global/component/switch_field.ttl +190 -3
- package/data/global/component/table.ttl +4 -2
- package/data/global/component/tabs.ttl +13 -2
- package/data/global/component/tag.ttl +13 -2
- package/data/global/component/text_field.ttl +173 -2
- package/data/global/component/textarea_field.ttl +157 -2
- package/data/global/component/tile.ttl +108 -1
- package/data/global/component/time_field.ttl +157 -2
- package/data/global/component/timestamp.ttl +2 -0
- package/data/global/component/tooltip.ttl +166 -43
- package/data/global/component/tooltip_wrapper.ttl +61 -2
- package/data/global/group/buttons.ttl +2 -0
- package/data/global/group/cards.ttl +2 -0
- package/data/global/group/code_snippets.ttl +2 -0
- package/data/global/group/keyboard_keys.ttl +101 -2
- package/data/global/group/tiles.ttl +2 -0
- package/data/global/layout/error_layout.ttl +2 -0
- package/data/global/layout/form_layout.ttl +2 -0
- package/data/global/layout/identity_page_form.ttl +2 -0
- package/data/global/modifier/alpha.ttl +2 -0
- package/data/global/modifier/beta.ttl +2 -0
- package/data/global/modifier/caution.ttl +2 -0
- package/data/global/modifier/comfortable.ttl +2 -0
- package/data/global/modifier/completed.ttl +2 -0
- package/data/global/modifier/constructive.ttl +2 -0
- package/data/global/modifier/dark.ttl +2 -0
- package/data/global/modifier/dense.ttl +2 -0
- package/data/global/modifier/destructive.ttl +2 -0
- package/data/global/modifier/editable.ttl +2 -0
- package/data/global/modifier/elevated.ttl +2 -0
- package/data/global/modifier/error.ttl +2 -0
- package/data/global/modifier/experimental.ttl +2 -0
- package/data/global/modifier/failed.ttl +2 -0
- package/data/global/modifier/focused.ttl +2 -0
- package/data/global/modifier/highlighted.ttl +2 -0
- package/data/global/modifier/in_progress.ttl +2 -0
- package/data/global/modifier/information.ttl +2 -0
- package/data/global/modifier/light.ttl +2 -0
- package/data/global/modifier/loading.ttl +2 -0
- package/data/global/modifier/modal.ttl +2 -0
- package/data/global/modifier/muted.ttl +2 -0
- package/data/global/modifier/planned.ttl +2 -0
- package/data/global/modifier/primary.ttl +2 -0
- package/data/global/modifier/secondary.ttl +2 -0
- package/data/global/modifier/stable.ttl +2 -0
- package/data/global/modifier/success.ttl +2 -0
- package/data/global/modifier/surface1.ttl +2 -0
- package/data/global/modifier/surface2.ttl +2 -0
- package/data/global/modifier/surface3.ttl +2 -0
- package/data/global/modifier/tertiary.ttl +2 -0
- package/data/global/modifier/warning.ttl +2 -0
- package/data/global/modifier/wireframe.ttl +2 -0
- package/data/global/modifier_family/_color_luminosity.ttl +2 -0
- package/data/global/modifier_family/_emphasis.ttl +2 -0
- package/data/global/modifier_family/_other.ttl +2 -0
- package/data/global/modifier_family/anticipation.ttl +2 -0
- package/data/global/modifier_family/criticality.ttl +2 -0
- package/data/global/modifier_family/density.ttl +2 -0
- package/data/global/modifier_family/importance.ttl +2 -0
- package/data/global/modifier_family/lifecycle.ttl +2 -0
- package/data/global/modifier_family/mode.ttl +2 -0
- package/data/global/modifier_family/release.ttl +2 -0
- package/data/global/modifier_family/surface.ttl +2 -0
- package/data/global/pattern/description_list.ttl +2 -0
- package/data/global/pattern/field.ttl +2 -0
- package/data/global/pattern/form.ttl +2 -0
- package/data/global/pattern/form_login.ttl +2 -0
- package/data/global/pattern/info_table.ttl +2 -0
- package/data/global/pattern/modal.ttl +431 -4
- package/data/global/pattern/navigation.ttl +2 -0
- package/data/global/pattern/stepper.ttl +2 -0
- package/data/global/pattern/table_of_contents.ttl +85 -2
- package/data/global/pattern/timeline.ttl +48 -13
- package/data/global/subcomponent/accordion-item.ttl +157 -2
- package/data/global/subcomponent/breadcrumbs-item.ttl +69 -2
- package/data/global/subcomponent/card-content.ttl +53 -2
- package/data/global/subcomponent/card-footer.ttl +2 -0
- package/data/global/subcomponent/card-header.ttl +45 -2
- package/data/global/subcomponent/card-image.ttl +13 -2
- package/data/global/subcomponent/card-thumbnail.ttl +37 -2
- package/data/global/subcomponent/chart_legend.ttl +93 -2
- package/data/global/subcomponent/chart_legend_item.ttl +77 -2
- package/data/global/subcomponent/checkbox_input.ttl +165 -2
- package/data/global/subcomponent/color_input.ttl +2 -0
- package/data/global/subcomponent/combobox_input.ttl +398 -3
- package/data/global/subcomponent/date_input.ttl +85 -2
- package/data/global/subcomponent/date_time_input.ttl +85 -2
- package/data/global/subcomponent/field-description.ttl +13 -2
- package/data/global/subcomponent/field-error.ttl +29 -0
- package/data/global/subcomponent/field-label.ttl +37 -2
- package/data/global/subcomponent/file_upload_input.ttl +158 -3
- package/data/global/subcomponent/hidden_input.ttl +3 -1
- package/data/global/subcomponent/kvp_container.ttl +77 -2
- package/data/global/subcomponent/kvpitem_base.ttl +69 -2
- package/data/global/subcomponent/markdown_input.ttl +2 -0
- package/data/global/subcomponent/modal-content.ttl +38 -2
- package/data/global/subcomponent/modal-footer.ttl +262 -2
- package/data/global/subcomponent/modal-header.ttl +294 -2
- package/data/global/subcomponent/month_input.ttl +2 -0
- package/data/global/subcomponent/number_input.ttl +2 -0
- package/data/global/subcomponent/password_input.ttl +117 -2
- package/data/global/subcomponent/phone_input.ttl +101 -2
- package/data/global/subcomponent/radio_input.ttl +94 -3
- package/data/global/subcomponent/range_input.ttl +85 -2
- package/data/global/subcomponent/rating_input.ttl +2 -0
- package/data/global/subcomponent/rich_text_input.ttl +2 -0
- package/data/global/subcomponent/search_input.ttl +5 -3
- package/data/global/subcomponent/segmented_control_input.ttl +2 -0
- package/data/global/subcomponent/select_input.ttl +86 -3
- package/data/global/subcomponent/spin_button.ttl +2 -0
- package/data/global/subcomponent/spinner.ttl +3 -1
- package/data/global/subcomponent/switch_input.ttl +86 -3
- package/data/global/subcomponent/table-cell.ttl +2 -0
- package/data/global/subcomponent/table-row.ttl +2 -0
- package/data/global/subcomponent/text_input.ttl +101 -2
- package/data/global/subcomponent/textarea_input.ttl +85 -2
- package/data/global/subcomponent/tile-content.ttl +45 -2
- package/data/global/subcomponent/tile-header.ttl +45 -2
- package/data/global/subcomponent/time_input.ttl +85 -2
- package/data/global/subcomponent/timeline-content.ttl +37 -2
- package/data/global/subcomponent/timeline-event.ttl +42 -7
- package/data/global/subcomponent/timeline-expansion_indicator.ttl +3 -1
- package/data/global/subcomponent/timeline-header.ttl +3 -1
- package/data/global/variant/tooltip_dense.ttl +2 -0
- package/data/global/view/settings_view.ttl +2 -0
- package/data/global.ttl +2 -0
- package/data/sites/component/blog_card.ttl +2 -0
- package/data/sites/component/quote.ttl +2 -0
- package/data/sites/component/rule.ttl +2 -0
- package/data/sites/component/section.ttl +2 -0
- package/data/sites/group/blog_cards.ttl +2 -0
- package/data/sites/group/xblog_elements.ttl +2 -0
- package/data/sites/layout/blog_page_layout.ttl +2 -0
- package/data/sites/layout/case_study_layout.ttl +2 -0
- package/data/sites/layout/site_layout.ttl +2 -0
- package/data/sites/pattern/hero-github.ttl +2 -0
- package/data/sites/pattern/hero.ttl +2 -0
- package/data/sites/pattern/info_table.ttl +2 -0
- package/data/sites/pattern/pricing_section.ttl +2 -0
- package/data/sites/pattern/pricing_table.ttl +2 -0
- package/data/sites/pattern/read_more_section.ttl +2 -0
- package/data/sites/pattern/skip_link.ttl +2 -0
- package/data/sites.ttl +2 -0
- package/data/sites_webcomponentsprototype/component/blog_cards.ttl +2 -0
- package/data/sites_webcomponentsprototype/component/ctablock.ttl +2 -0
- package/data/sites_webcomponentsprototype/component/list.ttl +2 -0
- package/data/sites_webcomponentsprototype/component/tabs.ttl +2 -0
- package/data/sites_webcomponentsprototype/layout/site_layout.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/basic_section.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/blog_section.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/ctasection.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/equal_heights.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/hero.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/logo_section.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/quote_wrapper.ttl +2 -0
- package/data/sites_webcomponentsprototype/pattern/tiered_list.ttl +2 -0
- package/data/sites_webcomponentsprototype.ttl +2 -0
- package/data/stores.ttl +2 -0
- package/data/tag/allgood.ttl +2 -0
- package/data/tag/beta.ttl +2 -0
- package/data/tag/candidate.ttl +2 -0
- package/data/tag/devbatch1.ttl +2 -0
- package/data/tag/devbatch2.ttl +2 -0
- package/data/tag/devbatch3.ttl +9 -0
- package/data/tag/devexternal.ttl +2 -0
- package/data/tag/devreactapproved.ttl +2 -0
- package/data/tag/devreactbase.ttl +2 -0
- package/data/tag/devreactpreapproved.ttl +2 -0
- package/data/tag/devspecial.ttl +2 -0
- package/data/tag/devsveltedone.ttl +2 -0
- package/data/tag/devsveltein-progress.ttl +2 -0
- package/data/tag/divergent.ttl +2 -0
- package/data/tag/docscomplete.ttl +2 -0
- package/data/tag/draft.ttl +2 -0
- package/data/tag/edge.ttl +2 -0
- package/data/tag/global-docs-missing.ttl +2 -0
- package/data/tag/has-no-global-entry.ttl +2 -0
- package/data/tag/lpto-be-upstreamed.ttl +2 -0
- package/data/tag/lptriageblocked-reqs-design.ttl +2 -0
- package/data/tag/lptriageno-upstream.ttl +2 -0
- package/data/tag/lptriagereimplement-and-deprecate.ttl +2 -0
- package/data/tag/lptriagereimplement-and-keep.ttl +2 -0
- package/data/tag/lptriageupstream-and-deprecate.ttl +2 -0
- package/data/tag/minimal.ttl +2 -0
- package/data/tag/needsdefinition.ttl +2 -0
- package/data/tag/needsdiscussion.ttl +2 -0
- package/data/tag/needsdocumentation.ttl +2 -0
- package/data/tag/needsreview.ttl +2 -0
- package/data/tag/needstriage.ttl +2 -0
- package/data/tag/needsupdate.ttl +2 -0
- package/data/tag/notstarted.ttl +2 -0
- package/data/tag/specialadoption-docs.ttl +2 -0
- package/data/tag/stable.ttl +2 -0
- package/data/tag/stylesready.ttl +2 -0
- package/data/tag/triagedbacklog.ttl +2 -0
- package/data/tag/triagedrejected.ttl +2 -0
- package/data/tag/upstream-candidate.ttl +2 -0
- package/data/tag/upstream-compliant.ttl +2 -0
- package/data/tag/upstreamcandidate.ttl +2 -0
- package/data/tag/waiting-for-delta-review.ttl +2 -0
- package/data/tag/wpeinital-implementation.ttl +2 -0
- package/data/tag/wpetriageupstream-and-deprecate.ttl +2 -0
- package/data/tagcategory/channel.ttl +2 -0
- package/data/tagcategory/concept-status.ttl +2 -0
- package/data/tagcategory/concept-type.ttl +2 -0
- package/data/tagcategory/documentation-stage.ttl +2 -0
- package/data/tagcategory/implementation-status.ttl +2 -0
- package/data/tagcategory/lpupstream.ttl +2 -0
- package/data/tagcategory/review-status.ttl +2 -0
- package/data/tagcategory/tmp.ttl +2 -0
- package/definitions/ontology.ttl +78 -1
- package/package.json +34 -8
- package/skills/adoption-a1-styles/SKILL.md +24 -0
- package/skills/adoption-a2-components/SKILL.md +22 -6
- package/skills/anatomy-author/ANATOMY_DSL_SPEC.md +1397 -327
- package/skills/anatomy-author/SKILL.md +840 -137
- package/skills/design-auditor/SKILL.md +133 -9
- package/skills/implement-component/SKILL.md +192 -23
- package/skills/specify-component/SKILL.md +124 -12
- package/skills/specify-pattern/SKILL.md +47 -8
- package/src/collect/generateTurtle.tests.ts +94 -1
- package/src/collect/generateTurtle.ts +65 -3
- package/src/collect/resolvePublicExports.tests.ts +159 -0
- package/src/collect/resolvePublicExports.ts +244 -0
- package/src/collect/types.ts +11 -0
- package/src/collect-implementations.ts +0 -0
- package/src/serializers/TTLSerializer.tests.ts +101 -0
- package/src/serializers/TTLSerializer.ts +17 -2
- package/.github/ISSUE_TEMPLATE/propose-changes-to-existing-ui-block.md +0 -14
- package/.github/ISSUE_TEMPLATE/propose-new-ui-block.md +0 -26
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -22
- package/.github/workflows/ci.yml +0 -49
- package/.github/workflows/sync-coda-manual.yml +0 -25
- package/.github/workflows/sync-coda-scheduled.yml +0 -22
- package/.github/workflows/sync-coda.yml +0 -102
- package/.mcp.json +0 -12
- package/GEMINI.md +0 -2
- package/biome.json +0 -6
- package/bun.lock +0 -392
- package/data/apps_landscape/component/truncated_cell.ttl +0 -38
- package/data/concept/Foundations-Grid.ttl +0 -9
- package/data/concept/Indicating-required-fields-in-forms.ttl +0 -9
- package/data/concepttype/Decision-guide.ttl +0 -5
- package/data/concepttype/Mental-model.ttl +0 -5
- package/examples/form-roster.target.json +0 -550
- package/source.json +0 -205
- package/specs/README.md +0 -17
- package/src/cli.ts +0 -58
- package/src/commands/extract.tests.ts +0 -40
- package/src/commands/extract.ts +0 -50
- package/src/commands/index.ts +0 -4
- package/src/commands/list.tests.ts +0 -25
- package/src/commands/list.ts +0 -26
- package/src/commands/sync.tests.ts +0 -430
- package/src/commands/sync.ts +0 -418
- package/src/commands/transform.tests.ts +0 -213
- package/src/commands/transform.ts +0 -257
- package/src/config/index.ts +0 -2
- package/src/config/source.schema.json +0 -146
- package/src/config/types.ts +0 -129
- package/src/config/validateConfig.tests.ts +0 -46
- package/src/config/validateConfig.ts +0 -21
- package/src/constants.ts +0 -19
- package/src/providers/CodaProvider.tests.ts +0 -335
- package/src/providers/CodaProvider.ts +0 -384
- package/src/providers/CodaProvider.types.generated.ts +0 -12597
- package/src/providers/detectSmartChips.tests.ts +0 -42
- package/src/providers/detectSmartChips.ts +0 -60
- package/src/providers/index.ts +0 -18
- package/src/scripts/checkDataDeletion.ts +0 -68
- package/src/scripts/evaluateDataDeletion.tests.ts +0 -100
- package/src/scripts/evaluateDataDeletion.ts +0 -100
- package/src/sync/constants.ts +0 -52
- package/src/sync/diffRoster.tests.ts +0 -455
- package/src/sync/diffRoster.ts +0 -241
- package/src/sync/loadTargetSpec.tests.ts +0 -208
- package/src/sync/loadTargetSpec.ts +0 -139
- package/src/sync/renderPlan.tests.ts +0 -144
- package/src/sync/renderPlan.ts +0 -88
- package/src/sync/snapshotTable.tests.ts +0 -31
- package/src/sync/snapshotTable.ts +0 -20
- package/src/sync/toLiveEntries.tests.ts +0 -76
- package/src/sync/toLiveEntries.ts +0 -55
- package/src/sync/types.ts +0 -101
- package/src/transform/collectDataMetrics.tests.ts +0 -108
- package/src/transform/collectDataMetrics.ts +0 -114
- package/src/transform/deltaGuards.tests.ts +0 -136
- package/src/transform/deltaGuards.ts +0 -118
- package/src/transform/expectedTables.tests.ts +0 -99
- package/src/transform/expectedTables.ts +0 -34
- package/src/transform/isValidReferenceUri.tests.ts +0 -45
- package/src/transform/isValidReferenceUri.ts +0 -55
- package/src/transform/materializeInverses.tests.ts +0 -81
- package/src/transform/materializeInverses.ts +0 -78
- package/src/transform/resolveReferences.tests.ts +0 -67
- package/src/transform/resolveReferences.ts +0 -36
- package/src/transform/resolveValue.tests.ts +0 -82
- package/src/transform/resolveValue.ts +0 -87
- package/src/transform/rowFilter.tests.ts +0 -100
- package/src/transform/rowFilter.ts +0 -55
- package/src/transform/transform.tests.ts +0 -132
- package/src/transform/transform.ts +0 -145
- package/src/transform/transformRow.malformedRefs.tests.ts +0 -127
- package/src/transform/transformRow.tests.ts +0 -466
- package/src/transform/transformRow.ts +0 -358
- package/src/transform/types.ts +0 -37
- package/tsconfig.json +0 -9
- package/vite.config.ts +0 -11
- package/vitest.config.ts +0 -50
package/src/commands/sync.ts
DELETED
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
import { CodaProvider, type TableRow } from "../providers/index.js";
|
|
2
|
-
import {
|
|
3
|
-
COLUMN,
|
|
4
|
-
LOOKUP_OPTION,
|
|
5
|
-
RECONCILE_PASSES,
|
|
6
|
-
SETTLE_MS,
|
|
7
|
-
THROTTLE_MS,
|
|
8
|
-
} from "../sync/constants.js";
|
|
9
|
-
import diffRoster from "../sync/diffRoster.js";
|
|
10
|
-
import loadTargetSpec from "../sync/loadTargetSpec.js";
|
|
11
|
-
import renderPlan from "../sync/renderPlan.js";
|
|
12
|
-
import snapshotTable from "../sync/snapshotTable.js";
|
|
13
|
-
import toLiveEntries from "../sync/toLiveEntries.js";
|
|
14
|
-
import type {
|
|
15
|
-
EntryShape,
|
|
16
|
-
PlannedOp,
|
|
17
|
-
SyncPlan,
|
|
18
|
-
TargetSpec,
|
|
19
|
-
} from "../sync/types.js";
|
|
20
|
-
|
|
21
|
-
/** Options controlling a sync run. */
|
|
22
|
-
export interface SyncOptions {
|
|
23
|
-
/** Path to the declarative target-spec JSON. */
|
|
24
|
-
specPath: string;
|
|
25
|
-
/** When false (default), the run is dry — no writes. */
|
|
26
|
-
apply: boolean;
|
|
27
|
-
/** Timestamp string for the snapshot filename (injected; `Date` is unavailable in some contexts). */
|
|
28
|
-
stamp?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The gated Coda roster sync: read live rows, diff against the target spec,
|
|
33
|
-
* render the plan, and (only with `apply` + zero violations) perform writes.
|
|
34
|
-
*
|
|
35
|
-
* This is the gated-write mechanism mandated by pragma-adrs M.03 D3. The diff is
|
|
36
|
-
* always shown; `apply` is refused while any guardrail violation stands, and a
|
|
37
|
-
* table snapshot is taken before any mutation so deletions are reversible.
|
|
38
|
-
*
|
|
39
|
-
* @param options - spec path, apply flag, and snapshot timestamp
|
|
40
|
-
* @returns the computed plan (also rendered to stdout)
|
|
41
|
-
* @note Impure — reads the file system, calls the Coda API, and writes to stdout.
|
|
42
|
-
*/
|
|
43
|
-
export default async function sync(options: SyncOptions): Promise<SyncPlan> {
|
|
44
|
-
const spec = await loadTargetSpec(options.specPath);
|
|
45
|
-
|
|
46
|
-
const provider = new CodaProvider();
|
|
47
|
-
const rows = await provider.fetchTable(
|
|
48
|
-
spec.scope.documentId,
|
|
49
|
-
spec.scope.table,
|
|
50
|
-
);
|
|
51
|
-
const live = toLiveEntries(rows, spec.scope.tiers);
|
|
52
|
-
|
|
53
|
-
const plan = diffRoster(spec, live);
|
|
54
|
-
console.log(renderPlan(plan));
|
|
55
|
-
|
|
56
|
-
if (options.apply) {
|
|
57
|
-
if (plan.violations.length > 0) {
|
|
58
|
-
throw new Error(
|
|
59
|
-
`Refusing --apply: ${plan.violations.length} guardrail violation(s) must be resolved first`,
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
const snapshotPath = `coda-snapshot-${options.stamp ?? "unstamped"}.json`;
|
|
63
|
-
await snapshotTable(rows, snapshotPath);
|
|
64
|
-
console.log(`\n✓ snapshot written: ${snapshotPath} (${rows.length} rows)`);
|
|
65
|
-
|
|
66
|
-
// Coda row writes require column IDs, not display names (names silently
|
|
67
|
-
// no-op — they return 202 but change nothing). Resolve name→ID up front.
|
|
68
|
-
const columns = await provider.fetchTableColumns(
|
|
69
|
-
spec.scope.documentId,
|
|
70
|
-
spec.scope.table,
|
|
71
|
-
);
|
|
72
|
-
const columnId = buildColumnIdMap(columns);
|
|
73
|
-
// Lookup columns (tier/type) must be written by option row-id, learned from
|
|
74
|
-
// the fetched rows + a static seed for options absent from in-scope rows.
|
|
75
|
-
const lookupId = buildLookupIdMap(rows);
|
|
76
|
-
const finalPlan = await applyAndReconcile(
|
|
77
|
-
provider,
|
|
78
|
-
spec,
|
|
79
|
-
plan,
|
|
80
|
-
columnId,
|
|
81
|
-
lookupId,
|
|
82
|
-
);
|
|
83
|
-
return finalPlan;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return plan;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Apply the plan, then verify by re-reading and re-diffing — Coda's write API is
|
|
91
|
-
* eventually consistent and silently drops a fraction of a long write burst
|
|
92
|
-
* (returns 202, persists nothing). Any residual ops are retried, up to
|
|
93
|
-
* {@link RECONCILE_PASSES} passes; the tool's idempotency makes re-application
|
|
94
|
-
* safe (already-applied ops diff as no-change).
|
|
95
|
-
*
|
|
96
|
-
* @param provider - the Coda client
|
|
97
|
-
* @param spec - the target spec
|
|
98
|
-
* @param firstPlan - the plan from the initial diff
|
|
99
|
-
* @param columnId - source-column name→id map
|
|
100
|
-
* @param lookupId - tier/type display-name→option-row-id maps
|
|
101
|
-
* @returns the plan after the final pass (its `ops` should be empty on success)
|
|
102
|
-
* @note Impure — repeated Coda reads/writes.
|
|
103
|
-
*/
|
|
104
|
-
async function applyAndReconcile(
|
|
105
|
-
provider: CodaProvider,
|
|
106
|
-
spec: TargetSpec,
|
|
107
|
-
firstPlan: SyncPlan,
|
|
108
|
-
columnId: Record<string, string>,
|
|
109
|
-
lookupId: LookupIdMap,
|
|
110
|
-
): Promise<SyncPlan> {
|
|
111
|
-
let plan = firstPlan;
|
|
112
|
-
// Target keys (name|tier|type) already issued as `create` this run. A freshly
|
|
113
|
-
// created row may not be readable on the next pass's re-fetch (Coda is
|
|
114
|
-
// eventually consistent), which would otherwise re-create it → duplicates.
|
|
115
|
-
// Once issued, a create is suppressed in later passes; only genuinely-new
|
|
116
|
-
// ops are retried.
|
|
117
|
-
const createdKeys = new Set<string>();
|
|
118
|
-
for (let pass = 1; pass <= RECONCILE_PASSES; pass++) {
|
|
119
|
-
const applicable = plan.ops.filter(
|
|
120
|
-
(op) => isPending(op) && !alreadyCreated(op, createdKeys),
|
|
121
|
-
);
|
|
122
|
-
if (applicable.length === 0) {
|
|
123
|
-
console.log(`\n✓ reconciled — no residual ops after pass ${pass - 1}.`);
|
|
124
|
-
return plan;
|
|
125
|
-
}
|
|
126
|
-
console.log(`\n── Apply pass ${pass} (${applicable.length} op(s)) ──`);
|
|
127
|
-
await applyPlan(
|
|
128
|
-
provider,
|
|
129
|
-
spec,
|
|
130
|
-
{ ...plan, ops: applicable },
|
|
131
|
-
columnId,
|
|
132
|
-
lookupId,
|
|
133
|
-
);
|
|
134
|
-
for (const op of applicable) {
|
|
135
|
-
if (op.kind === "create" && op.after) {
|
|
136
|
-
createdKeys.add(shapeKey(op.after));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Let Coda's async write queue settle before re-reading.
|
|
141
|
-
await new Promise((resolve) => setTimeout(resolve, SETTLE_MS));
|
|
142
|
-
const rows = await provider.fetchTable(
|
|
143
|
-
spec.scope.documentId,
|
|
144
|
-
spec.scope.table,
|
|
145
|
-
);
|
|
146
|
-
plan = diffRoster(spec, toLiveEntries(rows, spec.scope.tiers));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const residual = plan.ops.filter(
|
|
150
|
-
(op) => isPending(op) && !alreadyCreated(op, createdKeys),
|
|
151
|
-
).length;
|
|
152
|
-
if (residual > 0) {
|
|
153
|
-
console.log(
|
|
154
|
-
`\n⚠ ${residual} op(s) still unapplied after ${RECONCILE_PASSES} passes — re-run \`ds:sync --apply\` to continue.`,
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
return plan;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/** Stable key for a target shape, for create-dedup across reconcile passes. */
|
|
161
|
-
function shapeKey(after: EntryShape): string {
|
|
162
|
-
return `${after.name}|${after.tier}|${after.type}`;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/** Whether a create op's target was already issued this run (suppress re-create). */
|
|
166
|
-
function alreadyCreated(op: PlannedOp, createdKeys: Set<string>): boolean {
|
|
167
|
-
return (
|
|
168
|
-
op.kind === "create" &&
|
|
169
|
-
op.after !== null &&
|
|
170
|
-
createdKeys.has(shapeKey(op.after))
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Whether an op still needs applying. A `create` is always pending; a `merge` is
|
|
176
|
-
* pending while its row exists (`before` present); a mutate (move/rename/retype)
|
|
177
|
-
* is pending only if it actually changes a field — an already-applied rename
|
|
178
|
-
* re-diffs as the same op with empty `changedFields` and must count as done, or
|
|
179
|
-
* the reconcile loop never converges.
|
|
180
|
-
*
|
|
181
|
-
* @param op - the planned op
|
|
182
|
-
* @returns true if the op represents an outstanding change
|
|
183
|
-
*/
|
|
184
|
-
function isPending(op: PlannedOp): boolean {
|
|
185
|
-
if (op.kind === "keep") {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
if (op.kind === "create") {
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
if (op.kind === "merge") {
|
|
192
|
-
return op.before !== null;
|
|
193
|
-
}
|
|
194
|
-
return op.changedFields.length > 0;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Map the source column display names ({@link COLUMN}) to their Coda column IDs.
|
|
199
|
-
*
|
|
200
|
-
* @param columns - the table's column metadata
|
|
201
|
-
* @returns a record of `name`/`tier`/`type` → column id
|
|
202
|
-
* @throws if any required source column is missing
|
|
203
|
-
*/
|
|
204
|
-
function buildColumnIdMap(
|
|
205
|
-
columns: Array<{ id: string; name: string }>,
|
|
206
|
-
): Record<string, string> {
|
|
207
|
-
const byName = new Map(columns.map((c) => [c.name, c.id] as const));
|
|
208
|
-
const map: Record<string, string> = {};
|
|
209
|
-
for (const col of [COLUMN.name, COLUMN.tier, COLUMN.type]) {
|
|
210
|
-
const id = byName.get(col);
|
|
211
|
-
if (!id) {
|
|
212
|
-
throw new Error(`Coda column "${col}" not found — cannot write`);
|
|
213
|
-
}
|
|
214
|
-
map[col] = id;
|
|
215
|
-
}
|
|
216
|
-
return map;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Execute a vetted plan against Coda: non-destructive ops first (create / move /
|
|
221
|
-
* rename / retype), row deletions LAST. Each op is logged. Assumes zero
|
|
222
|
-
* violations and a snapshot already taken (the caller guarantees both).
|
|
223
|
-
*
|
|
224
|
-
* @param provider - the Coda client
|
|
225
|
-
* @param spec - the target spec (for scope: documentId, table)
|
|
226
|
-
* @param plan - the vetted plan
|
|
227
|
-
* @note Impure — performs mutating Coda calls.
|
|
228
|
-
*/
|
|
229
|
-
export async function applyPlan(
|
|
230
|
-
provider: CodaProvider,
|
|
231
|
-
spec: TargetSpec,
|
|
232
|
-
plan: SyncPlan,
|
|
233
|
-
columnId: Record<string, string>,
|
|
234
|
-
lookupId: LookupIdMap,
|
|
235
|
-
): Promise<void> {
|
|
236
|
-
const { documentId, table } = spec.scope;
|
|
237
|
-
// Partition into typed work-lists. The predicates narrow the op shape so the
|
|
238
|
-
// executors receive guaranteed non-null fields — no in-executor guards needed.
|
|
239
|
-
const creates = plan.ops.filter(isCreate);
|
|
240
|
-
const updates = plan.ops.filter(isUpdate);
|
|
241
|
-
const deletions = plan.ops.filter(isDeletion);
|
|
242
|
-
|
|
243
|
-
// Last-resort safety: any actionable op that matched none of the three
|
|
244
|
-
// executors is malformed and would be silently skipped — refuse instead.
|
|
245
|
-
const classified = new Set<PlannedOp>([...creates, ...updates, ...deletions]);
|
|
246
|
-
const orphan = plan.ops.find(
|
|
247
|
-
(op) => op.kind !== "keep" && !classified.has(op),
|
|
248
|
-
);
|
|
249
|
-
if (orphan) {
|
|
250
|
-
throw new Error(
|
|
251
|
-
`apply: ${orphan.kind} op (rowId ${orphan.rowId}) matched no executor — refusing to silently skip it`,
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
console.log(`\nApplying ${creates.length + updates.length} write(s)…`);
|
|
256
|
-
for (const op of creates) {
|
|
257
|
-
await provider.createRow(
|
|
258
|
-
documentId,
|
|
259
|
-
table,
|
|
260
|
-
toCells(op.after, columnId, lookupId),
|
|
261
|
-
);
|
|
262
|
-
console.log(
|
|
263
|
-
` + created ${op.after.name} [${op.after.tier}/${op.after.type}]`,
|
|
264
|
-
);
|
|
265
|
-
await throttle();
|
|
266
|
-
}
|
|
267
|
-
for (const op of updates) {
|
|
268
|
-
await provider.updateRow(
|
|
269
|
-
documentId,
|
|
270
|
-
table,
|
|
271
|
-
op.rowId,
|
|
272
|
-
toCells(op.after, columnId, lookupId),
|
|
273
|
-
);
|
|
274
|
-
console.log(
|
|
275
|
-
` ~ ${op.kind} ${op.after.name} [${op.after.tier}/${op.after.type}] (${op.rowId})`,
|
|
276
|
-
);
|
|
277
|
-
await throttle();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
console.log(`\nApplying ${deletions.length} deletion(s) (last)…`);
|
|
281
|
-
for (const op of deletions) {
|
|
282
|
-
await provider.deleteRows(documentId, table, [op.rowId]);
|
|
283
|
-
console.log(` − deleted ${op.before.name} (${op.rowId})`);
|
|
284
|
-
await throttle();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
console.log("\n✓ apply complete.");
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/** A create op: has a target shape, no row id yet. */
|
|
291
|
-
type CreateOp = PlannedOp & { kind: "create"; after: EntryShape };
|
|
292
|
-
/** An update op (move/rename/retype): has both a row id and a target shape. */
|
|
293
|
-
type UpdateOp = PlannedOp & { rowId: string; after: EntryShape };
|
|
294
|
-
/** A deletion (merge) op: has a row id and the row's prior shape. */
|
|
295
|
-
type DeletionOp = PlannedOp & {
|
|
296
|
-
kind: "merge";
|
|
297
|
-
rowId: string;
|
|
298
|
-
before: EntryShape;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
/** Narrow to a create with a non-null target (well-formed by the loader/diff). */
|
|
302
|
-
function isCreate(op: PlannedOp): op is CreateOp {
|
|
303
|
-
return op.kind === "create" && op.after !== null;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/** Narrow to a row-targeted mutation (move/rename/retype) with a target shape. */
|
|
307
|
-
function isUpdate(op: PlannedOp): op is UpdateOp {
|
|
308
|
-
return (
|
|
309
|
-
op.kind !== "keep" &&
|
|
310
|
-
op.kind !== "merge" &&
|
|
311
|
-
op.kind !== "create" &&
|
|
312
|
-
op.rowId !== null &&
|
|
313
|
-
op.after !== null
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/** Narrow to a merge with the row id and prior shape needed to delete + log it. */
|
|
318
|
-
function isDeletion(op: PlannedOp): op is DeletionOp {
|
|
319
|
-
return op.kind === "merge" && op.rowId !== null && op.before !== null;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/** Display-name → option row-id maps for the `tier` and `type` lookup columns. */
|
|
323
|
-
interface LookupIdMap {
|
|
324
|
-
tier: Record<string, string>;
|
|
325
|
-
type: Record<string, string>;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Build the Coda cell payload for a target shape, keyed by column id.
|
|
330
|
-
*
|
|
331
|
-
* The `name` column is plain text (written as-is). The `tier`/`type` columns are
|
|
332
|
-
* **lookups** — they must be written by the referenced option's **row-id**, not
|
|
333
|
-
* its display string (the string 202s but silently no-ops). `resolveLookupValue`
|
|
334
|
-
* maps each display value to its option row-id.
|
|
335
|
-
*
|
|
336
|
-
* @param after - the target shape to write
|
|
337
|
-
* @param columnId - source-column name→id map (from `buildColumnIdMap`)
|
|
338
|
-
* @param lookupId - display-name→option-row-id maps for the lookup columns
|
|
339
|
-
* @returns the column-id→value cell map
|
|
340
|
-
*/
|
|
341
|
-
function toCells(
|
|
342
|
-
after: EntryShape,
|
|
343
|
-
columnId: Record<string, string>,
|
|
344
|
-
lookupId: LookupIdMap,
|
|
345
|
-
): Record<string, string> {
|
|
346
|
-
return {
|
|
347
|
-
[columnId[COLUMN.name]]: after.name,
|
|
348
|
-
[columnId[COLUMN.tier]]: resolveLookupValue("tier", after.tier, lookupId),
|
|
349
|
-
[columnId[COLUMN.type]]: resolveLookupValue("type", after.type, lookupId),
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Resolve a lookup column's display value to its Coda option row-id, throwing if
|
|
355
|
-
* unresolvable — a write with an unknown lookup value would silently no-op.
|
|
356
|
-
*
|
|
357
|
-
* @param column - "tier" or "type"
|
|
358
|
-
* @param value - the display value to resolve
|
|
359
|
-
* @param lookupId - the resolved option maps
|
|
360
|
-
* @returns the option row-id
|
|
361
|
-
* @throws if the value maps to no option
|
|
362
|
-
*/
|
|
363
|
-
function resolveLookupValue(
|
|
364
|
-
column: "tier" | "type",
|
|
365
|
-
value: string,
|
|
366
|
-
lookupId: LookupIdMap,
|
|
367
|
-
): string {
|
|
368
|
-
const id = lookupId[column][value];
|
|
369
|
-
if (!id) {
|
|
370
|
-
throw new Error(
|
|
371
|
-
`apply: cannot resolve ${column} "${value}" to a Coda option row-id (would silently no-op)`,
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
return id;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Learn display-name → option-row-id for the `tier`/`type` lookup columns from
|
|
379
|
-
* the fetched rows (each lookup cell carries `{ id, name }`), then overlay the
|
|
380
|
-
* static {@link LOOKUP_OPTION} seed for options absent from any in-scope row.
|
|
381
|
-
*
|
|
382
|
-
* @param rows - the rows already fetched from Coda (normalized)
|
|
383
|
-
* @returns the lookup id maps
|
|
384
|
-
*/
|
|
385
|
-
function buildLookupIdMap(rows: TableRow[]): LookupIdMap {
|
|
386
|
-
const tier: Record<string, string> = { ...LOOKUP_OPTION.tier };
|
|
387
|
-
const type: Record<string, string> = { ...LOOKUP_OPTION.type };
|
|
388
|
-
for (const row of rows) {
|
|
389
|
-
learnLookupCell(row[COLUMN.tier], tier);
|
|
390
|
-
learnLookupCell(row[COLUMN.type], type);
|
|
391
|
-
}
|
|
392
|
-
return { tier, type };
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/** Record a `{ id, name }` lookup cell into the display-name → row-id map. */
|
|
396
|
-
function learnLookupCell(cell: unknown, into: Record<string, string>): void {
|
|
397
|
-
if (
|
|
398
|
-
typeof cell === "object" &&
|
|
399
|
-
cell !== null &&
|
|
400
|
-
"id" in cell &&
|
|
401
|
-
"name" in cell
|
|
402
|
-
) {
|
|
403
|
-
const { id, name } = cell as { id: unknown; name: unknown };
|
|
404
|
-
if (typeof id === "string" && typeof name === "string") {
|
|
405
|
-
into[name] = id;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Pause briefly between writes to stay under Coda's API rate limit (a single
|
|
412
|
-
* unthrottled batch trips HTTP 429).
|
|
413
|
-
*
|
|
414
|
-
* @note Impure — delays via a timer.
|
|
415
|
-
*/
|
|
416
|
-
function throttle(): Promise<void> {
|
|
417
|
-
return new Promise((resolve) => setTimeout(resolve, THROTTLE_MS));
|
|
418
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, rm, stat, writeFile } from "node:fs/promises";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import type { Config } from "../config/types.js";
|
|
6
|
-
import { ALLOW_SHRINK_ENV_VAR } from "../transform/deltaGuards.js";
|
|
7
|
-
import transform from "./transform.js";
|
|
8
|
-
|
|
9
|
-
const DS = "https://ds.canonical.com/";
|
|
10
|
-
|
|
11
|
-
describe("transform command", () => {
|
|
12
|
-
it("should throw if transform config is missing", async () => {
|
|
13
|
-
await expect(
|
|
14
|
-
transform({ document: "doc", provider: "coda" }),
|
|
15
|
-
).rejects.toThrow("Transform config section is required");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("should throw if extract output path is missing", async () => {
|
|
19
|
-
await expect(
|
|
20
|
-
transform({
|
|
21
|
-
document: "doc",
|
|
22
|
-
provider: "coda",
|
|
23
|
-
transform: {
|
|
24
|
-
format: "json-ld",
|
|
25
|
-
outputDir: "instances/",
|
|
26
|
-
atomicity: "instance",
|
|
27
|
-
tables: {},
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
).rejects.toThrow("Extract output path is required for transform");
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe("fail-closed pull sync guards", () => {
|
|
34
|
-
let base: string;
|
|
35
|
-
|
|
36
|
-
beforeEach(async () => {
|
|
37
|
-
base = await mkdtemp(join(tmpdir(), "transform-cmd-test-"));
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
afterEach(async () => {
|
|
41
|
-
vi.unstubAllEnvs();
|
|
42
|
-
vi.restoreAllMocks();
|
|
43
|
-
await rm(base, { recursive: true, force: true });
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
function makeConfig(): Config {
|
|
47
|
-
return {
|
|
48
|
-
document: "doc",
|
|
49
|
-
provider: "coda",
|
|
50
|
-
extract: { output: join(base, "extract.json"), tables: {} },
|
|
51
|
-
transform: {
|
|
52
|
-
format: "ttl",
|
|
53
|
-
outputDir: join(base, "data"),
|
|
54
|
-
atomicity: "instance",
|
|
55
|
-
tables: {
|
|
56
|
-
uiBlocks: {
|
|
57
|
-
"@context": {
|
|
58
|
-
ds: DS,
|
|
59
|
-
name: "ds:name",
|
|
60
|
-
tier: { "@id": "ds:tier", "@type": "@id" },
|
|
61
|
-
},
|
|
62
|
-
class: "{type}",
|
|
63
|
-
uriTemplate: "{uri}",
|
|
64
|
-
},
|
|
65
|
-
tiers: {
|
|
66
|
-
"@context": { ds: DS, name: "ds:name" },
|
|
67
|
-
class: "ds:Tier",
|
|
68
|
-
uriTemplate: "{uri}",
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
references: {
|
|
72
|
-
tiers: { uriTemplate: "{uri}", keyColumn: "name" },
|
|
73
|
-
uiBlockTypes: { uriTemplate: `${DS}{Name}`, keyColumn: "Name" },
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** A uiBlocks row producing subject ds:global.component.block<n> (3 triples). */
|
|
80
|
-
function blockRow(n: number, overrides: Record<string, unknown> = {}) {
|
|
81
|
-
return {
|
|
82
|
-
_codaId: `i-${n}`,
|
|
83
|
-
name: `Block${n}`,
|
|
84
|
-
tier: "Global",
|
|
85
|
-
type: "Component",
|
|
86
|
-
uri: `${DS}global.component.block${n}`,
|
|
87
|
-
...overrides,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** A tiers row producing subject ds:<name> (2 triples). */
|
|
92
|
-
function tierRow(name: string) {
|
|
93
|
-
return { _codaId: `i-tier-${name}`, name, uri: `${DS}${name}` };
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function blocks(count: number) {
|
|
97
|
-
return Array.from({ length: count }, (_, i) => blockRow(i + 1));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** Extract fixture with all configured tables present. */
|
|
101
|
-
function fullTables(
|
|
102
|
-
uiBlocks: Record<string, unknown>[],
|
|
103
|
-
tiers: Record<string, unknown>[] = [tierRow("global")],
|
|
104
|
-
) {
|
|
105
|
-
return {
|
|
106
|
-
uiBlocks,
|
|
107
|
-
tiers,
|
|
108
|
-
uiBlockTypes: [{ _codaId: "i-type-1", Name: "Component" }],
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
async function runTransform(tables: Record<string, unknown[]>) {
|
|
113
|
-
await writeFile(
|
|
114
|
-
join(base, "extract.json"),
|
|
115
|
-
JSON.stringify({ document: "doc", extractedAt: "2026-01-01", tables }),
|
|
116
|
-
);
|
|
117
|
-
await transform(makeConfig());
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function exists(path: string): Promise<boolean> {
|
|
121
|
-
return stat(path).then(
|
|
122
|
-
() => true,
|
|
123
|
-
() => false,
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const blockPath = (n: number) =>
|
|
128
|
-
join(base, "data", "global", "component", `block${n}.ttl`);
|
|
129
|
-
|
|
130
|
-
it("hard-fails when a configured table is missing from the extract", async () => {
|
|
131
|
-
await expect(
|
|
132
|
-
runTransform({
|
|
133
|
-
uiBlocks: blocks(2),
|
|
134
|
-
uiBlockTypes: [{ _codaId: "i-type-1", Name: "Component" }],
|
|
135
|
-
}),
|
|
136
|
-
).rejects.toThrow("missing expected table(s): tiers");
|
|
137
|
-
|
|
138
|
-
// Nothing was written.
|
|
139
|
-
expect(await exists(join(base, "data"))).toBe(false);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it("hard-fails when a non-empty table yields zero subjects", async () => {
|
|
143
|
-
// Rows without a resolvable `uri` produce no subjects at all.
|
|
144
|
-
const broken = [{ _codaId: "i-1", name: "Block1", type: "Component" }];
|
|
145
|
-
|
|
146
|
-
await expect(runTransform(fullTables(broken))).rejects.toThrow(
|
|
147
|
-
"produced rows but zero subjects",
|
|
148
|
-
);
|
|
149
|
-
expect(await exists(join(base, "data"))).toBe(false);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it("refuses a large shrink and leaves the committed dataset intact", async () => {
|
|
153
|
-
await runTransform(fullTables(blocks(10)));
|
|
154
|
-
expect(await exists(blockPath(5))).toBe(true);
|
|
155
|
-
|
|
156
|
-
// Simulated broken extract: most blocks vanished.
|
|
157
|
-
await expect(runTransform(fullTables(blocks(2)))).rejects.toThrow(
|
|
158
|
-
"Refusing to overwrite committed data",
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
// The committed dataset was never destroyed.
|
|
162
|
-
expect(await exists(blockPath(5))).toBe(true);
|
|
163
|
-
expect(await exists(blockPath(10))).toBe(true);
|
|
164
|
-
expect(await exists(join(base, "data", "global.ttl"))).toBe(true);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it("fails when authored content shrinks even though subjects survive", async () => {
|
|
168
|
-
await runTransform(fullTables(blocks(10)));
|
|
169
|
-
|
|
170
|
-
// Same subjects, but two blocks lost their authored `name` content.
|
|
171
|
-
const stripped = blocks(10).map((row, i) =>
|
|
172
|
-
i < 2 ? blockRow(i + 1, { name: undefined }) : row,
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
await expect(runTransform(fullTables(stripped))).rejects.toThrow(
|
|
176
|
-
/property usage/,
|
|
177
|
-
);
|
|
178
|
-
expect(await exists(blockPath(1))).toBe(true);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it("fails when a tier file would disappear", async () => {
|
|
182
|
-
const twoTiers = [tierRow("global"), tierRow("apps")];
|
|
183
|
-
await runTransform(fullTables(blocks(10), twoTiers));
|
|
184
|
-
|
|
185
|
-
await expect(
|
|
186
|
-
runTransform(fullTables(blocks(10), [tierRow("global")])),
|
|
187
|
-
).rejects.toThrow(/tier file count/);
|
|
188
|
-
expect(await exists(join(base, "data", "apps.ttl"))).toBe(true);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it("lets an intentional shrink through with the escape hatch", async () => {
|
|
192
|
-
await runTransform(fullTables(blocks(10)));
|
|
193
|
-
|
|
194
|
-
vi.stubEnv(ALLOW_SHRINK_ENV_VAR, "1");
|
|
195
|
-
vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
196
|
-
await runTransform(fullTables(blocks(2)));
|
|
197
|
-
|
|
198
|
-
expect(await exists(blockPath(1))).toBe(true);
|
|
199
|
-
// Stale files from the previous, larger dataset were swept.
|
|
200
|
-
expect(await exists(blockPath(5))).toBe(false);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it("replaces the dataset and sweeps stale files on a healthy run", async () => {
|
|
204
|
-
await runTransform(fullTables([blockRow(1), blockRow(2)]));
|
|
205
|
-
|
|
206
|
-
await runTransform(fullTables([blockRow(1), blockRow(3), blockRow(4)]));
|
|
207
|
-
|
|
208
|
-
expect(await exists(blockPath(2))).toBe(false);
|
|
209
|
-
expect(await exists(blockPath(3))).toBe(true);
|
|
210
|
-
expect(await exists(blockPath(4))).toBe(true);
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
});
|