-
Notifications
You must be signed in to change notification settings - Fork 180
feat: use SelfClient for MRZ parsing #930
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
Merged
transphorm
merged 13 commits into
dev
from
codex/create-shared-client-instance-and-update-imports
Aug 20, 2025
Merged
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5a2be82
feat: add Self SDK provider
transphorm 429ffd5
test: cover passport camera and self client provider
transphorm ddffb46
allow this to fail for now cuz the runner doesn't support 16.4
transphorm 87da297
sort imports
transphorm 4eec728
upgrade and fix
transphorm 40b7963
fix header issue
transphorm 8f4cd31
pr feedback
transphorm 9117bb9
fix linter
transphorm 58abf5a
Update app/scripts/check-license-headers.mjs
transphorm 9ee9a0e
Update app/scripts/check-license-headers.mjs
transphorm e110dc6
update extensions and lock file
transphorm 20000fa
simplify call
transphorm ae65a47
use caching
transphorm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /** | ||
| * Script to check and fix license header formatting | ||
| * Ensures there's a newline after license headers | ||
| */ | ||
|
|
||
| // SPDX-License-Identifier: BUSL-1.1; Copyright (c) 2025 Social Connect Labs, Inc.; Licensed under BUSL-1.1 (see LICENSE); Apache-2.0 from 2029-06-11 | ||
|
||
|
|
||
| import fs from 'fs'; | ||
transphorm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import path from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
|
|
||
| const LICENSE_HEADER = | ||
| '// SPDX-License-Identifier: BUSL-1.1; Copyright (c) 2025 Social Connect Labs, Inc.; Licensed under BUSL-1.1 (see LICENSE); Apache-2.0 from 2029-06-11'; | ||
|
|
||
| function findFiles(dir, extensions = ['.ts', '.tsx', '.js', '.jsx']) { | ||
| const files = []; | ||
transphorm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| function traverse(currentDir) { | ||
| const items = fs.readdirSync(currentDir); | ||
|
|
||
| for (const item of items) { | ||
| const fullPath = path.join(currentDir, item); | ||
| const stat = fs.statSync(fullPath); | ||
|
|
||
| if (stat.isDirectory()) { | ||
| // Skip node_modules, .git, and other common directories | ||
| if ( | ||
| !['node_modules', '.git', 'dist', 'build', 'coverage'].includes(item) | ||
| ) { | ||
| traverse(fullPath); | ||
| } | ||
| } else if (extensions.some(ext => item.endsWith(ext))) { | ||
| files.push(fullPath); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| traverse(dir); | ||
| return files; | ||
| } | ||
|
|
||
| function checkLicenseHeader(filePath) { | ||
| const content = fs.readFileSync(filePath, 'utf8'); | ||
| const lines = content.split('\n'); | ||
|
|
||
| // Check if first line is license header | ||
| if (lines[0] === LICENSE_HEADER) { | ||
| // Check if second line is empty (has newline after license header) | ||
| if (lines[1] !== '') { | ||
| return { | ||
| file: filePath, | ||
| issue: 'Missing newline after license header', | ||
| fixed: false, | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| function fixLicenseHeader(filePath) { | ||
| const content = fs.readFileSync(filePath, 'utf8'); | ||
| const lines = content.split('\n'); | ||
|
|
||
| if (lines[0] === LICENSE_HEADER && lines[1] !== '') { | ||
| // Insert empty line after license header | ||
| lines.splice(1, 0, ''); | ||
| const fixedContent = lines.join('\n'); | ||
| fs.writeFileSync(filePath, fixedContent, 'utf8'); | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
transphorm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| function main() { | ||
| const args = process.argv.slice(2); | ||
| const isFix = args.includes('--fix'); | ||
| const isCheck = args.includes('--check') || !isFix; | ||
|
|
||
| const projectRoot = path.resolve(__dirname, '..'); | ||
| const files = findFiles(projectRoot); | ||
|
|
||
| const issues = []; | ||
|
|
||
| for (const file of files) { | ||
| const issue = checkLicenseHeader(file); | ||
| if (issue) { | ||
| issues.push(issue); | ||
|
|
||
| if (isFix) { | ||
| const fixed = fixLicenseHeader(file); | ||
| if (fixed) { | ||
| issue.fixed = true; | ||
| console.log(`✅ Fixed: ${file}`); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (isCheck) { | ||
| if (issues.length === 0) { | ||
| console.log('✅ All license headers are properly formatted'); | ||
| } else { | ||
| console.log( | ||
| `❌ Found ${issues.length} files with license header issues:`, | ||
| ); | ||
| for (const issue of issues) { | ||
| console.log(` - ${issue.file}: ${issue.issue}`); | ||
| } | ||
| console.log('\nRun with --fix to automatically fix these issues'); | ||
| process.exit(1); | ||
| } | ||
| } else if (isFix) { | ||
| const fixedCount = issues.filter(issue => issue.fixed).length; | ||
| console.log(`\n✅ Fixed ${fixedCount} files`); | ||
| } | ||
| } | ||
|
|
||
| if (import.meta.url === `file://${process.argv[1]}`) { | ||
| main(); | ||
| } | ||
transphorm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
this fixes the failing
16.4error. missed it from earlier