Skip to content

feat: Add flag targets and flag target types resources - #1683

Open
Deborah-Digges wants to merge 4 commits into
mainfrom
feature/auth-6891-openapi-spec-sdk-regeneration-for-the-new-flag-target
Open

feat: Add flag targets and flag target types resources#1683
Deborah-Digges wants to merge 4 commits into
mainfrom
feature/auth-6891-openapi-spec-sdk-regeneration-for-the-new-flag-target

Conversation

@Deborah-Digges

Copy link
Copy Markdown
Contributor

Description

Adds the oagen-generated SDK surface for the new flag target endpoints:

  • workos.flagTargetslistFlagTargets, createFlagTarget, getFlagTarget, deleteFlagTarget (/flag_targets)
  • workos.flagTargetTypeslistFlagTargetTypes, createFlagTargetType, getFlagTargetType (/flag_target_types)

All resource classes, interfaces, serializers, tests, and fixtures under src/flag-targets/ and src/flag-target-types/ are generated by oagen from the OpenAPI spec (no hand-written wrappers, per the ticket). Hand-edited files are limited to wiring the accessors in src/workos.ts and the interface exports in src/index.ts.

Naming note (potentially breaking, type-only): the runtime client's poll-response interface FlagTarget { id; enabled } is renamed to FlagPollTarget, freeing the FlagTarget name for the API resource model:

-export interface FlagTarget { id: string; enabled: boolean }
+export interface FlagPollTarget { id: string; enabled: boolean }
+// FlagTarget is now the /flag_targets resource:
+export interface FlagTarget { object: 'flag_target'; id; flagId; flagSlug; environmentId; targetType; targetId; valueType; value; createdAt; updatedAt }

Without the rename, the emitter aliases the resource's return type to the existing (incompatible) poll shape. Only type-level imports of FlagTarget from the poll response are affected; runtime behavior is unchanged.

The endpoints are still @ApiExcludeController() in the monorepo; making them public in the spec/docs ships separately once SDKs are released.

Fixes AUTH-6891

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

API reference docs for these endpoints are generated from the monorepo spec and will ship with the PR that removes @ApiExcludeController().

Link to Devin session: https://app.devin.ai/sessions/fdf25eeb8122400891ee756d079bfbeb
Requested by: @Deborah-Digges

Deborah-Digges and others added 2 commits August 21, 2026 19:11
Frees the FlagTarget name for the generated /flag_targets resource model, which the oagen node emitter otherwise aliases to the poll-response shape.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated from the OpenAPI spec via oagen for the new /flag_targets and
/flag_target_types endpoints (AUTH-6891):

- workos.flagTargets: list/create/get/delete flag targets
- workos.flagTargetTypes: list/create/get custom flag target types

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from deborah.digges

Do you have all the information you need to able to do this task? https://linear.app/workos/issue/AUTH-6891/openapi-spec-sdk-regeneration-for-the-new-flag-target-endpoints

If so, can we start with the node sdk first?

I

@linear-code

linear-code Bot commented Aug 21, 2026

Copy link
Copy Markdown

AUTH-6891

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds generated SDK resources for managing flag targets and flag target types and wires them into the WorkOS client. It also renames the runtime polling target interface and exports the new resource interfaces from both package entrypoints.

  • Adds list, create, get, and delete operations for flag targets.
  • Adds list, create, and get operations for flag target types.
  • Adds serializers, interfaces, fixtures, and tests for both resources.
  • Restores the missing flag-target interface exports in the Worker/edge entrypoint.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/index.worker.ts Re-exports both new interface barrels, resolving the previously reported missing Worker resource types.
src/workos.ts Exposes initialized FlagTargets and FlagTargetTypes resource clients on every WorkOS instance.
src/flag-targets/flag-targets.ts Implements the generated list, create, get, and delete operations with serialization and encoded path identifiers.
src/flag-target-types/flag-target-types.ts Implements the generated list, create, and get operations for custom target types.
src/feature-flags/interfaces/flag-poll-response.interface.ts Renames the polling target interface to distinguish it from the new flag-target resource model.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  App[Application] --> WorkOS[WorkOS client]
  WorkOS --> FT[FlagTargets]
  WorkOS --> FTT[FlagTargetTypes]
  FT --> FTAPI["/flag_targets"]
  FTT --> FTTAPI["/flag_target_types"]
Loading

Reviews (2): Last reviewed commit: "Export flag target interfaces from worke..." | Re-trigger Greptile

Comment thread src/index.ts
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant