-
-
Notifications
You must be signed in to change notification settings - Fork 83
Missing appLaunchURL mapping #652
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
base: master
Are you sure you want to change the base?
Conversation
…ance (#1) * replace zip library for better perf * revert prettier changes
WalkthroughAdded the Changes
Sequence Diagram(s)Asynchronous Zip Creation (yazl)sequenceDiagram
participant Pass
participant ZipFile as YazlZipFile
participant Stream as OutputStream
participant Collector as BufferArray
Pass->>ZipFile: new ZipFile()
loop for each file
Pass->>ZipFile: addBuffer(fileBuffer, fileName)
end
Pass->>ZipFile: end()
ZipFile->>Stream: pipe outputStream (data chunks)
Stream->>Collector: push(chunk)
Stream-->>Pass: on 'end' -> concatenate chunks -> resolve(Buffer)
Stream-->>Pass: on 'error' -> reject(Error)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)src/lib/nfc-fields.ts (1)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
package.json(2 hunks)src/constants.ts(1 hunks)src/lib/base-pass.ts(1 hunks)src/pass.ts(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/lib/base-pass.ts (1)
src/interfaces.ts (1)
ApplePass(442-449)
🔇 Additional comments (4)
package.json (1)
41-41: Approved:[email protected]and@types/[email protected]are up-to-date and secureVerified that:
- The latest
yazlversion on npm is 3.3.1- No moderate-or-above advisories reported by
npm auditAffected locations:
- package.json (line 41) –
"@types/yazl": "3.3.0"- package.json (lines 90–91) –
[email protected]entryThe dependency additions are safe to merge.
src/constants.ts (1)
163-167: LGTM: Correct implementation of appLaunchURL field.The
appLaunchURLfield is properly defined as an optional, templatable string field, which aligns with Apple's PassKit specification for companion app launch URLs.src/lib/base-pass.ts (1)
194-207: LGTM: Well-implemented property accessor following established patterns.The
appLaunchURLproperty implementation is consistent with other string properties in the class. The JSDoc documentation clearly explains its relationship toassociatedStoreIdentifiers, and the getter/setter logic properly handles null/undefined values.src/pass.ts (1)
5-5: LGTM: Appropriate import change for async zip creation.The switch from
do-not-ziptoyazlenables asynchronous zip file creation, which is better for performance and non-blocking operation.
| return new Promise<Buffer>((resolve, reject) => { | ||
| const yazlZip = new ZipFile(); | ||
|
|
||
| for (const { path, data } of zip) { | ||
| if (Buffer.isBuffer(data)) { | ||
| yazlZip.addBuffer(data, path); | ||
| } else { | ||
| yazlZip.addBuffer(Buffer.from(data), path); | ||
| } | ||
| } | ||
|
|
||
| yazlZip.end(); | ||
| const chunks: Buffer[] = []; | ||
| yazlZip.outputStream.on('data', (chunk: Buffer) => { | ||
| chunks.push(chunk); | ||
| }); | ||
| yazlZip.outputStream.on('end', () => { | ||
| resolve(Buffer.concat((chunks as unknown) as Uint8Array[])); | ||
| }); | ||
| yazlZip.outputStream.on('error', reject); | ||
| }); |
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.
🛠️ Refactor suggestion
Fix unnecessary type assertion and improve code clarity.
The async zip creation logic is correct, but there's an unnecessary type assertion that could be simplified.
Apply this diff to fix the type assertion:
- resolve(Buffer.concat((chunks as unknown) as Uint8Array[]));
+ resolve(Buffer.concat(chunks));The chunks array is already typed as Buffer[], and Buffer.concat() accepts Buffer[] | Uint8Array[], so the type assertion is unnecessary and makes the code less readable.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return new Promise<Buffer>((resolve, reject) => { | |
| const yazlZip = new ZipFile(); | |
| for (const { path, data } of zip) { | |
| if (Buffer.isBuffer(data)) { | |
| yazlZip.addBuffer(data, path); | |
| } else { | |
| yazlZip.addBuffer(Buffer.from(data), path); | |
| } | |
| } | |
| yazlZip.end(); | |
| const chunks: Buffer[] = []; | |
| yazlZip.outputStream.on('data', (chunk: Buffer) => { | |
| chunks.push(chunk); | |
| }); | |
| yazlZip.outputStream.on('end', () => { | |
| resolve(Buffer.concat((chunks as unknown) as Uint8Array[])); | |
| }); | |
| yazlZip.outputStream.on('error', reject); | |
| }); | |
| return new Promise<Buffer>((resolve, reject) => { | |
| const yazlZip = new ZipFile(); | |
| for (const { path, data } of zip) { | |
| if (Buffer.isBuffer(data)) { | |
| yazlZip.addBuffer(data, path); | |
| } else { | |
| yazlZip.addBuffer(Buffer.from(data), path); | |
| } | |
| } | |
| yazlZip.end(); | |
| const chunks: Buffer[] = []; | |
| yazlZip.outputStream.on('data', (chunk: Buffer) => { | |
| chunks.push(chunk); | |
| }); | |
| yazlZip.outputStream.on('end', () => { | |
| resolve(Buffer.concat(chunks)); | |
| }); | |
| yazlZip.outputStream.on('error', reject); | |
| }); |
🤖 Prompt for AI Agents
In src/pass.ts lines 117 to 137, remove the unnecessary type assertion on the
chunks array passed to Buffer.concat. Since chunks is already typed as Buffer[],
and Buffer.concat accepts Buffer[] or Uint8Array[], simply pass chunks directly
to Buffer.concat without casting to Uint8Array[]. This will improve code clarity
and maintain correctness.
added requiresAuthentication to NFC fields
Hi! Opening this pull request hoping it can get merged.
Currently, the module doesn't output
appLaunchURLdespite accepting it in its interface. This fixes that with a very simple addition. Tested successfully with Wallet.Summary by CodeRabbit
New Features
Chores
Refactor