Skip to content

refactor: reorganize model/types and search/catalog structure (refs #47)#61

Open
mborne wants to merge 30 commits into
mainfrom
47-refactor-model
Open

refactor: reorganize model/types and search/catalog structure (refs #47)#61
mborne wants to merge 30 commits into
mainfrom
47-refactor-model

Conversation

@mborne

@mborne mborne commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR refactors the internal model organization and type definitions to reduce duplication and clarify boundaries.

Main changes

  • Split and reorganize types by domain (catalog, search, source, overwrite, pivot, config, errors, ogc-api-feature)
  • Rename ambiguous/public schema names with explicit Ogc* prefixes
  • Separate search concerns from catalog concerns and simplify search engine configuration
  • Replace legacy CollectionSearchResult usage with CollectionSearchMatch
  • Add OgcCollectionBrief for list-level collection information
  • Apply search limit directly in SearchEngine
  • Adjust CLI and writer modules to align with new structure
  • Update and consolidate tests (including search functional coverage)
  • Improve docs (README, CODING.md, and dedicated docs files)

Motivation

  • Improve maintainability and readability of the codebase
  • Make module responsibilities clearer
  • Reduce type duplication and tighten naming consistency

Break changes

  • Full public API is reviewed to ensure further stability
  • The new CollectionCatalog is intented to be "implementable" by using the futur OGC API Feature of the Geoplateforme
  • getCollections() is removed

Notes

  • Follow-up work can further align external API naming if needed.

mborne and others added 19 commits June 22, 2026 23:09
Comment thread test/unit/catalog/in-memory.test.ts Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the project’s TypeScript model/type organization and restructures the catalog/search modules to better separate concerns (config/source/overwrite/pivot/search/catalog/OGC API Feature), while updating tests and documentation accordingly.

Changes:

  • Introduces @/… import aliasing (Vite + TS paths) and migrates internal imports/tests to use it.
  • Replaces the legacy search/catalog structure with new src/catalog/* and updated CollectionSearchEngine API that accepts options (e.g., limit).
  • Splits the former src/types.ts into domain-specific type modules and updates docs/tests to match the new structure.

Reviewed changes

Copilot reviewed 60 out of 61 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
vite.config.ts Adds @ alias resolution for Vite/Vitest/build.
tsconfig.json Adds TS paths mapping for @/* imports.
test/unit/types.test.ts Updates import to new config types module via alias.
test/unit/source/wfs/describeFeatureType.test.ts Updates import to @/source/... alias.
test/unit/source/wfs.test.ts Updates mocks/imports to new module paths (incl. errors/types).
test/unit/source/storage.test.ts Updates overwrite/enrichment imports to new module structure.
test/unit/source/storage.flush.test.ts Updates dynamic imports/types to @/source/... alias.
test/unit/search/testdata/functional-search-cases.yaml Removes old unit test dataset file (functional cases moved).
test/unit/search/search-document.test.ts Updates import to @/search/... alias.
test/unit/search/minisearch-engine.test.ts Updates imports to new pivot/search modules.
test/unit/search/functional.test.ts Removes legacy functional unit test (superseded by integration coverage).
test/unit/search/catalog.test.ts Removes legacy catalog unit tests (catalog moved to src/catalog).
test/unit/search/catalog-factory.test.ts Removes legacy catalog factory tests (API reworked).
test/unit/pivot/mapping.test.ts Updates pivot type imports to @/pivot/types.
test/unit/ogc-api-feature/writer.test.ts Updates writer/schema test imports to new OGC writer module.
test/unit/index.test.ts Updates public API test to new getCollectionCatalog options behavior.
test/unit/helpers/retry.test.ts Updates helper import path to alias.
test/unit/helpers/overwrite.test.ts Updates overwrite/source imports to new modules.
test/unit/helpers/namespace-filters.test.ts Updates namespace-filters helper import path to alias.
test/unit/helpers/metadata.test.ts Updates metadata helper import path to alias.
test/unit/helpers/merge.test.ts Updates enrichment merge imports to new source/overwrite modules.
test/unit/helpers/configure-fetch.test.ts Updates dynamic import path to alias.
test/unit/helpers/compare.test.ts Updates compare helper imports to new source/overwrite modules.
test/unit/cli/render-catalog.test.ts Updates CLI render-catalog import to alias.
test/unit/catalog/in-memory.test.ts Adds new tests for the new src/catalog/in-memory implementation.
test/integration/search/use-case.yaml Removes old integration search use-case file (renamed/replaced).
test/integration/search/search.integration.test.ts Updates integration search test to new file name + catalog.search() API.
test/integration/search/search-use-case.yaml Adds new integration search cases file (renamed + expanded).
src/types.ts Removes monolithic types module (split by domain).
src/source/wfs/mapping.ts Updates UnexpectedTypeError import to new src/errors/types.
src/source/wfs.ts Moves source types import to src/source/types.
src/source/types.ts Adds dedicated source model Zod schemas/types.
src/source/source-store.ts Updates source types import + data-dir location.
src/search/types.ts Updates search engine interface to accept options + removes legacy result type.
src/search/search-document.ts Updates enriched model imports to pivot module.
src/search/minisearch-engine.ts Updates to accept search options (incl. limit) and new imports.
src/search/catalog.ts Removes legacy catalog implementation (replaced by src/catalog/*).
src/pivot/types.ts Adds pivot “enriched model” types, now depending on source types.
src/overwrite/types.ts Adds dedicated overwrite Zod schemas/types module.
src/overwrite/overwrite.ts Updates overwrite imports to new overwrite/source modules.
src/overwrite/overwrite-store.ts Updates overwrite type import + data-dir module path.
src/ogc-api-feature/writer.ts Updates schema writer to new OGC-prefixed types and pivot model imports.
src/ogc-api-feature/types.ts Adds OGC API Features schema/brief Zod schemas + types.
src/index.ts Updates public API exports and catalog construction options (miniSearch vs custom engine).
src/helpers/namespace-filters.ts Updates imports to new config types module.
src/helpers/metadata.ts Updates imports to new config types module.
src/helpers/compare.ts Updates imports to new overwrite/source modules.
src/errors/types.ts Adds dedicated error types module (UnexpectedTypeError).
src/enrichment/merge.ts Updates imports to new pivot/overwrite/source modules.
src/enrichment/load-enriched-collections.ts Updates enriched model import to pivot module.
src/config/types.ts Adds config-level Zod schemas/types (package metadata + namespace filters).
src/config/namespace-filters.ts Updates NamespaceFilterRule import to config types.
src/config/data-dir.ts Updates internal comment to reflect new config path.
src/cli/render-catalog.ts Switches rendering to OGC API Feature writer + pivot types.
src/cli.ts Updates config imports + type imports to new modules.
src/catalog/types.ts Adds new public catalog interface (list/getById/search).
src/catalog/in-memory.ts Adds new in-memory catalog implementation returning briefs + delegating search.
README.md Updates usage documentation to new catalog API and structure.
docs/pivot-model.md Adds pivot model documentation.
docs/overwrite-format.md Adds overwrite format documentation.
CODING.md Adds contributor/maintenance documentation and commands.
Comments suppressed due to low confidence (1)

test/integration/search/search.integration.test.ts:59

  • Block comment mentions use-case.yaml even though the data now comes from search-use-case.yaml, which can confuse readers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/unit/catalog/in-memory.test.ts Outdated
Comment thread test/unit/catalog/in-memory.test.ts Outdated
Comment thread src/catalog/types.ts Outdated
Comment thread src/index.ts
Comment thread README.md
Comment thread test/integration/search/search.integration.test.ts
Comment thread test/integration/search/search-use-case.yaml
Comment thread test/integration/search/use-case.yaml Outdated
Comment thread CODING.md
Comment thread test/unit/index.test.ts Outdated
mborne and others added 7 commits June 26, 2026 13:35
…tion or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 59 out of 60 changed files in this pull request and generated 5 comments.

Comment thread test/unit/index.test.ts Outdated
Comment thread src/index.ts
Comment thread CODING.md Outdated
Comment thread CODING.md Outdated
Comment thread test/integration/search/use-case.yaml Outdated
@mborne mborne requested a review from esgn June 27, 2026 10:37
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.

3 participants