Add followBlueprintOrder option to export-workbook plugin#867
Closed
devin-ai-integration[bot] wants to merge 5 commits intomainfrom
Closed
Add followBlueprintOrder option to export-workbook plugin#867devin-ai-integration[bot] wants to merge 5 commits intomainfrom
devin-ai-integration[bot] wants to merge 5 commits intomainfrom
Conversation
- Add followBlueprintOrder option to PluginOptions interface - When enabled, export columns in sheet.config.fields order instead of API values order - Handle duplicate transformed labels by disambiguating with field keys - Support includeRecordIds option with blueprint ordering - Append non-blueprint fields at the end of the export - Pass explicit header array to json_to_sheet for deterministic ordering This resolves the issue where exported column order differs from the review screen order, which follows sheet.config.fields. The option defaults to false to maintain backward compatibility. Co-Authored-By: christopher.harrison@flatfile.io <cnharrison@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
📝 Documentation updates detected! New suggestion: Add changelog entry for export-workbook followBlueprintOrder option |
When followBlueprintOrder is enabled, additional fields (not in blueprint) are now properly collected and appended to the header array so they appear in the export. Changes: - Track labelCounts, extrasKeyToUniqueLabel, and extrasHeaderOrder - During record processing, collect additional field keys and transform them - Disambiguate duplicate labels using the same labelCounts as blueprint fields - Append extrasHeaderOrder to orderedHeaders before passing to json_to_sheet This ensures additional fields appear at the end of the export instead of being silently dropped. Co-Authored-By: christopher.harrison@flatfile.io <cnharrison@gmail.com>
…ypes, and determinism - Add transformer memoization to avoid redundant async calls for same keys - Convert excludeFields to Set for O(1) lookups instead of array.includes() - Preserve number types in cells (t: 'n' for numbers, t: 's' for strings) - Sort extrasHeaderOrder before appending to ensure deterministic header order - Update all columnNameTransformer calls to use memoizedTransform - Update all excludeFields checks to use excludeFieldsSet Note: SheetJS comment handling unchanged - our xlsx 0.20.2 types confirm T?: boolean (thread flag) and hidden on Comments array are both valid. Co-Authored-By: christopher.harrison@flatfile.io <cnharrison@gmail.com>
1. Filter emptyRowEntries with excludeFieldsSet to prevent header/row misalignment 2. Handle includeRecordIds for zero-row exports (add recordId to empty row and header) 3. Hoist blueprintKeys set outside record loop to avoid rebuilding per record 4. Sort extras by key (not label) for stability across transformer changes 5. Add comment shape test to guard against xlsx upgrades (T flag and hidden on array) 6. Update JSDoc to document recordId placement behavior (first column in blueprint mode, unspecified in non-blueprint mode) All fixes verified with lint and unit tests (8/8 passing including new comment test). Co-Authored-By: christopher.harrison@flatfile.io <cnharrison@gmail.com>
Remove automatic number type detection (t: 'n' for numbers) to avoid breaking existing exports. All values now remain as strings (t: 's') by default. This makes the PR fully backward compatible - only the opt-in followBlueprintOrder option changes behavior. Existing exports continue to work exactly as before. The number typing feature can be added later as a separate opt-in option if needed. Co-Authored-By: christopher.harrison@flatfile.io <cnharrison@gmail.com>
Contributor
Author
|
Closing due to inactivity for more than 7 days. Configure here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
followBlueprintOrderoption to fix column order mismatch between review screen and exports. When enabled, exports columns insheet.config.fieldsorder (matching UI) instead of API values object order.Also includes correctness fixes and performance optimizations identified during code review:
excludeFieldsto Set for O(1) lookupsLink to Devin run: https://app.devin.ai/sessions/2c390f0d20a740a196f83e9bd8187531
Requested by: christopher.harrison@flatfile.io (@cnharrison)
Please explain how to summarize this PR for the Changelog:
Added
followBlueprintOrderoption to export columns in blueprint order (matching review screen) instead of API values order. When enabled, handles duplicate labels, additional fields, and exports all blueprint fields in correct order. Includes performance optimizations (transformer memoization, Set-based field filtering) and fixes empty row handling to respect excludeFields and includeRecordIds.Tell code reviewer how and what to test:
Key items to review and test:
1. Backward compatibility (MOST IMPORTANT)
followBlueprintOrderare completely unchanged2. Duplicate label handling
3. Additional fields ordering
4. Empty row handling
excludeFieldsset - verify excluded fields don't appearincludeRecordIds: true- verify recordId column appears5. Customer scenario (78-field blueprint)
6. Performance
How to enable:
What changed and why:
Known limitations: