Skip to content

refactor: move XLSForm row types out of config/, resolve config in one step - #68

Merged
jstet merged 1 commit into
mainfrom
refactor/64-types-config
Sep 25, 2026
Merged

jstet merged 1 commit into
mainfrom
refactor/64-types-config

Conversation

@jstet

@jstet jstet commented Sep 25, 2026

Copy link
Copy Markdown
Member

Closes #64.

  • Row types:
    • SurveyRow, ChoiceRow, SettingsRow and XLSFormData move to src/xlsform/types.ts, and all 20 internal importers use it.
    • config/types.ts re-exports them.
    • They're now exported from the package root too.
  • resolveConfig(partial): Readonly<LstsvConfig> merges, validates and freezes in one step.
  • ConversionConfig → LstsvConfig, with a deprecated alias.
  • Removed: the hardcoded autoCreateGroups (a default group is still always added when there is none). handleRepeats and debugLogging were never read; they're marked deprecated no-ops.

Not changed, on purpose:

  • xlsform2ddi/variables.ts still reads Record<string, unknown> rows. buildDdiXml takes JSON from any source, and narrowing its public parameter type to SurveyRow[] would break TypeScript callers.
  • The 2-letter language check: the issue asked whether it conflicts with 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 resolveConfig tests). npm run validate is clean.

🤖 Generated with Claude Code

…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>
@jstet
jstet merged commit d181864 into main Sep 25, 2026
4 checks passed
@jstet
jstet deleted the refactor/64-types-config branch September 25, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: move XLSForm row types out of config/, simplify ConfigManager

1 participant