Feat/explicit http url + direct webhook public key#62
Conversation
Signed-off-by: Devyash Saini <dysaini2004@gmail.com>
Greptile SummaryThis PR replaces the internally-derived
Confidence Score: 3/5The core logic change is sound, but the test file has TypeScript compilation errors (duplicate keys + missing required field) and the changeset version bump is misclassified for what is a user-facing breaking change. Making packages/scrawn/tests/unit/scrawn/scrawn.test.ts has multiple duplicate keys and a missing required field; .changeset/ready-horses-punch.md has the wrong bump type for a breaking change. Important Files Changed
|
| const biller = scrawn({ | ||
| apiKey: validKey, | ||
| baseURL: "https://api.example", | ||
| httpUrl: "https://api.example", | ||
| httpUrl: "https://api.example", | ||
| httpUrl: "https://api.example", | ||
| }); |
There was a problem hiding this comment.
Duplicate object keys cause TypeScript compilation errors
The same httpUrl key appears two or three times inside a single object literal in several test cases (lines 62-64, 83-84, 101-102, 122-123, 136-137). TypeScript's strict mode treats duplicate object literal keys as a compile-time error (An object literal cannot have multiple properties with the same name). Even in lenient environments the last value silently wins, which is confusing and masks intent. These duplicate entries should be collapsed to a single httpUrl property in each object.
This pattern repeats across at least five test cases in this file.
| --- | ||
| "@scrawn/core": patch | ||
| --- |
There was a problem hiding this comment.
Adding
httpUrl as a required constructor argument is a breaking change: any existing caller that does not pass httpUrl will now receive a ScrawnConfigError at runtime. Under semantic versioning this requires at least a minor bump; if the library is already at a stable major version it may warrant a major bump. A patch release communicates bug fixes or non-breaking additions, which does not describe this change.
| --- | |
| "@scrawn/core": patch | |
| --- | |
| --- | |
| "@scrawn/core": minor | |
| --- |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if (config.webhookPublicKey) { | ||
| this.cachedPublicKey = config.webhookPublicKey; | ||
| } |
There was a problem hiding this comment.
No validation of the supplied
webhookPublicKey
The key is cached as-is without any format check. If a caller pastes a malformed or empty-after-trim key, verifyWebhook will use it silently and every webhook verification will fail — with no indication at construction time that the supplied key is wrong. A basic format guard (e.g., minimum length, expected PEM prefix) would surface the misconfiguration immediately.
No description provided.