feat: Add Radar to Node SDK#1596
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Disabled knowledge base sources:
📝 WalkthroughWalkthroughAdds a new Radar SDK feature: TypeScript interfaces and enums, serializers, a Radar client with four methods, Jest tests and JSON fixtures, exports the radar interfaces from package entrypoint, integrates Radar into WorkOS class, updates manifest, and adds three webhook pipes.connected_account events. ChangesRadar API feature addition
Webhook pipes connected account events
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR adds the Radar module to the WorkOS Node SDK, introducing
Confidence Score: 4/5Safe to merge with awareness of the addListEntry response typing mismatch, which was flagged in an earlier review round but remains unaddressed in the current diff. The Radar module is well-structured and the four methods are wired up correctly end-to-end. The one structural concern is addListEntry: it unconditionally deserializes the API response with the "already-present" serializer, but the normal success path (first time an entry is added) returns a different shape from the API. At runtime, message will be undefined while TypeScript says it is string, silently breaking any caller that reads result.message on a fresh add. The test suite only exercises the already-present fixture, so the mismatch is undetected. src/radar/radar.ts and src/radar/interfaces/radar-list-entry-already-present-response.interface.ts — the addListEntry return type and deserializer need to account for both the "entry added" and "already present" response shapes. Important Files Changed
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 627d1c96-cafe-4f8a-8104-191f04a43bea
📒 Files selected for processing (32)
.oagen-manifest.jsonsrc/index.tssrc/radar/fixtures/radar-list-entry-already-present-response.jsonsrc/radar/fixtures/radar-standalone-assess-request.jsonsrc/radar/fixtures/radar-standalone-delete-radar-list-entry-request.jsonsrc/radar/fixtures/radar-standalone-response.jsonsrc/radar/fixtures/radar-standalone-update-radar-attempt-request.jsonsrc/radar/fixtures/radar-standalone-update-radar-list-request.jsonsrc/radar/interfaces/index.tssrc/radar/interfaces/radar-action.interface.tssrc/radar/interfaces/radar-list-entry-already-present-response.interface.tssrc/radar/interfaces/radar-standalone-assess-request-action.interface.tssrc/radar/interfaces/radar-standalone-assess-request-auth-method.interface.tssrc/radar/interfaces/radar-standalone-assess-request.interface.tssrc/radar/interfaces/radar-standalone-delete-radar-list-entry-request.interface.tssrc/radar/interfaces/radar-standalone-response-blocklist-type.interface.tssrc/radar/interfaces/radar-standalone-response-control.interface.tssrc/radar/interfaces/radar-standalone-response-verdict.interface.tssrc/radar/interfaces/radar-standalone-response.interface.tssrc/radar/interfaces/radar-standalone-update-radar-attempt-request.interface.tssrc/radar/interfaces/radar-standalone-update-radar-list-request.interface.tssrc/radar/interfaces/radar-type.interface.tssrc/radar/radar.spec.tssrc/radar/radar.tssrc/radar/serializers/index.tssrc/radar/serializers/radar-list-entry-already-present-response.serializer.tssrc/radar/serializers/radar-standalone-assess-request.serializer.tssrc/radar/serializers/radar-standalone-delete-radar-list-entry-request.serializer.tssrc/radar/serializers/radar-standalone-response.serializer.tssrc/radar/serializers/radar-standalone-update-radar-attempt-request.serializer.tssrc/radar/serializers/radar-standalone-update-radar-list-request.serializer.tssrc/workos.ts
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export const RadarAction = { | ||
| Block: 'block', |
There was a problem hiding this comment.
We can also issue a Challenge: 'challenge' action here
There was a problem hiding this comment.
oh I see - this is just for lists, where we only support block and allow. Could we update the const naming to be something like "RadarListAction"?
| @@ -0,0 +1,11 @@ | |||
| // This file is auto-generated by oagen. Do not edit. | |||
|
|
|||
| export const RadarStandaloneAssessRequestAction = { | |||
There was a problem hiding this comment.
Could we narrow this to just be "sign-up" and "sign-in"? I'm also looking at the public docs, and we support like a lot of different variations, but I think that's just iterations. Wonder if we can only show these two options publicly to try and get users to send the right one.
| BruteForceAttack: 'brute_force_attack', | ||
| CredentialStuffing: 'credential_stuffing', | ||
| DomainSignUpRateLimit: 'domain_sign_up_rate_limit', | ||
| IpSignUpRateLimit: 'ip_sign_up_rate_limit', |
There was a problem hiding this comment.
hmmm this ip_sign_up_rate_limit should have been deprecated - I think that's something we'll need to do in the API.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/radar/interfaces/index.ts (1)
1-16:⚠️ Potential issue | 🟠 MajorFix stale
.oagen-manifest.jsonentry afterradar-typerename
.oagen-manifest.jsonstill listssrc/radar/interfaces/radar-type.interface.ts, butradar-type.interface.tsis not present in the repo, andsrc/radar/interfaces/index.tsonly exports./radar-list-type.interface; update the manifest (or generation output) to match the rename/remove.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b5aeee91-3a4c-4caf-9812-aa8c3cd8b76c
📒 Files selected for processing (4)
.oagen-manifest.jsonsrc/radar/interfaces/index.tssrc/radar/interfaces/radar-list-type.interface.tssrc/radar/radar.ts
✅ Files skipped from review due to trivial changes (3)
- src/radar/interfaces/radar-list-type.interface.ts
- .oagen-manifest.json
- src/radar/radar.ts
Summary
workos.radar.src/index.ts,src/workos.ts, and.oagen-manifest.jsonso generated artifacts and barrel exports stay in sync.radar.spec.tscovering the new client methods.Test plan
npm test -- radar.spec.tspassesworkos.radaris reachable from a consumer and types resolve correctlySummary by CodeRabbit
New Features
Bug Fixes / Improvements