Releases: datocms/structured-text
Releases · datocms/structured-text
datocms-structured-text-utils@5.1.3
Added
- Tree Visualization with Inspector: Added powerful tree visualization utility that renders structured text documents as ASCII trees for debugging and development:
inspectfunction renders documents or nodes as ASCII trees with clear hierarchical structure- Support for custom block formatting to display rich information about embedded content
- Configurable output with options for block and inline block formatters
- Perfect for debugging document structure during development
- Visual representation shows node types, attributes, marks, and content in an easy-to-read format
datocms-structured-text-utils@5.1.0
Added
- New Tree Manipulation Utilities: Added comprehensive tree manipulation utilities with support for:
forEachNodeandforEachNodeAsync- Visit all nodes in the structured text treemapNodesandmapNodesAsync- Transform nodes while preserving tree structurecollectNodesandcollectNodesAsync- Collect all nodes matching a predicatefindFirstNodeandfindFirstNodeAsync- Find the first node matching a predicatefilterNodesandfilterNodesAsync- Remove nodes that don't match a predicatereduceNodesandreduceNodesAsync- Reduce tree to single valuesomeNodeandsomeNodeAsync- Check if any node matches predicateeveryNodeandeveryNodeAsync- Check if all nodes match predicate- All functions support both synchronous and asynchronous operation
- Full TypeScript support with proper type narrowing for type guards
- Comprehensive test coverage in
packages/utils/__tests__/manipulation.test.ts
Changed
-
Type System Improvements: Enhanced type definitions:
- Added generic
BlockItemTypeparameter to node types (defaults toBlockId = string) - All node type guards now support generic block item types
- Added
isCdaStructuredTextValuefunction as replacement forisStructuredText
- Added generic
-
API Deprecations and Migrations:
StructuredTexttype is now deprecated in favor ofCdaStructuredTextValueisStructuredTextfunction is now deprecated in favor ofisCdaStructuredTextValueTypesafeStructuredTexttype is now deprecated in favor ofTypesafeCdaStructuredTextValue