refactor: move XLSForm row types out of config/, resolve config in one step - #68
Merged
Merged
Conversation
…e step - SurveyRow, ChoiceRow, SettingsRow and XLSFormData live in src/xlsform/types.ts; every internal import points there. config/types.ts re-exports them for compatibility, and the package root now exports them. - resolveConfig(partial): Readonly<LstsvConfig> merges over the defaults, validates and freezes in one step. ConfigManager is a deprecated thin wrapper over it, keeping the old updateConfig semantics (options merged over the defaults). - ConversionConfig is renamed LstsvConfig, since it only applies to xlsform2lstsv; ConversionConfig stays as a deprecated alias. - The hardcoded autoCreateGroups option is gone: a default group is always added when the form has none, as before. handleRepeats and debugLogging were never read; they're marked deprecated no-ops. Not changed: - xlsform2ddi/variables.ts still takes Record<string, unknown> rows. buildDdiXml/extractVariables accept JSON from any source (qwacback), and narrowing their public parameter type to SurveyRow[] would break TS callers. - The 2-letter language check: it matches the whole pipeline (isValidLanguageCode) but conflicts with convention:languageTagging (BCP 47); filed as #67. Closes #64 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Closes #64.
SurveyRow,ChoiceRow,SettingsRowandXLSFormDatamove tosrc/xlsform/types.ts, and all 20 internal importers use it.config/types.tsre-exports them.resolveConfig(partial): Readonly<LstsvConfig>merges, validates and freezes in one step.ConfigManagerbecomes a deprecated wrapper over it, andupdateConfigkeeps its old semantics.ConfigManager. refactor(xlsform2lstsv): make XLSFormToTSVConverter stateless per conversion #62 replaces that with a per-conversion context.ConversionConfig→LstsvConfig, with a deprecated alias.autoCreateGroups(a default group is still always added when there is none).handleRepeatsanddebugLoggingwere never read; they're marked deprecated no-ops.Not changed, on purpose:
xlsform2ddi/variables.tsstill readsRecord<string, unknown>rows.buildDdiXmltakes JSON from any source, and narrowing its public parameter type toSurveyRow[]would break TypeScript callers.convention:languageTagging. It does: the convention says BCP 47 (fr-BE). But the whole pipeline (isValidLanguageCode) drops non-2-letter columns, so this is filed as Language tags: xlsform2lstsv accepts 2-letter codes only, convention:languageTagging allows BCP 47 #67, not changed here.Tests: no behaviour change; all snapshots unchanged. vitest: 874 passed (3 new
resolveConfigtests).npm run validateis clean.🤖 Generated with Claude Code