-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add file support #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remove standalone example implementation as the library now supports both Fastify and Express natively through the main package.
Add comprehensive support for File entities (http://schema.org/MediaObject) throughout the API infrastructure. Files entities can exist as children of Objects or Collections and are fully integrated into all existing routes. Changes: - Update seed script to import File entities from RO-Crate hasPart references - Add File test entities to integration test setup (5 entities total now) - Add integration tests for File filtering, retrieval, and search - Update test expectations to account for additional File entities - Document File entity type, hierarchy, and filtering in CLAUDE.md All existing functionality remains unchanged. Files use the same StandardEntity/AuthorisedEntity shapes as other entity types and work seamlessly with the transformer pipeline.
af01748 to
5fe64e8
Compare
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Add comprehensive file handling system with separate File table, transformer pipeline, and pluggable storage backends. Includes RO-Crate metadata serving for all entity types. Features: - File table with migrations for dedicated file metadata storage - File transformers for access control and data enrichment - File handler system supporting streaming, redirects, and ranges - RO-Crate handler for serving entity metadata as JSON-LD - New endpoints: /files, /file/:id, /entity/:id/rocrate - AllPublicFileAccessTransformer for public datasets - Extensive documentation and test coverage Breaking changes: - Requires fileHandler and roCrateHandler in app configuration - Requires fileAccessTransformer for file access control
- Add src/index.dev.ts development server with local file streaming - Configure docker-compose for Oni UI on port 3000 - Update Oni UI config for PCDM entity types (Collection, Object, File) - Simplify dev npm script to use --env-file flag - Update knip ignore paths for new dev server - Exclude dev server from test coverage The development server provides a complete example of file handling with local filesystem storage, supporting both RO-Crate and file content streaming.
Add unit tests for baseEntityTransformer and AllPublicAccessTransformer covering entity transformation, field mapping, null handling, and access control.
There was a problem hiding this comment.
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 adds comprehensive file support to the AROCAPI system, implementing a complete file handling architecture with access control, transformers, and download endpoints.
Key Changes:
- Added File table and entity type support for MediaObject files
- Implemented file access transformers parallel to entity transformers
- Added file download endpoints with multiple serving strategies (stream, redirect, filesystem)
- Added RO-Crate metadata serving endpoints
Reviewed Changes
Copilot reviewed 57 out of 63 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| prisma/models/file.prisma | New File model with metadata fields (fileId, filename, mediaType, size, licenses) |
| prisma/models/entity.prisma | Added fileId and meta fields to Entity model |
| src/types/fileHandlers.ts | New type definitions for file and RO-Crate handlers |
| src/types/transformers.ts | Added FileAccessTransformer and FileTransformer types |
| src/transformers/default.ts | Implemented baseFileTransformer and AllPublicFileAccessTransformer |
| src/routes/files.ts | New /files endpoint for listing files with pagination |
| src/routes/file.ts | New /file/:id endpoint for downloading file content |
| src/routes/crate.ts | New /entity/:id/rocrate endpoint for serving RO-Crate metadata |
| src/app.ts | Integrated file handlers and transformers into main application |
| src/utils/errors.ts | Added INVALID_ENTITY_TYPE error code |
| vitest.config.ts | Updated coverage exclusions for dev files |
| package.json | Updated scripts to use pnpm and added seed script |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
example/data/collection-01-nyeleni/item-01-greeting/ro-crate-metadata.json
Outdated
Show resolved
Hide resolved
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.