PreviewURL use cases and extension on dataset and file use cases - #473
Open
ChengShi-1 wants to merge 4 commits into
Open
PreviewURL use cases and extension on dataset and file use cases#473ChengShi-1 wants to merge 4 commits into
ChengShi-1 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the datasets and files read APIs to support Dataverse “Preview URL” access via an optional previewUrlToken (mapped to the Dataverse key query param), and adds a full Preview URL lifecycle (create/get/delete) to the datasets API surface.
Changes:
- Add optional
previewUrlTokensupport to dataset/file read use cases and repository methods, including mapping tokeyquery param and adjusting auth requirements. - Add Preview URL lifecycle support (
createPreviewUrl,getPreviewUrl,deletePreviewUrl) including a newPreviewUrlmodel and response transformer. - Update unit/integration tests, docs, changelog, and test TypeScript config to cover new behavior.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.tests.json | Adds Jest/Node types for test compilation. |
| package.json | Bumps @types/jest version. |
| package-lock.json | Locks updated @types/jest version metadata. |
| src/files/domain/repositories/IFilesRepository.ts | Extends repository read methods with optional previewUrlToken. |
| src/files/infra/repositories/FilesRepository.ts | Maps previewUrlToken to key query param and adjusts auth behavior for preview access. |
| src/files/domain/useCases/GetFile.ts | Adds optional previewUrlToken passthrough to repository. |
| src/files/domain/useCases/GetFileAndDataset.ts | Adds optional previewUrlToken passthrough to repository. |
| src/files/domain/useCases/GetDatasetFiles.ts | Adds optional previewUrlToken passthrough to repository. |
| src/files/domain/useCases/GetDatasetFileCounts.ts | Adds optional previewUrlToken passthrough to repository. |
| src/files/domain/useCases/GetDatasetFilesTotalDownloadSize.ts | Adds optional previewUrlToken passthrough to repository. |
| src/datasets/domain/models/PreviewUrl.ts | Introduces PreviewUrl response model. |
| src/datasets/domain/repositories/IDatasetsRepository.ts | Adds preview URL lifecycle methods and extends getDataset with previewUrlToken. |
| src/datasets/infra/repositories/transformers/datasetTransformers.ts | Adds transformer for Preview URL API responses. |
| src/datasets/infra/repositories/DatasetsRepository.ts | Implements preview URL lifecycle methods and supports previewUrlToken on getDataset. |
| src/datasets/domain/useCases/previewUrl/CreatePreviewUrl.ts | Adds create-preview-url use case wrapper. |
| src/datasets/domain/useCases/previewUrl/GetPreviewUrl.ts | Adds get-preview-url use case wrapper. |
| src/datasets/domain/useCases/previewUrl/DeletePreviewUrl.ts | Adds delete-preview-url use case wrapper. |
| src/datasets/domain/useCases/GetDataset.ts | Adds optional previewUrlToken passthrough to repository. |
| src/datasets/index.ts | Exposes Preview URL use cases and model from the datasets package entrypoint. |
| docs/useCases.md | Documents Preview URL lifecycle and previewUrlToken usage across affected use cases. |
| CHANGELOG.md | Records Preview URL token support and new Preview URL use cases. |
| test/unit/files/GetFile.test.ts | Updates invocation to include new optional param and adds forwarding test. |
| test/unit/files/GetFileAndDataset.test.ts | Updates invocation to include new optional param and adds forwarding test. |
| test/unit/files/GetDatasetFiles.test.ts | Adds forwarding test for previewUrlToken. |
| test/unit/files/GetDatasetFileCounts.test.ts | Adds forwarding test for previewUrlToken. |
| test/unit/files/GetDatasetFilesTotalDownloadSize.test.ts | Updates invocation signature and adds forwarding test for previewUrlToken. |
| test/unit/files/FilesRepository.test.ts | Verifies previewUrlToken is sent as key for relevant file/dataset endpoints. |
| test/unit/datasets/GetDataset.test.ts | Adds forwarding test for previewUrlToken on getDataset. |
| test/unit/datasets/DatasetsRepository.test.ts | Verifies previewUrlToken is sent as key on dataset version fetch; adds Preview URL lifecycle tests. |
| test/unit/datasets/CreatePreviewUrl.test.ts | Adds unit tests for create-preview-url use case. |
| test/unit/datasets/GetPreviewUrl.test.ts | Adds unit tests for get-preview-url use case. |
| test/unit/datasets/DeletePreviewUrl.test.ts | Adds unit tests for delete-preview-url use case. |
| test/integration/files/FilesRepository.test.ts | Adds integration coverage for unauthenticated access via preview URL token. |
| test/integration/datasets/DatasetsRepository.test.ts | Adds integration coverage for Preview URL lifecycle and preview-token access patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What this PR does / why we need it:
previewUrlToken) support togetDataset,getDatasetFiles,getDatasetFileCounts,getDatasetFilesTotalDownloadSize,getFile, andgetFileAndDatasetcreatePreviewUrl,getPreviewUrl, anddeletePreviewUrluse casesWhich issue(s) this PR closes:
Related Dataverse PRs:
Special notes for your reviewer:
toApiQueryParamsis needed because the internal query object usespreviewUrlToken, but the actual Dataverse API expects that token as query paramkey. Thus, I mappedkeytopreviewUrlTokenfor better clarification.Suggestions on how to test this:
Is there a release notes or changelog update needed for this change?:
Changlog updated
Additional documentation: