refactor: reorganize model/types and search/catalog structure (refs #47)#61
Open
mborne wants to merge 30 commits into
Open
refactor: reorganize model/types and search/catalog structure (refs #47)#61mborne wants to merge 30 commits into
mborne wants to merge 30 commits into
Conversation
Contributor
There was a problem hiding this comment.
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 updatedCollectionSearchEngineAPI that accepts options (e.g., limit). - Splits the former
src/types.tsinto 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.yamleven though the data now comes fromsearch-use-case.yaml, which can confuse readers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…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>
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
This PR refactors the internal model organization and type definitions to reduce duplication and clarify boundaries.
Main changes
Motivation
Break changes
CollectionCatalogis intented to be "implementable" by using the futur OGC API Feature of the GeoplateformegetCollections()is removedNotes