Feat add endpoint to validate and preview import files before ingestion#186
Merged
Baskarayelu merged 6 commits intoCredenceOrg:mainfrom Mar 29, 2026
Conversation
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
|
@BrayanMQ Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Please resolve the conflicts |
…o-validate-and-preview-import-files-before-ingestion
Contributor
Author
|
@Baskarayelu done! |
Contributor
|
Please revert the changes made to the package-lock.json file. |
…port-files-before-ingestion
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.
feat(imports): pre-ingestion validation and preview endpoint
Closes #152
Summary
Adds
POST /api/imports/previewfor enterprise API keys. Clients upload a CSV (multipart fieldfile) with a requiredaddresscolumn (case-insensitive header). The handler parses and validates each row’s Stellar address format, returns aggregate counts, bounded preview samples, and row-level errors with line numbers. No data is persisted.Requirements (issue)
address; response includessummary,preview,rowErrorsrowErrors[]withline, optionalcolumn,code,messageimportPreviewServicevalidRows,invalidRows,totalRowsScanned, truncation flags when applicableHow to test
Automated
Manual (with
npm run dev)Sample CSV:
address GABC7IXPV3YWQXKQZQXQZQXQZQXQZQXQZQXQZQXQZQXQZQXQZQXQZQXQFiles changed (this PR)
package.json,package-lock.json—multer,csv-parse,@types/multersrc/lib/stellarAddress.ts— sharedisValidStellarAddresssrc/services/identityService.ts— uses shared validatorsrc/services/importPreviewService.ts— parse, validate, limits, response shapesrc/routes/imports.ts—POST /preview, enterprise auth, multipart uploadsrc/app.ts— mount/api/importssrc/__tests__/imports.test.ts— malformed CSV, schema, partial errors, auth, 413, UTF-8