Skip to content

feat: Add Radar to Node SDK#1596

Merged
gjtorikian merged 3 commits into
mainfrom
add-radar
May 26, 2026
Merged

feat: Add Radar to Node SDK#1596
gjtorikian merged 3 commits into
mainfrom
add-radar

Conversation

@gjtorikian
Copy link
Copy Markdown
Contributor

@gjtorikian gjtorikian commented May 20, 2026

Summary

  • Adds the Radar module to the Node SDK, exposing standalone Radar assess, update-attempt, update-list, and delete-list-entry operations on workos.radar.
  • Introduces interfaces, serializers, and JSON fixtures for Radar request/response payloads (verdicts, controls, actions, auth methods, blocklist types, etc.).
  • Registers Radar in src/index.ts, src/workos.ts, and .oagen-manifest.json so generated artifacts and barrel exports stay in sync.
  • Adds radar.spec.ts covering the new client methods.

Test plan

  • npm test -- radar.spec.ts passes
  • Full test suite passes
  • workos.radar is reachable from a consumer and types resolve correctly

Summary by CodeRabbit

  • New Features

    • Added Radar API client to the SDK for creating and updating security assessment attempts.
    • Added allowlist/blocklist management endpoints (add/remove entries).
    • SDK now exposes the Radar feature on the main client.
  • Bug Fixes / Improvements

    • Added webhook events for Pipes connected account lifecycle: connected, disconnected, reauthorization needed.

Review Change Stack

@gjtorikian gjtorikian requested review from a team as code owners May 20, 2026 17:48
@gjtorikian gjtorikian requested a review from stacurry May 20, 2026 17:48
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 222e9076-6558-43d8-95ae-dfdcba14fae3

📥 Commits

Reviewing files that changed from the base of the PR and between 4048b5b and ec7c8ed.

📒 Files selected for processing (1)
  • .oagen-manifest.json

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

Adds 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.

Changes

Radar API feature addition

Layer / File(s) Summary
Radar type contracts and value enums
src/radar/interfaces/radar-list-action.interface.ts, src/radar/interfaces/radar-list-type.interface.ts, src/radar/interfaces/radar-standalone-assess-request-action.interface.ts, src/radar/interfaces/radar-standalone-assess-request-auth-method.interface.ts, src/radar/interfaces/radar-standalone-response-verdict.interface.ts, src/radar/interfaces/radar-standalone-response-control.interface.ts, src/radar/interfaces/radar-standalone-response-blocklist-type.interface.ts
Constant lookup objects and derived union types defining allowed values for list actions, list categories, assessment request actions, authentication methods, response verdicts, controls, and blocklist types.
Radar request and response interfaces
src/radar/interfaces/radar-standalone-assess-request.interface.ts, src/radar/interfaces/radar-list-entry-already-present-response.interface.ts, src/radar/interfaces/radar-standalone-delete-radar-list-entry-request.interface.ts, src/radar/interfaces/radar-standalone-update-radar-list-request.interface.ts, src/radar/interfaces/radar-standalone-update-radar-attempt-request.interface.ts, src/radar/interfaces/radar-standalone-response.interface.ts
Request and response interface pairs for assess, list update, list delete, and attempt update operations with camelCase domain model and snake_case wire shapes.
Radar request/response serializers
src/radar/serializers/index.ts, src/radar/serializers/radar-list-entry-already-present-response.serializer.ts, src/radar/serializers/radar-standalone-assess-request.serializer.ts, src/radar/serializers/radar-standalone-delete-radar-list-entry-request.serializer.ts, src/radar/serializers/radar-standalone-response.serializer.ts, src/radar/serializers/radar-standalone-update-radar-attempt-request.serializer.ts, src/radar/serializers/radar-standalone-update-radar-list-request.serializer.ts
Serialize and deserialize functions mapping between camelCase domain models and snake_case wire formats for all Radar request and response types, plus barrel re-export module.
Radar API client implementation
src/radar/radar.ts
Radar class with four async methods: createAttempt (POST assess), updateAttempt (PUT attempt), addListEntry (POST list entry), and removeListEntry (DELETE list entry), each using typed serialization and WorkOS HTTP client helpers.
Radar tests and test fixtures
src/radar/radar.spec.ts, src/radar/fixtures/radar-*.json
Jest test suite covering createAttempt, updateAttempt, addListEntry, and removeListEntry with mocked HTTP responses and body assertions; JSON fixtures for assess, response, list delete, list update, and attempt update payloads.
Radar package integration and exports
src/radar/interfaces/index.ts, src/index.ts, src/workos.ts, .oagen-manifest.json
Radar interfaces barrel module, re-export from package entrypoint, Radar client instance property on WorkOS class, and manifest file timestamp/entry updates.

