feat(pipes): Add Data Integration operations and models#1653
feat(pipes): Add Data Integration operations and models#1653gjtorikian wants to merge 2 commits into
Conversation
Greptile SummaryThis PR adds Data Integration management support to the Pipes SDK. The main changes are:
Confidence Score: 4/5The Data Integration additions are mostly self-contained, but the connected-account state export needs correction before this is safe to merge. The main implementation and tests cover the new API surface, while the missing disconnected state creates a concrete TypeScript compatibility break for valid connected-account responses. src/pipes/interfaces/connected-account-state.interface.ts
What T-Rex did
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/pipes/interfaces/connected-account-state.interface.ts:3-6
**Restore disconnected state**
`ConnectedAccount` still documents `disconnected` as a possible API state, and the existing connected-account serializers type `response.state` as `ConnectedAccountState`. Removing `Disconnected` from this exported const makes valid disconnected responses unrepresentable in TypeScript and breaks callers using `ConnectedAccountState.Disconnected` for delete/list states.
Reviews (2): Last reviewed commit: "fix(pipes): preserve omitted fields in u..." | Re-trigger Greptile |
thompsongl
left a comment
There was a problem hiding this comment.
It looks like the greptile P1s are valid. null does reset intentionally, with undefined being noop
Regenerate the Pipes service with the fixed oagen emitter. Optional+nullable request-body fields no longer coalesce to `?? null`, so a partial update omits untouched fields (no-op) instead of sending explicit null (which the API treats as a reset/clear). Fixes the two Greptile P1s on update-data-integration and update-custom-provider-definition, plus the same pattern in the create and custom-provider serializers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| export const ConnectedAccountState = { | ||
| Connected: 'connected', | ||
| NeedsReauthorization: 'needs_reauthorization', | ||
| Disconnected: 'disconnected', | ||
| } as const; |
There was a problem hiding this comment.
Restore disconnected state
ConnectedAccount still documents disconnected as a possible API state, and the existing connected-account serializers type response.state as ConnectedAccountState. Removing Disconnected from this exported const makes valid disconnected responses unrepresentable in TypeScript and breaks callers using ConnectedAccountState.Disconnected for delete/list states.
Artifacts
Repro: TypeScript source that imports ConnectedAccountState.Disconnected from the real SDK interface
- Contains supporting evidence from the run (text/typescript; charset=utf-8).
Repro: tsc output showing ConnectedAccountState.Disconnected is not exported
- Keeps the command output available without making the summary code-heavy.
Repro: runtime serializer source showing disconnected payload pass-through
- Contains supporting evidence from the run (text/typescript; charset=utf-8).
Repro: runtime output showing serializer preserves disconnected state
- Keeps the command output available without making the summary code-heavy.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/pipes/interfaces/connected-account-state.interface.ts
Line: 3-6
Comment:
**Restore disconnected state**
`ConnectedAccount` still documents `disconnected` as a possible API state, and the existing connected-account serializers type `response.state` as `ConnectedAccountState`. Removing `Disconnected` from this exported const makes valid disconnected responses unrepresentable in TypeScript and breaks callers using `ConnectedAccountState.Disconnected` for delete/list states.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
I don't think disconnected should be restored, because it's not a state the API actually returns—but I could be completely wrong.
The enum dropped to two values because this is the first PR to pull in the Pipes connected-account schemas, and those (ConnectedAccountDto and the create/update-connected-account options) only define connected / needs_reauthorization. disconnected only ever lived in the ConnectedAccount response schema (added in https://github.com/workos/workos/pull/50448), but it was never wired through the backend:
- The domain entity is
z.enum(['connected', 'needs_reauthorization']) - On disconnect we delete the installation row rather than setting
state: 'disconnected'.Thepipes.connected_account.disconnected webhookis the event; there's no lingering object carrying that state
So no response has ever come back with state: 'disconnected'. Adding it back to the SDK type would just re-introduce a value the API doesn't emit.
There was a problem hiding this comment.
That's a convincing clarification — if the domain entity is z.enum(['connected', 'needs_reauthorization']) and disconnect is modeled as a row deletion + webhook event rather than a state transition, then Disconnected was never a valid SDK value to expose. The removal is correct.
Happy to dismiss this comment. No rule needed here.
Summary
listDataIntegrations,createDataIntegration,getDataIntegration,updateDataIntegration, anddeleteDataIntegrationcreateUserConnectedAccountandupdateUserConnectedAccountpipes.spec.ts,serializers.spec.ts) covering the new operations and serialization round-tripsTest plan
yarn test src/pipespassesyarn build)