-
Notifications
You must be signed in to change notification settings - Fork 55
feat: Generate Pipes off the OpenAPI spec #1625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gjtorikian
wants to merge
4
commits into
main
Choose a base branch
from
oagen/own-pipes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8f6a17c
generate Pipes off the OpenAPI spec
gjtorikian a37808b
fix(pipes): correct generated union output, drop dead files, restore …
gjtorikian 91bc5ba
test(pipes): restore getAccessToken server-error coverage
gjtorikian 0f09d19
test(pipes): regenerate spec with error-path and union-branch coverage
gjtorikian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "object": "connected_account", | ||
| "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": null, | ||
| "scopes": ["repo", "user:email"], | ||
| "state": "connected", | ||
| "created_at": "2024-01-16T14:20:00.000Z", | ||
| "updated_at": "2024-01-16T14:20:00.000Z" | ||
| } |
7 changes: 7 additions & 0 deletions
7
src/pipes/fixtures/data-integration-access-token-response-access-token.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "object": "access_token", | ||
| "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", | ||
| "expires_at": "2025-12-31T23:59:59.000Z", | ||
| "scopes": ["repo", "user:email"], | ||
| "missing_scopes": [] | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/pipes/fixtures/data-integration-access-token-response.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "active": true, | ||
| "access_token": { | ||
| "object": "access_token", | ||
| "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", | ||
| "expires_at": "2025-12-31T23:59:59.000Z", | ||
| "scopes": ["repo", "user:email"], | ||
| "missing_scopes": [] | ||
| } | ||
| } | ||
3 changes: 3 additions & 0 deletions
3
src/pipes/fixtures/data-integration-authorize-url-response.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "url": "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" | ||
| } |
5 changes: 5 additions & 0 deletions
5
src/pipes/fixtures/data-integrations-get-data-integration-authorize-url-request.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "return_to": "https://example.com/callback" | ||
| } |
4 changes: 4 additions & 0 deletions
4
src/pipes/fixtures/data-integrations-get-user-token-request.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT" | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/pipes/fixtures/data-integrations-list-response-data-connected-account.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "object": "connected_account", | ||
| "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": "test_organizationId", | ||
| "scopes": ["repo", "user:email"], | ||
| "state": "connected", | ||
| "created_at": "test_createdAt", | ||
| "updated_at": "test_updatedAt", | ||
| "userland_user_id": "test_userlandUserId" | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/pipes/fixtures/data-integrations-list-response-data.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "object": "data_provider", | ||
| "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "name": "GitHub", | ||
| "description": "Connect your GitHub account to access repositories.", | ||
| "slug": "github", | ||
| "integration_type": "test_integrationType", | ||
| "credentials_type": "test_credentialsType", | ||
| "scopes": ["repo", "user:email"], | ||
| "ownership": "userland_user", | ||
| "created_at": "test_createdAt", | ||
| "updated_at": "test_updatedAt", | ||
| "connected_account": { | ||
| "object": "connected_account", | ||
| "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": "test_organizationId", | ||
| "scopes": ["repo", "user:email"], | ||
| "state": "connected", | ||
| "created_at": "test_createdAt", | ||
| "updated_at": "test_updatedAt", | ||
| "userland_user_id": "test_userlandUserId" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "object": "list", | ||
| "data": [ | ||
| { | ||
| "object": "data_provider", | ||
| "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "name": "GitHub", | ||
| "description": "Connect your GitHub account to access repositories.", | ||
| "slug": "github", | ||
| "integration_type": "test_integrationType", | ||
| "credentials_type": "test_credentialsType", | ||
| "scopes": ["repo", "user:email"], | ||
| "ownership": "userland_user", | ||
| "created_at": "test_createdAt", | ||
| "updated_at": "test_updatedAt", | ||
| "connected_account": { | ||
| "object": "connected_account", | ||
| "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": "test_organizationId", | ||
| "scopes": ["repo", "user:email"], | ||
| "state": "connected", | ||
| "created_at": "test_createdAt", | ||
| "updated_at": "test_updatedAt", | ||
| "userland_user_id": "test_userlandUserId" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/pipes/interfaces/authorize-data-integration-options.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface AuthorizeDataIntegrationOptions { | ||
| /** The slug identifier of the provider (e.g., `github`, `slack`, `notion`). */ | ||
| slug: string; | ||
| /** The ID of the user to authorize. */ | ||
| userId: string; | ||
| /** An organization ID to scope the authorization to a specific organization. */ | ||
| organizationId?: string; | ||
| /** The URL to redirect the user to after authorization. */ | ||
| returnTo?: string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export const ConnectedAccountState = { | ||
| Connected: 'connected', | ||
| NeedsReauthorization: 'needs_reauthorization', | ||
| Disconnected: 'disconnected', | ||
| } as const; | ||
|
|
||
| export type ConnectedAccountState = | ||
| (typeof ConnectedAccountState)[keyof typeof ConnectedAccountState]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import type { ConnectedAccountState } from './connected-account-state.interface'; | ||
|
|
||
| export interface ConnectedAccount { | ||
| /** Distinguishes the connected account object. */ | ||
| object: 'connected_account'; | ||
| /** The unique identifier of the connected account. */ | ||
| id: string; | ||
| /** The [User](https://workos.com/docs/reference/authkit/user) identifier associated with this connection. */ | ||
| userId: string | null; | ||
| /** The [Organization](https://workos.com/docs/reference/organization) identifier associated with this connection, or `null` if not scoped to an organization. */ | ||
| organizationId: string | null; | ||
| /** The OAuth scopes granted for this connection. */ | ||
| scopes: string[]; | ||
| /** | ||
| * The state of the connected account: | ||
| * - `connected`: The connection is active and tokens are valid. | ||
| * - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed. | ||
| * - `disconnected`: The connection has been disconnected. | ||
| */ | ||
| state: ConnectedAccountState; | ||
| /** The timestamp when the connection was created. */ | ||
| createdAt: string; | ||
| /** The timestamp when the connection was last updated. */ | ||
| updatedAt: string; | ||
| } | ||
|
|
||
| export interface ConnectedAccountResponse { | ||
| object: 'connected_account'; | ||
| id: string; | ||
| user_id: string | null; | ||
| organization_id: string | null; | ||
| scopes: string[]; | ||
| state: ConnectedAccountState; | ||
| created_at: string; | ||
| updated_at: string; | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/pipes/interfaces/create-data-integration-token-options.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface CreateDataIntegrationTokenOptions { | ||
| /** The identifier of the integration. */ | ||
| slug: string; | ||
| /** A [User](https://workos.com/docs/reference/authkit/user) identifier. */ | ||
| userId: string; | ||
| /** An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. */ | ||
| organizationId?: string; | ||
| } |
23 changes: 23 additions & 0 deletions
23
src/pipes/interfaces/data-integration-access-token-response-access-token.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| /** The [access token](https://workos.com/docs/reference/pipes/access-token) object, present when `active` is `true`. */ | ||
| export interface DataIntegrationAccessTokenResponseAccessToken { | ||
| /** Distinguishes the access token object. */ | ||
| object: 'access_token'; | ||
| /** The OAuth access token for the connected integration. */ | ||
| accessToken: string; | ||
| /** The ISO-8601 formatted timestamp indicating when the access token expires. */ | ||
| expiresAt: Date | null; | ||
| /** The scopes granted to the access token. */ | ||
| scopes: string[]; | ||
| /** If the integration has requested scopes that aren't present on the access token, they're listed here. */ | ||
| missingScopes: string[]; | ||
| } | ||
|
|
||
| export interface DataIntegrationAccessTokenResponseAccessTokenResponse { | ||
| object: 'access_token'; | ||
| access_token: string; | ||
| expires_at: string | null; | ||
| scopes: string[]; | ||
| missing_scopes: string[]; | ||
| } |
9 changes: 9 additions & 0 deletions
9
src/pipes/interfaces/data-integration-access-token-response-error.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export const DataIntegrationAccessTokenResponseError = { | ||
| NotInstalled: 'not_installed', | ||
| NeedsReauthorization: 'needs_reauthorization', | ||
| } as const; | ||
|
|
||
| export type DataIntegrationAccessTokenResponseError = | ||
| (typeof DataIntegrationAccessTokenResponseError)[keyof typeof DataIntegrationAccessTokenResponseError]; |
17 changes: 17 additions & 0 deletions
17
src/pipes/interfaces/data-integration-access-token-response.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import type { | ||
| DataIntegrationAccessTokenResponseAccessToken, | ||
| DataIntegrationAccessTokenResponseAccessTokenResponse, | ||
| } from './data-integration-access-token-response-access-token.interface'; | ||
|
|
||
| export type DataIntegrationAccessTokenResponse = | ||
| | { active: true; accessToken: DataIntegrationAccessTokenResponseAccessToken } | ||
| | { active: false; error: 'needs_reauthorization' | 'not_installed' }; | ||
|
|
||
| export type DataIntegrationAccessTokenResponseWire = | ||
| | { | ||
| active: true; | ||
| access_token: DataIntegrationAccessTokenResponseAccessTokenResponse; | ||
| } | ||
| | { active: false; error: 'needs_reauthorization' | 'not_installed' }; |
10 changes: 10 additions & 0 deletions
10
src/pipes/interfaces/data-integration-authorize-url-response.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface DataIntegrationAuthorizeUrlResponse { | ||
| /** The OAuth authorization URL to redirect the user to. */ | ||
| url: string; | ||
| } | ||
|
|
||
| export interface DataIntegrationAuthorizeUrlResponseWire { | ||
| url: string; | ||
| } |
16 changes: 16 additions & 0 deletions
16
...ipes/interfaces/data-integrations-get-data-integration-authorize-url-request.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface DataIntegrationsGetDataIntegrationAuthorizeUrlRequest { | ||
| /** The ID of the user to authorize. */ | ||
| userId: string; | ||
| /** An organization ID to scope the authorization to a specific organization. */ | ||
| organizationId?: string; | ||
| /** The URL to redirect the user to after authorization. */ | ||
| returnTo?: string; | ||
| } | ||
|
|
||
| export interface DataIntegrationsGetDataIntegrationAuthorizeUrlRequestResponse { | ||
| user_id: string; | ||
| organization_id?: string; | ||
| return_to?: string; | ||
| } |
13 changes: 13 additions & 0 deletions
13
src/pipes/interfaces/data-integrations-get-user-token-request.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface DataIntegrationsGetUserTokenRequest { | ||
| /** A [User](https://workos.com/docs/reference/authkit/user) identifier. */ | ||
| userId: string; | ||
| /** An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. */ | ||
| organizationId?: string | null; | ||
| } | ||
|
|
||
| export interface DataIntegrationsGetUserTokenRequestResponse { | ||
| user_id: string; | ||
| organization_id?: string | null; | ||
| } |
10 changes: 10 additions & 0 deletions
10
...ipes/interfaces/data-integrations-list-response-data-connected-account-state.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export const DataIntegrationsListResponseDataConnectedAccountState = { | ||
| Connected: 'connected', | ||
| NeedsReauthorization: 'needs_reauthorization', | ||
| Disconnected: 'disconnected', | ||
| } as const; | ||
|
|
||
| export type DataIntegrationsListResponseDataConnectedAccountState = | ||
| (typeof DataIntegrationsListResponseDataConnectedAccountState)[keyof typeof DataIntegrationsListResponseDataConnectedAccountState]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.