Webhook pipes connected account events

Layer / File(s) Summary
Pipes connected account webhook events
src/webhooks/interfaces/create-webhook-endpoint-events.interface.ts, src/webhooks/interfaces/update-webhook-endpoint-events.interface.ts
New event entries PipesConnectedAccountConnected, PipesConnectedAccountDisconnected, and PipesConnectedAccountReauthorizationNeeded added to webhook endpoint event enums for create and update operations.
  • Possibly related PRs:

    • workos/workos-node#1596: Overlapping Radar feature additions (interfaces, serializers, Radar client, tests, fixtures, and exports).
  • Suggested reviewers:

    • stacurry
    • blairworkos
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding the Radar feature to the Node SDK.
Description check ✅ Passed The PR description provides comprehensive context about the changes made, test results, and objectives. However, it does not follow the provided template structure which includes a 'Documentation' section with a checkbox.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-radar

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Greptile Summary

This PR adds the Radar module to the WorkOS Node SDK, introducing workos.radar with createAttempt, updateAttempt, addListEntry, and removeListEntry. It also adds Pipes connected-account webhook events to both create and update endpoint interfaces.

  • Radar client (src/radar/radar.ts): four methods backed by new interfaces, serializers, and JSON fixtures; registered in src/workos.ts and barrel-exported from src/index.ts.
  • Webhook events (src/webhooks/interfaces/*.ts): three new pipes.connected_account.* event constants added symmetrically to both create and update endpoint event enums.
  • addListEntry response typing: the method is declared to return Promise<RadarListEntryAlreadyPresentResponse> and always deserializes with the "already-present" serializer, but the normal 200/201 success path (when an entry is freshly added) almost certainly returns a different response shape — message would be undefined at runtime while TypeScript believes it is string.

Confidence Score: 4/5

Safe 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

Filename Overview
src/radar/radar.ts Core Radar client exposing createAttempt, updateAttempt, addListEntry, removeListEntry; addListEntry unconditionally deserializes via the "already-present" error serializer, leaving the normal success path untyped at runtime.
src/radar/radar.spec.ts Test suite covers all four methods but only exercises the addListEntry "already-present" fixture; there is no test for the normal 200/201 success path where a new entry is created.
src/radar/interfaces/radar-list-entry-already-present-response.interface.ts Defines message as required string; on the normal add-entry success path the API likely returns a different shape, making message undefined at runtime while TypeScript believes it is string.
src/radar/interfaces/radar-standalone-assess-request-auth-method.interface.ts Defines auth method enum; wire values are inconsistent — 'SMS_OTP' is fully uppercase while 'Email_OTP' uses mixed case, which may not match the Radar API's expected casing.
.oagen-manifest.json Registers all new Radar files in the oagen manifest; existing webhook fixture entries are preserved as context lines and are not removed.
src/webhooks/interfaces/create-webhook-endpoint-events.interface.ts Adds three Pipes connected-account webhook event constants; mirrored identically in update-webhook-endpoint-events.interface.ts.

Sequence Diagram

sequenceDiagram
    participant Consumer
    participant WorkOS as workos.radar (Radar)
    participant API as WorkOS Radar API

    Consumer->>WorkOS: createAttempt(payload)
    WorkOS->>API: POST /radar/attempts
    API-->>WorkOS: RadarStandaloneResponseWire
    WorkOS-->>Consumer: RadarStandaloneResponse (verdict, reason, attemptId, ...)

    Consumer->>WorkOS: updateAttempt(id, payload)
    WorkOS->>API: PUT /radar/attempts/:id
    API-->>WorkOS: void
    WorkOS-->>Consumer: void

    Consumer->>WorkOS: addListEntry(type, action, payload)
    WorkOS->>API: POST /radar/lists/:type/:action
    API-->>WorkOS: "201 (new entry) OR 200 {message}"
    Note over WorkOS: Always deserializes as RadarListEntryAlreadyPresentResponse
    WorkOS-->>Consumer: RadarListEntryAlreadyPresentResponse

    Consumer->>WorkOS: removeListEntry(type, action, payload)
    WorkOS->>API: DELETE /radar/lists/:type/:action (with body)
    API-->>WorkOS: 204
    WorkOS-->>Consumer: void
Loading

Reviews (5): Last reviewed commit: "nothing gets past you" | Re-trigger Greptile

Comment thread .oagen-manifest.json
Comment thread src/radar/interfaces/radar-standalone-assess-request-action.interface.ts Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a 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 info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 627d1c96-cafe-4f8a-8104-191f04a43bea

📥 Commits

Reviewing files that changed from the base of the PR and between e5015b0 and 13233a9.

📒 Files selected for processing (32)
  • .oagen-manifest.json
  • src/index.ts
  • src/radar/fixtures/radar-list-entry-already-present-response.json
  • src/radar/fixtures/radar-standalone-assess-request.json
  • src/radar/fixtures/radar-standalone-delete-radar-list-entry-request.json
  • src/radar/fixtures/radar-standalone-response.json
  • src/radar/fixtures/radar-standalone-update-radar-attempt-request.json
  • src/radar/fixtures/radar-standalone-update-radar-list-request.json
  • src/radar/interfaces/index.ts
  • src/radar/interfaces/radar-action.interface.ts
  • src/radar/interfaces/radar-list-entry-already-present-response.interface.ts
  • src/radar/interfaces/radar-standalone-assess-request-action.interface.ts
  • src/radar/interfaces/radar-standalone-assess-request-auth-method.interface.ts
  • src/radar/interfaces/radar-standalone-assess-request.interface.ts
  • src/radar/interfaces/radar-standalone-delete-radar-list-entry-request.interface.ts
  • src/radar/interfaces/radar-standalone-response-blocklist-type.interface.ts
  • src/radar/interfaces/radar-standalone-response-control.interface.ts
  • src/radar/interfaces/radar-standalone-response-verdict.interface.ts
  • src/radar/interfaces/radar-standalone-response.interface.ts
  • src/radar/interfaces/radar-standalone-update-radar-attempt-request.interface.ts
  • src/radar/interfaces/radar-standalone-update-radar-list-request.interface.ts
  • src/radar/interfaces/radar-type.interface.ts
  • src/radar/radar.spec.ts
  • src/radar/radar.ts
  • src/radar/serializers/index.ts
  • src/radar/serializers/radar-list-entry-already-present-response.serializer.ts
  • src/radar/serializers/radar-standalone-assess-request.serializer.ts
  • src/radar/serializers/radar-standalone-delete-radar-list-entry-request.serializer.ts
  • src/radar/serializers/radar-standalone-response.serializer.ts
  • src/radar/serializers/radar-standalone-update-radar-attempt-request.serializer.ts
  • src/radar/serializers/radar-standalone-update-radar-list-request.serializer.ts
  • src/workos.ts

@gjtorikian gjtorikian requested a review from blairworkos May 20, 2026 17:54
Comment thread src/radar/radar.ts
// This file is auto-generated by oagen. Do not edit.

export const RadarAction = {
Block: 'block',
Copy link
Copy Markdown
Contributor

@blairworkos blairworkos May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also issue a Challenge: 'challenge' action here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm this ip_sign_up_rate_limit should have been deprecated - I think that's something we'll need to do in the API.

Comment thread .oagen-manifest.json Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟠 Major

Fix stale .oagen-manifest.json entry after radar-type rename
.oagen-manifest.json still lists src/radar/interfaces/radar-type.interface.ts, but radar-type.interface.ts is not present in the repo, and src/radar/interfaces/index.ts only 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4d1c0df and 4048b5b.

📒 Files selected for processing (4)
  • .oagen-manifest.json
  • src/radar/interfaces/index.ts
  • src/radar/interfaces/radar-list-type.interface.ts
  • src/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

@gjtorikian gjtorikian merged commit 6330961 into main May 26, 2026
6 checks passed
@gjtorikian gjtorikian deleted the add-radar branch May 26, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants