diff --git a/MIGRATE.md b/MIGRATE.md
deleted file mode 100644
index a0d4c8a..0000000
--- a/MIGRATE.md
+++ /dev/null
@@ -1,828 +0,0 @@
-
-# Migrating from v1.x
-
-This guide will help you migrate your existing Pipedream SDK v1.x integration to
-the latest version.
-
-## Table of contents
-
-- [Migrating from v1.x](#migrating-from-v1x)
- - [Table of contents](#table-of-contents)
- - [Deprecation](#deprecation)
- - [Breaking changes](#breaking-changes)
- - [Client initialization](#client-initialization)
- - [Server-side](#server-side)
- - [v1.x (old)](#v1x-old)
- - [v2.x (new)](#v2x-new)
- - [Browser-side](#browser-side)
- - [v1.x (old)](#v1x-old-1)
- - [v2.x (new)](#v2x-new-1)
- - [Environment variables](#environment-variables)
- - [Method migration](#method-migration)
- - [Method and parameter naming](#method-and-parameter-naming)
- - [Migration examples](#migration-examples)
- - [Running actions](#running-actions)
- - [v1.x (old)](#v1x-old-2)
- - [v2.x (new)](#v2x-new-2)
- - [Deploying triggers](#deploying-triggers)
- - [v1.x (old)](#v1x-old-3)
- - [v2.x (new)](#v2x-new-3)
- - [Managing accounts](#managing-accounts)
- - [v1.x (old)](#v1x-old-4)
- - [v2.x (new)](#v2x-new-4)
- - [Creating connect tokens](#creating-connect-tokens)
- - [v1.x (old)](#v1x-old-5)
- - [v2.x (new)](#v2x-new-5)
- - [Validating connect tokens](#validating-connect-tokens)
- - [v1.x (old)](#v1x-old-6)
- - [v2.x (new)](#v2x-new-6)
- - [Configuring component props](#configuring-component-props)
- - [v1.x (old)](#v1x-old-7)
- - [v2.x (new)](#v2x-new-7)
- - [Deleting accounts](#deleting-accounts)
- - [v1.x (old)](#v1x-old-8)
- - [v2.x (new)](#v2x-new-8)
- - [Getting project info](#getting-project-info)
- - [v1.x (old)](#v1x-old-9)
- - [v2.x (new)](#v2x-new-9)
- - [Making proxy requests](#making-proxy-requests)
- - [v1.x (old)](#v1x-old-10)
- - [v2.x (new)](#v2x-new-10)
- - [Invoking workflows](#invoking-workflows)
- - [v1.x (old)](#v1x-old-11)
- - [v2.x (new)](#v2x-new-11)
- - [Namespace mapping](#namespace-mapping)
- - [New features in v2.x](#new-features-in-v2x)
- - [Full TypeScript support](#full-typescript-support)
- - [Pagination support](#pagination-support)
- - [Enhanced error handling](#enhanced-error-handling)
- - [Request options](#request-options)
- - [Abort signals](#abort-signals)
- - [Raw response access](#raw-response-access)
- - [Additional namespaces](#additional-namespaces)
- - [Partial migration](#partial-migration)
- - [Important removed functionality](#important-removed-functionality)
- - [Migration checklist](#migration-checklist)
-
-## Deprecation
-
-The v1.x version of the Pipedream SDK is now deprecated. This means that no
-changes will be made to this version unless there are critical security issues.
-We recommend that you migrate to the latest version of the SDK to take advantage
-of new features, improvements, and bug fixes if possible.
-
-## Breaking changes
-
-The new SDK version introduces several breaking changes that you need to be
-aware of when migrating from v1.x. Below is a summary of the most significant
-changes:
-
-- **Namespaced Methods**: Methods are now namespaced by the resource they act
- upon. For example, instead of using `client.runAction()`, you now use
- `client.actions.run()`.
-- **Snake Case Naming Convention**: Method arguments now follow the `snake_case`
- naming convention to align with our [OpenAPI
- spec](https://api.pipedream.com/api-docs/swagger.json).
-- **Client Initialization**: The `createBackendClient()` and
- `createFrontendClient()` methods have been replaced with a new
- `PipedreamClient` class.
-- **TypeScript Types**: All TypeScript types are now exported for better type
- safety.
-- **Authentication Changes**: The `rawAccessToken()` method has been replaced
- with the `oauthTokens.create()` namespace.
-- **Environment Variables**: The SDK now supports automatic configuration via
- environment variables (see below).
-
-## Client initialization
-
-### Server-side
-
-For server-side applications, we recommend using the `PipedreamClient` wrapper
-class, which simplifies OAuth token management.
-
-#### v1.x (old)
-
-```javascript
-import { createBackendClient } from '@pipedream/sdk';
-
-const client = createBackendClient({
- credentials: {
- clientId: 'your-client-id',
- clientSecret: 'your-client-secret',
- },
- projectId: 'your-project-id',
- environment: 'development', // or 'production'
-});
-```
-
-#### v2.x (new)
-
-```javascript
-import { PipedreamClient } from '@pipedream/sdk';
-
-const client = new PipedreamClient({
- clientId: 'your-client-id',
- clientSecret: 'your-client-secret',
- projectId: 'your-project-id',
- projectEnvironment: 'development', // or 'production'
-});
-```
-
-### Browser-side
-
-For browser-side applications, you should use the `PipedreamClient` class and
-authenticate using a `connect_token` obtained from your backend.
-
-#### v1.x (old)
-
-```javascript
-import { createFrontendClient } from '@pipedream/sdk';
-
-const frontendClient = createFrontendClient({
- environment: 'development',
- credentials: {
- token: 'connect-token-from-backend',
- },
-});
-```
-
-#### v2.x (new)
-
-```javascript
-import { PipedreamClient } from '@pipedream/sdk';
-
-const frontendClient = new PipedreamClient({
- token: 'connect-token-from-backend',
- projectId: 'your-project-id',
- projectEnvironment: 'development', // or 'production'
-});
-```
-
-### Environment variables
-
-The v2.x SDK supports automatic configuration via environment variables:
-
-```javascript
-// These environment variables are automatically used if set:
-// PIPEDREAM_CLIENT_ID
-// PIPEDREAM_CLIENT_SECRET
-// PIPEDREAM_PROJECT_ID
-// PIPEDREAM_PROJECT_ENVIRONMENT (defaults to 'production')
-
-// You can initialize the client with minimal configuration
-const client = new PipedreamClient({
- projectId: 'your-project-id', // Can also come from PIPEDREAM_PROJECT_ID
-});
-```
-
-## Method migration
-
-### Method and parameter naming
-
-In v2.x, all methods are namespaced and all method parameters are in
-`snake_case`. For example, `client.runAction({ externalUserId: '...' })` becomes
-`client.actions.run({ external_user_id: '...' })`. This aligns to what's stated
-the [OpenAPI spec](https://api.pipedream.com/api-docs/swagger.json), but does
-**not apply** to the following arguments:
-
-1. Client constructor parameters like `clientId`, `clientSecret`, and
- `projectId`.
-2. The props listed under `configured_props` (the naming follows whatever the
- corresponding component defines).
-3. Request meta-arguments like `timeoutInSeconds`, `maxRetries`, and `headers`.
-
-### Migration examples
-
-#### Running actions
-
-##### v1.x (old)
-
-```javascript
-const result = await client.runAction({
- externalUserId: 'jverce',
- actionId: 'gitlab-list-commits',
- configuredProps: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-});
-```
-
-##### v2.x (new)
-
-```javascript
-const result = await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-});
-```
-
-#### Deploying triggers
-
-##### v1.x (old)
-
-```javascript
-const trigger = await client.deployTrigger({
- externalUserId: 'jverce',
- triggerId: 'gitlab-new-issue',
- configuredProps: {
- gitlab: {
- authProvisionId: 'apn_kVh9AoD',
- },
- projectId: 45672541,
- },
- webhookUrl: 'https://events.example.com/gitlab-new-issue',
-});
-```
-
-##### v2.x (new)
-
-```javascript
-const trigger = await client.triggers.deploy({
- external_user_id: 'jverce',
- id: 'gitlab-new-issue',
- configured_props: {
- gitlab: {
- authProvisionId: 'apn_kVh9AoD',
- },
- projectId: 45672541,
- },
- webhook_url: 'https://events.example.com/gitlab-new-issue',
-});
-```
-
-#### Managing accounts
-
-##### v1.x (old)
-
-```javascript
-// List accounts
-const accounts = await client.getAccounts({
- external_user_id: 'jverce',
- include_credentials: true,
-});
-
-// Get specific account
-const account = await client.getAccountById('apn_kVh9AoD', {
- include_credentials: true,
-});
-```
-
-##### v2.x (new)
-
-```javascript
-// List accounts
-const accounts = await client.accounts.list({
- external_user_id: 'jverce',
- include_credentials: true,
-});
-
-// Get specific account
-const account = await client.accounts.retrieve('apn_kVh9AoD', {
- include_credentials: true,
-});
-```
-
-#### Creating connect tokens
-
-##### v1.x (old)
-
-```javascript
-const token = await client.createConnectToken({
- external_user_id: 'jverce',
-});
-```
-
-##### v2.x (new)
-
-```javascript
-const token = await client.tokens.create({
- external_user_id: 'jverce',
-});
-```
-
-#### Validating connect tokens
-
-##### v1.x (old)
-
-```javascript
-// validateConnectToken was available in v1.x
-const isValid = await client.validateConnectToken({
- token: 'connect-token-to-validate',
-});
-```
-
-##### v2.x (new)
-
-```javascript
-const validation = await client.tokens.validate({
- token: 'connect-token-to-validate',
-});
-```
-
-#### Configuring component props
-
-##### v1.x (old)
-
-```javascript
-const response = await client.configureComponent({
- externalUserId: 'jverce',
- componentId: 'gitlab-new-issue',
- propName: 'projectId',
- configuredProps: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- },
-});
-```
-
-##### v2.x (new)
-
-```javascript
-const response = await client.components.configureProp({
- external_user_id: 'jverce',
- id: 'gitlab-new-issue',
- prop_name: 'projectId',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- },
-});
-```
-
-#### Deleting accounts
-
-##### v1.x (old)
-
-```javascript
-// Delete specific account
-await client.deleteAccount('account-id');
-
-// Delete all accounts for an app
-await client.deleteAccountsByApp('app-id');
-
-// Delete external user
-await client.deleteExternalUser('jverce');
-```
-
-##### v2.x (new)
-
-```javascript
-// Delete specific account
-await client.accounts.delete('account-id');
-
-// Delete all accounts for an app - functionality removed
-// Consider using accounts.list() and deleting individually
-
-// Delete external user - use users namespace
-await client.users.delete({
- external_user_id: 'jverce',
-});
-```
-
-#### Getting project info
-
-##### v1.x (old)
-
-```javascript
-const projectInfo = await client.getProjectInfo();
-console.log(projectInfo.apps);
-```
-
-##### v2.x (new)
-
-```javascript
-const project = await client.projects.retrieve();
-console.log(project);
-```
-
-#### Making proxy requests
-
-##### v1.x (old)
-
-```javascript
-// v1.x uses a single method with two parameters
-const response = await client.makeProxyRequest({
- searchParams: {
- external_user_id: 'jverce',
- account_id: 'apn_kVh9AoD',
- },
-}, {
- url: 'https://api.example.com/data',
- options: {
- method: 'GET',
- headers: {
- 'Accept': 'application/json',
- },
- },
-});
-
-// POST request with body
-const postResponse = await client.makeProxyRequest({
- searchParams: {
- external_user_id: 'jverce',
- account_id: 'apn_kVh9AoD',
- },
-}, {
- url: 'https://api.example.com/users',
- options: {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ name: 'John Doe' }),
- },
-});
-```
-
-##### v2.x (new)
-
-```javascript
-// v2.x uses separate methods for each HTTP verb
-const response = await client.proxy.get({
- external_user_id: 'jverce',
- account_id: 'apn_kVh9AoD',
- url: 'https://api.example.com/data',
- headers: {
- 'Accept': 'application/json',
- },
- params: {}, // Additional query parameters if needed
-});
-
-// POST request with body
-const postResponse = await client.proxy.post({
- external_user_id: 'jverce',
- account_id: 'apn_kVh9AoD',
- url: 'https://api.example.com/users',
- body: { name: 'John Doe' }, // Body is passed as an object, not a string
- headers: {
- 'Content-Type': 'application/json',
- },
-});
-
-// Other HTTP methods are available
-await client.proxy.put({ /* ... */ });
-await client.proxy.delete({ /* ... */ });
-await client.proxy.patch({ /* ... */ });
-```
-
-#### Invoking workflows
-
-##### v1.x (old)
-
-```javascript
-// Invoke a workflow
-const response = await client.invokeWorkflow(
- 'https://your-endpoint.m.pipedream.net',
- {
- foo: 123,
- bar: 'abc',
- },
- HTTPAuthType.OAuth // Optional auth type
-);
-
-// Invoke a workflow for an external user
-const response = await client.invokeWorkflowForExternalUser(
- 'https://your-workflow-url.m.pipedream.net',
- 'jverce', // external user ID as second parameter
- {
- foo: 123,
- bar: 'abc',
- }
-);
-```
-
-##### v2.x (new)
-
-```javascript
-// Invoke a workflow
-const response = await client.workflows.invoke({
- urlOrEndpoint: 'https://your-endpoint.m.pipedream.net',
- body: {
- foo: 123,
- bar: 'abc',
- },
- headers: {
- 'Accept': 'application/json',
- },
-}, Pipedream.HTTPAuthType.OAuth);
-
-// Invoke a workflow for an external user
-const response = await client.workflows.invokeForExternalUser({
- urlOrEndpoint: 'https://your-workflow-url.m.pipedream.net',
- externalUserId: 'jverce', // now part of the options object
- body: {
- foo: 123,
- bar: 'abc',
- },
-});
-```
-
-## Namespace mapping
-
-Here's a complete list of how v1.x methods map to v2.x namespaced methods:
-
-| v1.x Method | v2.x Method |
-| --------------------------------- | ------------------------------------ |
-| `runAction()` | `actions.run()` |
-| `getAccounts()` | `accounts.list()` |
-| `getAccountById()` | `accounts.retrieve()` |
-| `deleteAccount()` | `accounts.delete()` |
-| `deleteAccountsByApp()` | Not available (use list + delete) |
-| `deleteExternalUser()` | `users.delete()` |
-| `createConnectToken()` | `tokens.create()` |
-| `validateConnectToken()` | `tokens.validate()` |
-| `deployTrigger()` | `triggers.deploy()` |
-| `getDeployedTriggers()` | `deployedTriggers.list()` |
-| `getDeployedTrigger()` | `deployedTriggers.retrieve()` |
-| `updateDeployedTrigger()` | `deployedTriggers.update()` |
-| `deleteDeployedTrigger()` | `deployedTriggers.delete()` |
-| `getTriggerEvents()` | `deployedTriggers.listEvents()` |
-| `getTriggerWebhooks()` | `deployedTriggers.listWebhooks()` |
-| `updateTriggerWebhooks()` | `deployedTriggers.updateWebhooks()` |
-| `getTriggerWorkflows()` | `deployedTriggers.listWorkflows()` |
-| `updateTriggerWorkflows()` | `deployedTriggers.updateWorkflows()` |
-| `getUsers()` | `users.list()` |
-| `getUser()` | `users.retrieve()` |
-| `getApps()` | `apps.list()` |
-| `getApp()` | `apps.retrieve()` |
-| `getComponents()` | `components.list()` |
-| `getComponent()` | `components.retrieve()` |
-| `configureComponent()` | `components.configureProp()` |
-| `reloadComponentProps()` | `components.reloadProps()` |
-| `getProjectInfo()` | `projects.retrieve()` |
-| `makeProxyRequest()` | `proxy.get()`, `proxy.post()`, etc. |
-| `invokeWorkflow()` | `workflows.invoke()` |
-| `invokeWorkflowForExternalUser()` | `workflows.invokeForExternalUser()` |
-| `rawAccessToken()` | Not available (managed internally) |
-
-## New features in v2.x
-
-The v2.x SDK includes several new features not available in v1.x:
-
-### Full TypeScript support
-
-```typescript
-import { type RunActionResponse } from '@pipedream/sdk';
-
-const result: RunActionResponse = await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-});
-```
-
-### Pagination support
-
-```javascript
-// Automatic pagination
-for await (const account of client.accounts.list({
- external_user_id: 'jverce',
-})) {
- console.log(account);
-}
-
-// Manual pagination
-const firstPage = await client.accounts.list({
- external_user_id: 'jverce',
- limit: 20,
-});
-
-if (firstPage.hasNextPage()) {
- const nextPage = await firstPage.getNextPage();
- console.log(nextPage.data);
-}
-```
-
-### Enhanced error handling
-
-```javascript
-import { PipedreamError } from '@pipedream/sdk';
-
-try {
- await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
- });
-} catch (error) {
- if (error instanceof PipedreamError) {
- console.error('API Error:', error.status, error.message);
- }
-}
-```
-
-### Request options
-
-```javascript
-// Custom timeout
-const result = await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-}, {
- timeoutInSeconds: 30,
-});
-
-// Retry configuration
-const result = await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-}, {
- maxRetries: 3,
-});
-
-// Custom headers
-const result = await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-}, {
- headers: {
- 'X-Custom-Header': 'value',
- },
-});
-```
-
-### Abort signals
-
-```javascript
-const controller = new AbortController();
-
-// Abort after 5 seconds
-setTimeout(() => controller.abort(), 5000);
-
-try {
- const result = await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
- }, {
- abortSignal: controller.signal,
- });
-} catch (error) {
- if (error.name === 'AbortError') {
- console.log('Request was aborted');
- }
-}
-```
-
-### Raw response access
-
-```javascript
-const response = await client.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-}, {
- includeRawResponse: true,
-});
-
-console.log(response.data); // Parsed response data
-console.log(response.rawResponse); // Original Response object
-```
-
-## Additional namespaces
-
-The v2.x SDK includes several new namespaces not available in v1.x:
-
-- `apps` - Browse available apps and integrations
-- `appCategories` - List app categories
-- `components` - Work with components
-- `deployedTriggers.listEvents()` - List events for a deployed trigger
-- `deployedTriggers.listWebhooks()` - List webhooks for a deployed trigger
-- `deployedTriggers.listWorkflows()` - List workflows for a deployed trigger
-- `projects` - Get project information
-- `proxy` - Work with HTTP proxy endpoints
-- `triggers` - Additional trigger operations beyond deployment
-- `users` - User information
-- `oauthTokens` - OAuth token management
-- `workflows` - Invoke workflows
-
-## Partial migration
-
-If you are unable to migrate all your code at once, you can use the new SDK
-alongside the old one by leveraging package aliases. This allows you to migrate
-incrementally without breaking your existing codebase. To do this, you can
-install the new SDK with an alias:
-
-```bash
-npm install @pipedream/sdk-v2@npm:@pipedream/sdk@^2.0.0 --save
-```
-
-Then, in your code, you can import the new SDK with the alias:
-
-```javascript
-import { createBackendClient } from '@pipedream/sdk';
-import { PipedreamClient } from '@pipedream/sdk-v2';
-
-const clientOpts = {
- credentials: {
- clientId,
- clientSecret,
- },
- projectId,
- environment,
-}
-
-const client = createBackendClient(clientOpts);
-const newClient = new PipedreamClient({
- ...clientOpts.credentials,
- projectEnvironment: clientOpts.environment,
- projectId: clientOpts.projectId,
-});
-
-// Use old client for existing code
-const oldResult = await client.runAction({
- externalUserId: 'jverce',
- actionId: 'gitlab-list-commits',
- configuredProps: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-});
-
-// Use new client for migrated code
-const newResult = await newClient.actions.run({
- external_user_id: 'jverce',
- id: 'gitlab-list-commits',
- configured_props: {
- gitlab: { authProvisionId: 'apn_kVh9AoD' },
- projectId: 45672541,
- refName: 'main',
- },
-});
-```
-
-## Important removed functionality
-
-Some methods from v1.x have been removed or changed significantly in v2.x:
-
-1. **`deleteAccountsByApp()`** - This bulk deletion method is no longer
- available. You'll need to list accounts for an app and delete them
- individually.
-
-2. **`rawAccessToken()`** - Direct access token retrieval has been removed. The
- v2.x SDK manages OAuth tokens internally and doesn't expose them directly. If
- you need to make authenticated requests, use the built-in methods or the
- proxy namespace.
-
-3. **Alternative method names** - The v1.x SDK provided alternative method names
- (e.g., `actionRun()` as an alias for `runAction()`). These are no longer
- available in v2.x.
-
-4. **`userId` parameter** - The deprecated `userId` parameter has been removed.
- Always use `external_user_id` instead.
-
-## Migration checklist
-
-- [ ] Update import statements from `createBackendClient`/`createFrontendClient`
- to `PipedreamClient`.
-- [ ] Update client initialization to use `new PipedreamClient()` for both
- server-side and browser-side.
-- [ ] Convert all method calls to use namespaced format (e.g.,
- `client.actions.run()`).
-- [ ] Update all parameter names from camelCase to snake_case.
-- [ ] Pass `external_user_id` to methods instead of setting it on the client.
-- [ ] Update error handling to use `PipedreamError` type.
-- [ ] Review and implement new features like pagination and request options
- where beneficial.
-- [ ] Replace any usage of removed methods with their alternatives.
-- [ ] Update any code using `rawAccessToken()` to use the OAuth tokens
- namespace.
-- [ ] Test all migrated code thoroughly.
-- [ ] Remove the old SDK dependency once migration is complete.
diff --git a/package.json b/package.json
index 6a8c6e3..89d8150 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@pipedream/sdk",
- "version": "2.0.0-rc.1",
+ "version": "2.0.0",
"private": false,
"repository": "github:PipedreamHQ/pipedream-sdk-typescript",
"type": "commonjs",
@@ -39,17 +39,17 @@
"test:wire": "jest --selectProjects wire"
},
"devDependencies": {
+ "webpack": "^5.97.1",
+ "ts-loader": "^9.5.1",
+ "jest": "^29.7.0",
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.14",
- "@types/node": "^18.19.70",
- "jest": "^29.7.0",
+ "ts-jest": "^29.3.4",
"jest-environment-jsdom": "^29.7.0",
"msw": "^2.8.4",
+ "@types/node": "^18.19.70",
"prettier": "^3.4.2",
- "ts-jest": "^29.3.4",
- "ts-loader": "^9.5.1",
- "typescript": "~5.7.2",
- "webpack": "^5.97.1"
+ "typescript": "~5.7.2"
},
"browser": {
"fs": false,
diff --git a/reference.md b/reference.md
index 3ffa14e..9e65bab 100644
--- a/reference.md
+++ b/reference.md
@@ -2291,139 +2291,3 @@ await client.oauthTokens.create({
-
-## Workflows
-
-client.workflows.invoke({ ...params }, authType?) -> unknown
-
--
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```typescript
-// Invoke with URL
-await client.workflows.invoke({
- urlOrEndpoint: "https://en-your-endpoint.m.pipedream.net",
- body: {
- foo: 123,
- bar: "abc",
- baz: null,
- },
- headers: {
- Accept: "application/json",
- },
-});
-
-// Invoke with endpoint ID
-await client.workflows.invoke({
- urlOrEndpoint: "en123",
- body: {
- message: "Hello, World\!",
- },
-}, Pipedream.HTTPAuthType.OAuth);
-```
-
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**request:** `Pipedream.InvokeWorkflowOpts`
-
-
-
-
-
--
-
-**authType:** `Pipedream.HTTPAuthType` — The type of authorization to use for the request (defaults to None)
-
-
-
-
-
--
-
-**requestOptions:** `Workflows.RequestOptions`
-
-
-
-
-
-
-
-
-
-
-client.workflows.invokeForExternalUser({ ...params }) -> unknown
-
--
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```typescript
-await client.workflows.invokeForExternalUser({
- urlOrEndpoint: "https://your-workflow-url.m.pipedream.net",
- externalUserId: "your-external-user-id",
- body: {
- foo: 123,
- bar: "abc",
- baz: null,
- },
- headers: {
- Accept: "application/json",
- },
-});
-```
-
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**request:** `Pipedream.InvokeWorkflowForExternalUserOpts`
-
-
-
-
-
--
-
-**requestOptions:** `Workflows.RequestOptions`
-
-
-
-
-
-
-
-
-
diff --git a/src/Client.ts b/src/Client.ts
index 8a1fab1..1381475 100644
--- a/src/Client.ts
+++ b/src/Client.ts
@@ -51,7 +51,7 @@ export declare namespace PipedreamClient {
export class PipedreamClient {
protected readonly _options: PipedreamClient.Options;
- protected readonly _oauthTokenProvider: core.OAuthTokenProvider;
+ private readonly _oauthTokenProvider: core.OAuthTokenProvider;
protected _appCategories: AppCategories | undefined;
protected _apps: Apps | undefined;
protected _accounts: Accounts | undefined;
@@ -73,8 +73,8 @@ export class PipedreamClient {
"x-pd-environment": _options?.projectEnvironment,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@pipedream/sdk",
- "X-Fern-SDK-Version": "1.7.1",
- "User-Agent": "@pipedream/sdk/1.7.1",
+ "X-Fern-SDK-Version": "2.0.0",
+ "User-Agent": "@pipedream/sdk/2.0.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
diff --git a/src/api/resources/proxy/client/Client.ts b/src/api/resources/proxy/client/Client.ts
deleted file mode 100644
index a6122e5..0000000
--- a/src/api/resources/proxy/client/Client.ts
+++ /dev/null
@@ -1,516 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-import * as environments from "../../../../environments.js";
-import * as core from "../../../../core/index.js";
-import * as Pipedream from "../../../index.js";
-import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
-import * as errors from "../../../../errors/index.js";
-import { base64Encode } from "../../../../core/base64.js";
-
-export declare namespace Proxy {
- export interface Options {
- environment?: core.Supplier;
- /** Specify a custom URL to connect the client to. */
- baseUrl?: core.Supplier;
- projectId: string;
- token?: core.Supplier;
- /** Override the x-pd-environment header */
- projectEnvironment?: core.Supplier;
- /** Additional headers to include in requests. */
- headers?: Record | undefined>;
- }
-
- export interface RequestOptions {
- /** The maximum time to wait for a response in seconds. */
- timeoutInSeconds?: number;
- /** The number of times to retry the request. Defaults to 2. */
- maxRetries?: number;
- /** A hook to abort the request. */
- abortSignal?: AbortSignal;
- /** Override the x-pd-environment header */
- projectEnvironment?: Pipedream.ProjectEnvironment | undefined;
- /** Additional headers to include in the request. */
- headers?: Record | undefined>;
- }
-}
-
-export class Proxy {
- protected readonly _options: Proxy.Options;
-
- constructor(_options: Proxy.Options) {
- this._options = _options;
- }
-
- /**
- * Transform headers by prefixing each key with 'x-pd-proxy-'
- */
- private transformProxyHeaders(
- headers?: Record | undefined>,
- ): Record | undefined> | undefined {
- if (!headers) return undefined;
-
- const transformed: Record | undefined> = {};
- for (const [key, value] of Object.entries(headers)) {
- transformed[`x-pd-proxy-${key}`] = value;
- }
- return transformed;
- }
-
- /**
- * @param {Pipedream.ProxyGetRequest} request
- * @param {Proxy.RequestOptions} requestOptions - Request-specific configuration.
- *
- * @example
- * await client.proxy.get({
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * params: { key: "value" },
- * headers: { "X-Custom-Header": "value" }
- * })
- */
- public get(
- request: Pipedream.ProxyGetRequest,
- requestOptions?: Proxy.RequestOptions,
- ): core.HttpResponsePromise {
- return core.HttpResponsePromise.fromPromise(
- this.__get(request, requestOptions),
- );
- }
-
- private async __get(
- request: Pipedream.ProxyGetRequest,
- requestOptions?: Proxy.RequestOptions,
- ): Promise> {
- const { url, external_user_id: externalUserId, account_id: accountId, params, headers } = request;
- const url64 = base64Encode(url);
- const transformedHeaders = this.transformProxyHeaders(headers);
- const _queryParams: Record = {
- external_user_id: externalUserId,
- account_id: accountId,
- ...(params || {}),
- };
- const _response = await core.fetcher({
- url: core.url.join(
- (await core.Supplier.get(this._options.baseUrl)) ??
- (await core.Supplier.get(this._options.environment)) ??
- environments.PipedreamEnvironment.Prod,
- `v1/connect/${encodeURIComponent(this._options.projectId)}/proxy/${encodeURIComponent(url64)}`,
- ),
- method: "GET",
- headers: mergeHeaders(
- this._options?.headers,
- mergeOnlyDefinedHeaders({
- Authorization: await this._getAuthorizationHeader(),
- "x-pd-environment": requestOptions?.projectEnvironment,
- }),
- transformedHeaders,
- requestOptions?.headers,
- ),
- queryParameters: _queryParams,
- timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
- maxRetries: requestOptions?.maxRetries,
- abortSignal: requestOptions?.abortSignal,
- });
- if (_response.ok) {
- return { data: _response.body as Pipedream.ProxyResponse | undefined, rawResponse: _response.rawResponse };
- }
-
- if (_response.error.reason === "status-code") {
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.body,
- rawResponse: _response.rawResponse,
- });
- }
-
- switch (_response.error.reason) {
- case "non-json":
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.rawBody,
- rawResponse: _response.rawResponse,
- });
- case "timeout":
- throw new errors.PipedreamTimeoutError(
- "Timeout exceeded when calling GET /v1/connect/{project_id}/proxy/{url_64}.",
- );
- case "unknown":
- throw new errors.PipedreamError({
- message: _response.error.errorMessage,
- rawResponse: _response.rawResponse,
- });
- }
- }
-
- /**
- * @param {Pipedream.ProxyPostRequest} request
- * @param {Proxy.RequestOptions} requestOptions - Request-specific configuration.
- *
- * @example
- * await client.proxy.post({
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * body: { "key": "value" },
- * params: { key: "value" },
- * headers: { "X-Custom-Header": "value" }
- * })
- */
- public post(
- request: Pipedream.ProxyPostRequest,
- requestOptions?: Proxy.RequestOptions,
- ): core.HttpResponsePromise {
- return core.HttpResponsePromise.fromPromise(
- this.__post(request, requestOptions),
- );
- }
-
- private async __post(
- request: Pipedream.ProxyPostRequest,
- requestOptions?: Proxy.RequestOptions,
- ): Promise> {
- const { url, external_user_id: externalUserId, account_id: accountId, body, params, headers } = request;
- const url64 = base64Encode(url);
- const transformedHeaders = this.transformProxyHeaders(headers);
- const _queryParams: Record = {
- external_user_id: externalUserId,
- account_id: accountId,
- ...(params || {}),
- };
- const _response = await core.fetcher({
- url: core.url.join(
- (await core.Supplier.get(this._options.baseUrl)) ??
- (await core.Supplier.get(this._options.environment)) ??
- environments.PipedreamEnvironment.Prod,
- `v1/connect/${encodeURIComponent(this._options.projectId)}/proxy/${encodeURIComponent(url64)}`,
- ),
- method: "POST",
- headers: mergeHeaders(
- this._options?.headers,
- mergeOnlyDefinedHeaders({
- Authorization: await this._getAuthorizationHeader(),
- "x-pd-environment": requestOptions?.projectEnvironment,
- }),
- transformedHeaders,
- requestOptions?.headers,
- ),
- contentType: "application/json",
- queryParameters: _queryParams,
- requestType: "json",
- body,
- timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
- maxRetries: requestOptions?.maxRetries,
- abortSignal: requestOptions?.abortSignal,
- });
- if (_response.ok) {
- return { data: _response.body as Pipedream.ProxyResponse | undefined, rawResponse: _response.rawResponse };
- }
-
- if (_response.error.reason === "status-code") {
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.body,
- rawResponse: _response.rawResponse,
- });
- }
-
- switch (_response.error.reason) {
- case "non-json":
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.rawBody,
- rawResponse: _response.rawResponse,
- });
- case "timeout":
- throw new errors.PipedreamTimeoutError(
- "Timeout exceeded when calling POST /v1/connect/{project_id}/proxy/{url_64}.",
- );
- case "unknown":
- throw new errors.PipedreamError({
- message: _response.error.errorMessage,
- rawResponse: _response.rawResponse,
- });
- }
- }
-
- /**
- * @param {Pipedream.ProxyPutRequest} request
- * @param {Proxy.RequestOptions} requestOptions - Request-specific configuration.
- *
- * @example
- * await client.proxy.put({
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * body: { "key": "value" },
- * params: { key: "value" },
- * headers: { "X-Custom-Header": "value" }
- * })
- */
- public put(
- request: Pipedream.ProxyPutRequest,
- requestOptions?: Proxy.RequestOptions,
- ): core.HttpResponsePromise {
- return core.HttpResponsePromise.fromPromise(
- this.__put(request, requestOptions),
- );
- }
-
- private async __put(
- request: Pipedream.ProxyPutRequest,
- requestOptions?: Proxy.RequestOptions,
- ): Promise> {
- const { url, external_user_id: externalUserId, account_id: accountId, body, params, headers } = request;
- const url64 = base64Encode(url);
- const transformedHeaders = this.transformProxyHeaders(headers);
- const _queryParams: Record = {
- external_user_id: externalUserId,
- account_id: accountId,
- ...(params || {}),
- };
- const _response = await core.fetcher({
- url: core.url.join(
- (await core.Supplier.get(this._options.baseUrl)) ??
- (await core.Supplier.get(this._options.environment)) ??
- environments.PipedreamEnvironment.Prod,
- `v1/connect/${encodeURIComponent(this._options.projectId)}/proxy/${encodeURIComponent(url64)}`,
- ),
- method: "PUT",
- headers: mergeHeaders(
- this._options?.headers,
- mergeOnlyDefinedHeaders({
- Authorization: await this._getAuthorizationHeader(),
- "x-pd-environment": requestOptions?.projectEnvironment,
- }),
- transformedHeaders,
- requestOptions?.headers,
- ),
- contentType: "application/json",
- queryParameters: _queryParams,
- requestType: "json",
- body,
- timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
- maxRetries: requestOptions?.maxRetries,
- abortSignal: requestOptions?.abortSignal,
- });
- if (_response.ok) {
- return { data: _response.body as Pipedream.ProxyResponse | undefined, rawResponse: _response.rawResponse };
- }
-
- if (_response.error.reason === "status-code") {
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.body,
- rawResponse: _response.rawResponse,
- });
- }
-
- switch (_response.error.reason) {
- case "non-json":
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.rawBody,
- rawResponse: _response.rawResponse,
- });
- case "timeout":
- throw new errors.PipedreamTimeoutError(
- "Timeout exceeded when calling PUT /v1/connect/{project_id}/proxy/{url_64}.",
- );
- case "unknown":
- throw new errors.PipedreamError({
- message: _response.error.errorMessage,
- rawResponse: _response.rawResponse,
- });
- }
- }
-
- /**
- * @param {Pipedream.ProxyDeleteRequest} request
- * @param {Proxy.RequestOptions} requestOptions - Request-specific configuration.
- *
- * @example
- * await client.proxy.delete({
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * params: { key: "value" },
- * headers: { "X-Custom-Header": "value" }
- * })
- */
- public delete(
- request: Pipedream.ProxyDeleteRequest,
- requestOptions?: Proxy.RequestOptions,
- ): core.HttpResponsePromise {
- return core.HttpResponsePromise.fromPromise(
- this.__delete(request, requestOptions),
- );
- }
-
- private async __delete(
- request: Pipedream.ProxyDeleteRequest,
- requestOptions?: Proxy.RequestOptions,
- ): Promise> {
- const { url, external_user_id: externalUserId, account_id: accountId, params, headers } = request;
- const url64 = base64Encode(url);
- const transformedHeaders = this.transformProxyHeaders(headers);
- const _queryParams: Record = {
- external_user_id: externalUserId,
- account_id: accountId,
- ...(params || {}),
- };
- const _response = await core.fetcher({
- url: core.url.join(
- (await core.Supplier.get(this._options.baseUrl)) ??
- (await core.Supplier.get(this._options.environment)) ??
- environments.PipedreamEnvironment.Prod,
- `v1/connect/${encodeURIComponent(this._options.projectId)}/proxy/${encodeURIComponent(url64)}`,
- ),
- method: "DELETE",
- headers: mergeHeaders(
- this._options?.headers,
- mergeOnlyDefinedHeaders({
- Authorization: await this._getAuthorizationHeader(),
- "x-pd-environment": requestOptions?.projectEnvironment,
- }),
- transformedHeaders,
- requestOptions?.headers,
- ),
- queryParameters: _queryParams,
- timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
- maxRetries: requestOptions?.maxRetries,
- abortSignal: requestOptions?.abortSignal,
- });
- if (_response.ok) {
- return { data: _response.body as Pipedream.ProxyResponse | undefined, rawResponse: _response.rawResponse };
- }
-
- if (_response.error.reason === "status-code") {
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.body,
- rawResponse: _response.rawResponse,
- });
- }
-
- switch (_response.error.reason) {
- case "non-json":
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.rawBody,
- rawResponse: _response.rawResponse,
- });
- case "timeout":
- throw new errors.PipedreamTimeoutError(
- "Timeout exceeded when calling DELETE /v1/connect/{project_id}/proxy/{url_64}.",
- );
- case "unknown":
- throw new errors.PipedreamError({
- message: _response.error.errorMessage,
- rawResponse: _response.rawResponse,
- });
- }
- }
-
- /**
- * @param {Pipedream.ProxyPatchRequest} request
- * @param {Proxy.RequestOptions} requestOptions - Request-specific configuration.
- *
- * @example
- * await client.proxy.patch({
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * body: { "key": "value" },
- * params: { key: "value" },
- * headers: { "X-Custom-Header": "value" }
- * })
- */
- public patch(
- request: Pipedream.ProxyPatchRequest,
- requestOptions?: Proxy.RequestOptions,
- ): core.HttpResponsePromise {
- return core.HttpResponsePromise.fromPromise(
- this.__patch(request, requestOptions),
- );
- }
-
- private async __patch(
- request: Pipedream.ProxyPatchRequest,
- requestOptions?: Proxy.RequestOptions,
- ): Promise> {
- const { url, external_user_id: externalUserId, account_id: accountId, body, params, headers } = request;
- const url64 = base64Encode(url);
- const transformedHeaders = this.transformProxyHeaders(headers);
- const _queryParams: Record = {
- external_user_id: externalUserId,
- account_id: accountId,
- ...(params || {}),
- };
- const _response = await core.fetcher({
- url: core.url.join(
- (await core.Supplier.get(this._options.baseUrl)) ??
- (await core.Supplier.get(this._options.environment)) ??
- environments.PipedreamEnvironment.Prod,
- `v1/connect/${encodeURIComponent(this._options.projectId)}/proxy/${encodeURIComponent(url64)}`,
- ),
- method: "PATCH",
- headers: mergeHeaders(
- this._options?.headers,
- mergeOnlyDefinedHeaders({
- Authorization: await this._getAuthorizationHeader(),
- "x-pd-environment": requestOptions?.projectEnvironment,
- }),
- transformedHeaders,
- requestOptions?.headers,
- ),
- contentType: "application/json",
- queryParameters: _queryParams,
- requestType: "json",
- body,
- timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
- maxRetries: requestOptions?.maxRetries,
- abortSignal: requestOptions?.abortSignal,
- });
- if (_response.ok) {
- return { data: _response.body as Pipedream.ProxyResponse | undefined, rawResponse: _response.rawResponse };
- }
-
- if (_response.error.reason === "status-code") {
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.body,
- rawResponse: _response.rawResponse,
- });
- }
-
- switch (_response.error.reason) {
- case "non-json":
- throw new errors.PipedreamError({
- statusCode: _response.error.statusCode,
- body: _response.error.rawBody,
- rawResponse: _response.rawResponse,
- });
- case "timeout":
- throw new errors.PipedreamTimeoutError(
- "Timeout exceeded when calling PATCH /v1/connect/{project_id}/proxy/{url_64}.",
- );
- case "unknown":
- throw new errors.PipedreamError({
- message: _response.error.errorMessage,
- rawResponse: _response.rawResponse,
- });
- }
- }
-
- protected async _getAuthorizationHeader(): Promise {
- const bearer = await core.Supplier.get(this._options.token);
- if (bearer != null) {
- return `Bearer ${bearer}`;
- }
-
- return undefined;
- }
-}
diff --git a/src/api/resources/proxy/client/index.ts b/src/api/resources/proxy/client/index.ts
deleted file mode 100644
index 82648c6..0000000
--- a/src/api/resources/proxy/client/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export {};
-export * from "./requests/index.js";
diff --git a/src/api/resources/proxy/client/requests/ProxyDeleteRequest.ts b/src/api/resources/proxy/client/requests/ProxyDeleteRequest.ts
deleted file mode 100644
index 2cf5b6c..0000000
--- a/src/api/resources/proxy/client/requests/ProxyDeleteRequest.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-import * as core from "../../../../../core/index.js";
-
-/**
- * @example
- * {
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * params: { page: "1", limit: "10" },
- * headers: { "X-Custom-Header": "value" }
- * }
- */
-export interface ProxyDeleteRequest {
- /**
- * Target URL to proxy request to
- */
- url: string;
- /**
- * The external user ID for the proxy request
- */
- external_user_id: string;
- /**
- * The account ID to use for authentication
- */
- account_id: string;
- /**
- * Query parameters to forward
- */
- params?: Record;
- /**
- * Additional headers to include (will be prefixed with 'x-pd-proxy-')
- */
- headers?: Record | undefined>;
-}
diff --git a/src/api/resources/proxy/client/requests/ProxyGetRequest.ts b/src/api/resources/proxy/client/requests/ProxyGetRequest.ts
deleted file mode 100644
index 23edd10..0000000
--- a/src/api/resources/proxy/client/requests/ProxyGetRequest.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-import * as core from "../../../../../core/index.js";
-
-/**
- * @example
- * {
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * params: { page: "1", limit: "10" },
- * headers: { "X-Custom-Header": "value" }
- * }
- */
-export interface ProxyGetRequest {
- /**
- * Target URL to proxy request to
- */
- url: string;
- /**
- * The external user ID for the proxy request
- */
- external_user_id: string;
- /**
- * The account ID to use for authentication
- */
- account_id: string;
- /**
- * Query parameters to forward
- */
- params?: Record;
- /**
- * Additional headers to include (will be prefixed with 'x-pd-proxy-')
- */
- headers?: Record | undefined>;
-}
diff --git a/src/api/resources/proxy/client/requests/ProxyPatchRequest.ts b/src/api/resources/proxy/client/requests/ProxyPatchRequest.ts
deleted file mode 100644
index a98fe67..0000000
--- a/src/api/resources/proxy/client/requests/ProxyPatchRequest.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-import * as core from "../../../../../core/index.js";
-
-/**
- * @example
- * {
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * body: {
- * "key": "value"
- * },
- * params: { page: "1", limit: "10" },
- * headers: { "X-Custom-Header": "value" }
- * }
- */
-export interface ProxyPatchRequest {
- /**
- * Target URL to proxy request to
- */
- url: string;
- /**
- * The external user ID for the proxy request
- */
- external_user_id: string;
- /**
- * The account ID to use for authentication
- */
- account_id: string;
- /**
- * Request body to forward to the target API
- */
- body: Record;
- /**
- * Query parameters to forward
- */
- params?: Record;
- /**
- * Additional headers to include (will be prefixed with 'x-pd-proxy-')
- */
- headers?: Record | undefined>;
-}
diff --git a/src/api/resources/proxy/client/requests/ProxyPostRequest.ts b/src/api/resources/proxy/client/requests/ProxyPostRequest.ts
deleted file mode 100644
index c9bb93c..0000000
--- a/src/api/resources/proxy/client/requests/ProxyPostRequest.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-import * as core from "../../../../../core/index.js";
-
-/**
- * @example
- * {
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * body: {
- * "key": "value"
- * },
- * params: { page: "1", limit: "10" },
- * headers: { "X-Custom-Header": "value" }
- * }
- */
-export interface ProxyPostRequest {
- /**
- * Target URL to proxy request to
- */
- url: string;
- /**
- * The external user ID for the proxy request
- */
- external_user_id: string;
- /**
- * The account ID to use for authentication
- */
- account_id: string;
- /**
- * Request body to forward to the target API
- */
- body: Record;
- /**
- * Query parameters to forward
- */
- params?: Record;
- /**
- * Additional headers to include (will be prefixed with 'x-pd-proxy-')
- */
- headers?: Record | undefined>;
-}
diff --git a/src/api/resources/proxy/client/requests/ProxyPutRequest.ts b/src/api/resources/proxy/client/requests/ProxyPutRequest.ts
deleted file mode 100644
index e512b37..0000000
--- a/src/api/resources/proxy/client/requests/ProxyPutRequest.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-import * as core from "../../../../../core/index.js";
-
-/**
- * @example
- * {
- * url: "https://api.example.com/endpoint",
- * external_user_id: "external_user_id",
- * account_id: "account_id",
- * body: {
- * "key": "value"
- * },
- * params: { page: "1", limit: "10" },
- * headers: { "X-Custom-Header": "value" }
- * }
- */
-export interface ProxyPutRequest {
- /**
- * Target URL to proxy request to
- */
- url: string;
- /**
- * The external user ID for the proxy request
- */
- external_user_id: string;
- /**
- * The account ID to use for authentication
- */
- account_id: string;
- /**
- * Request body to forward to the target API
- */
- body: Record;
- /**
- * Query parameters to forward
- */
- params?: Record;
- /**
- * Additional headers to include (will be prefixed with 'x-pd-proxy-')
- */
- headers?: Record | undefined>;
-}
diff --git a/src/api/resources/proxy/client/requests/index.ts b/src/api/resources/proxy/client/requests/index.ts
deleted file mode 100644
index 488c80f..0000000
--- a/src/api/resources/proxy/client/requests/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export { type ProxyGetRequest } from "./ProxyGetRequest.js";
-export { type ProxyPostRequest } from "./ProxyPostRequest.js";
-export { type ProxyPutRequest } from "./ProxyPutRequest.js";
-export { type ProxyDeleteRequest } from "./ProxyDeleteRequest.js";
-export { type ProxyPatchRequest } from "./ProxyPatchRequest.js";
diff --git a/src/api/resources/workflows/client/Client.ts b/src/api/resources/workflows/client/Client.ts
deleted file mode 100644
index be17955..0000000
--- a/src/api/resources/workflows/client/Client.ts
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-import * as environments from "../../../../environments.js";
-import * as core from "../../../../core/index.js";
-import * as Pipedream from "../../../index.js";
-import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
-import * as errors from "../../../../errors/index.js";
-
-export declare namespace Workflows {
- export interface Options {
- environment?: core.Supplier;
- /** Specify a custom URL to connect the client to. */
- baseUrl?: core.Supplier;
- projectId: string;
- token?: core.Supplier;
- /** Override the x-pd-environment header */
- projectEnvironment?: core.Supplier;
- /** Additional headers to include in requests. */
- headers?: Record | undefined>;
- /** Base domain for workflows. Used for custom domains. */
- workflowDomain?: string;
- }
-
- export interface RequestOptions {
- /** The maximum time to wait for a response in seconds. */
- timeoutInSeconds?: number;
- /** The number of times to retry the request. Defaults to 2. */
- maxRetries?: number;
- /** A hook to abort the request. */
- abortSignal?: AbortSignal;
- /** Override the x-pd-environment header */
- projectEnvironment?: Pipedream.ProjectEnvironment | undefined;
- /** Additional query string parameters to include in the request. */
- queryParams?: Record;
- /** Additional headers to include in the request. */
- headers?: Record | undefined>;
- }
-}
-
-export class Workflows {
- protected readonly _options: Workflows.Options;
- private readonly workflowDomain: string;
-
- constructor(_options: Workflows.Options) {
- this._options = _options;
- this.workflowDomain = _options.workflowDomain ?? this._defaultWorkflowDomain;
- }
-
- private get _defaultWorkflowDomain(): string {
- return this._options.environment !== environments.PipedreamEnvironment.Prod &&
- this._options.environment !== environments.PipedreamEnvironment.Canary
- ? "m.d.pipedream.net"
- : "m.pipedream.net";
- }
-
- private get _urlProtocol(): string {
- return this._options.environment !== environments.PipedreamEnvironment.Prod &&
- this._options.environment !== environments.PipedreamEnvironment.Canary
- ? "http"
- : "https";
- }
-
- /**
- * Invokes a workflow using the URL of its HTTP interface(s), by sending an
- * HTTP request.
- *
- * @param {Pipedream.InvokeWorkflowOpts} request
- * @param {Pipedream.HTTPAuthType} authType - The type of authorization to use
- * for the request (defaults to None).
- * @param {Workflows.RequestOptions} requestOptions - Request-specific
- * configuration.
- *
- * @example
- * await client.workflows.invoke({
- * urlOrEndpoint: "https://en-your-endpoint.m.pipedream.net",
- * body: {
- * foo: 123,
- * bar: "abc",
- * baz: null
- * },
- * headers: {
- * "Accept": "application/json"
- * }
- * }, Pipedream.HTTPAuthType.OAuth)
- */
- public invoke(
- request: Pipedream.InvokeWorkflowOpts,
- authType: Pipedream.HTTPAuthType = Pipedream.HTTPAuthType.None,
- requestOptions?: Workflows.RequestOptions,
- ): core.HttpResponsePromise {
- return core.HttpResponsePromise.fromPromise(this.__invoke(request, authType, requestOptions));
- }
-
- private async __invoke(
- request: Pipedream.InvokeWorkflowOpts,
- authType: Pipedream.HTTPAuthType = Pipedream.HTTPAuthType.None,
- requestOptions?: Workflows.RequestOptions,
- ): Promise> {
- const { urlOrEndpoint, body, method = "POST", headers = {} } = request;
-
- const url = this._buildWorkflowUrl(urlOrEndpoint);
-
- let authHeader: string | undefined;
- switch (authType) {
- case Pipedream.HTTPAuthType.StaticBearer:
- // It's expected that users will pass their own Authorization header in
- // the static bearer case
- authHeader = headers["Authorization"];
- break;
- case Pipedream.HTTPAuthType.OAuth:
- authHeader = await this._getAuthorizationHeader();
- break;
- default:
- break;
- }
-
- const _response = await core.fetcher({
- url,
- method: method.toUpperCase(),
- headers: mergeHeaders(
- this._options?.headers,
- mergeOnlyDefinedHeaders({
- Authorization: authHeader,
- "x-pd-environment": requestOptions?.projectEnvironment,
- }),
- headers,
- requestOptions?.headers,
- ),
- contentType: body != null ? "application/json" : undefined,
- queryParameters: requestOptions?.queryParams,
- requestType: body != null ? "json" : undefined,
- body,
- timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
- maxRetries: requestOptions?.maxRetries,
- abortSignal: requestOptions?.abortSignal,
- });
-
- if (!_response.ok) {
- throw new errors.PipedreamError({
- message: _response.error.reason,
- statusCode: _response.rawResponse.status,
- rawResponse: _response.rawResponse,
- });
- }
-
- return {
- data: _response.rawResponse,
- rawResponse: _response.rawResponse,
- };
- }
-
- /**
- * Invokes a workflow for a Pipedream Connect user in a project.
- *
- * @param {Pipedream.InvokeWorkflowForExternalUserOpts} request
- * @param {Workflows.RequestOptions} requestOptions - Request-specific
- * configuration.
- *
- * @example
- * await client.workflows.invokeForExternalUser({
- * urlOrEndpoint: "https://your-workflow-url.m.pipedream.net",
- * externalUserId: "your-external-user-id",
- * body: {
- * foo: 123,
- * bar: "abc",
- * baz: null
- * },
- * headers: {
- * "Accept": "application/json"
- * }
- * })
- */
- public invokeForExternalUser(
- request: Pipedream.InvokeWorkflowForExternalUserOpts,
- requestOptions?: Workflows.RequestOptions,
- ): core.HttpResponsePromise {
- return core.HttpResponsePromise.fromPromise(this.__invokeForExternalUser(request, requestOptions));
- }
-
- private async __invokeForExternalUser(
- request: Pipedream.InvokeWorkflowForExternalUserOpts,
- requestOptions?: Workflows.RequestOptions,
- ): Promise> {
- const { urlOrEndpoint, externalUserId, body, method, headers = {} } = request;
-
- if (!externalUserId?.trim()) {
- throw new Error("External user ID is required");
- }
-
- if (!urlOrEndpoint.trim()) {
- throw new Error("Workflow URL or endpoint ID is required");
- }
-
- const authHeader = await this._getAuthorizationHeader();
- if (!authHeader) {
- throw new Error(
- "OAuth or token is required for invoking workflows for external users. Please pass credentials for a valid OAuth client",
- );
- }
-
- // Delegate to invoke method with external user ID header and OAuth auth
- return this.__invoke(
- {
- urlOrEndpoint,
- body,
- method,
- headers: {
- ...headers,
- "X-PD-External-User-ID": externalUserId,
- },
- },
- Pipedream.HTTPAuthType.OAuth,
- requestOptions,
- );
- }
-
- /**
- * Builds a full workflow URL based on the input.
- *
- * @param input - Either a full URL (with or without protocol) or just an
- * endpoint ID.
- * @returns The fully constructed URL.
- * @throws If the input is a malformed URL, throws an error with a clear
- * message.
- */
- private _buildWorkflowUrl(input: string): string {
- const sanitizedInput = input
- .trim()
- .replace(/[^\w-./:]/g, "")
- .toLowerCase();
- if (!sanitizedInput) {
- throw new Error("URL or endpoint ID is required");
- }
-
- let url: string;
- const isUrl = sanitizedInput.includes(".") || sanitizedInput.startsWith("http");
-
- if (isUrl) {
- // Try to parse the input as a URL
- let parsedUrl: URL;
- try {
- const urlString = sanitizedInput.startsWith("http") ? sanitizedInput : `https://${sanitizedInput}`;
- parsedUrl = new URL(urlString);
- } catch {
- throw new Error(`The provided URL is malformed: "${sanitizedInput}". Please provide a valid URL.`);
- }
-
- // Validate the hostname to prevent potential DNS rebinding attacks
- if (!parsedUrl.hostname.endsWith(this.workflowDomain)) {
- throw new Error(`Invalid workflow domain. URL must end with ${this.workflowDomain}`);
- }
-
- url = parsedUrl.href;
- } else {
- // If the input is an ID, construct the full URL using the base domain
- if (!/^e(n|o)[a-z0-9-]+$/i.test(sanitizedInput)) {
- throw new Error(
- `Invalid endpoint ID format. Must contain only letters, numbers, and hyphens, and start with either "en" or "eo".`,
- );
- }
-
- url = `${this._urlProtocol}://${sanitizedInput}.${this.workflowDomain}`;
- }
-
- return url;
- }
-
- protected async _getAuthorizationHeader(): Promise {
- const bearer = await core.Supplier.get(this._options.token);
- if (bearer != null) {
- return `Bearer ${bearer}`;
- }
-
- return undefined;
- }
-}
diff --git a/src/api/resources/workflows/client/index.ts b/src/api/resources/workflows/client/index.ts
deleted file mode 100644
index 10df5b2..0000000
--- a/src/api/resources/workflows/client/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from "./Client.js";
-export * from "./requests/index.js";
diff --git a/src/api/resources/workflows/client/requests/InvokeWorkflowForExternalUserOpts.ts b/src/api/resources/workflows/client/requests/InvokeWorkflowForExternalUserOpts.ts
deleted file mode 100644
index c05b417..0000000
--- a/src/api/resources/workflows/client/requests/InvokeWorkflowForExternalUserOpts.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-export interface InvokeWorkflowForExternalUserOpts {
- /**
- * The URL of the workflow's HTTP interface, or the ID of the endpoint.
- */
- urlOrEndpoint: string;
- /**
- * Your end user ID, for whom you're invoking the workflow.
- */
- externalUserId: string;
- /**
- * The body of the request. It must be a JSON-serializable value (e.g. an object, null, a string, etc.).
- */
- body?: unknown;
- /**
- * HTTP method to use for the request (defaults to POST if not specified).
- */
- method?: string;
- /**
- * Additional headers to include in the request.
- */
- headers?: Record;
-}
diff --git a/src/api/resources/workflows/client/requests/InvokeWorkflowOpts.ts b/src/api/resources/workflows/client/requests/InvokeWorkflowOpts.ts
deleted file mode 100644
index 570df77..0000000
--- a/src/api/resources/workflows/client/requests/InvokeWorkflowOpts.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-export interface InvokeWorkflowOpts {
- /**
- * The URL of the workflow's HTTP interface, or the ID of the endpoint.
- */
- urlOrEndpoint: string;
- /**
- * The body of the request. It must be a JSON-serializable value (e.g. an object, null, a string, etc.).
- */
- body?: unknown;
- /**
- * HTTP method to use for the request (defaults to POST if not specified).
- */
- method?: string;
- /**
- * Additional headers to include in the request.
- */
- headers?: Record;
-}
diff --git a/src/api/resources/workflows/client/requests/index.ts b/src/api/resources/workflows/client/requests/index.ts
deleted file mode 100644
index 99a5d0a..0000000
--- a/src/api/resources/workflows/client/requests/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { type InvokeWorkflowOpts } from "./InvokeWorkflowOpts.js";
-export { type InvokeWorkflowForExternalUserOpts } from "./InvokeWorkflowForExternalUserOpts.js";
diff --git a/src/api/resources/workflows/index.ts b/src/api/resources/workflows/index.ts
deleted file mode 100644
index 914b8c3..0000000
--- a/src/api/resources/workflows/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./client/index.js";
diff --git a/src/api/types/HTTPAuthType.ts b/src/api/types/HTTPAuthType.ts
deleted file mode 100644
index 5cf0500..0000000
--- a/src/api/types/HTTPAuthType.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-
-/**
- * Different ways in which customers can authorize requests to HTTP endpoints
- */
-export enum HTTPAuthType {
- None = "none",
- StaticBearer = "static_bearer_token",
- OAuth = "oauth",
-}
diff --git a/src/version.ts b/src/version.ts
index 6aae179..478f50d 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const SDK_VERSION = "1.7.1";
+export const SDK_VERSION = "2.0.0";
diff --git a/yarn.lock b/yarn.lock
index adbe087..a994278 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -575,9 +575,9 @@
"@jridgewell/sourcemap-codec" "^1.4.14"
"@mswjs/interceptors@^0.39.1":
- version "0.39.3"
- resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.39.3.tgz#d27886db295c9a7dbc41aa229a644bc7bbb04723"
- integrity sha512-9bw/wBL7pblsnOCIqvn1788S9o4h+cC5HWXg0Xhh0dOzsZ53IyfmBM+FYqpDDPbm0xjCqEqvCITloF3Dm4TXRQ==
+ version "0.39.5"
+ resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.39.5.tgz#6f0571493bf76291a60b62234ed0add2c4bd970e"
+ integrity sha512-B9nHSJYtsv79uo7QdkZ/b/WoKm20IkVSmTc/WCKarmDtFwM0dRx2ouEniqwNkzCSLn3fydzKmnMzjtfdOWt3VQ==
dependencies:
"@open-draft/deferred-promise" "^2.2.0"
"@open-draft/logger" "^0.3.0"
@@ -743,9 +743,9 @@
undici-types "~7.8.0"
"@types/node@^18.19.70":
- version "18.19.120"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.120.tgz#07b3bd73875956d5281fa27e6d77a66415f7d455"
- integrity sha512-WtCGHFXnVI8WHLxDAt5TbnCM4eSE+nI0QN2NJtwzcgMhht2eNz6V9evJrk+lwC8bCY8OWV5Ym8Jz7ZEyGnKnMA==
+ version "18.19.121"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.121.tgz#c50d353ea2d1fb1261a8bbd0bf2850306f5af2b3"
+ integrity sha512-bHOrbyztmyYIi4f1R0s17QsPs1uyyYnGcXeZoGEd227oZjry0q6XQBQxd82X1I57zEfwO8h9Xo+Kl5gX1d9MwQ==
dependencies:
undici-types "~5.26.4"
@@ -1052,9 +1052,9 @@ babel-plugin-jest-hoist@^29.6.3:
"@types/babel__traverse" "^7.0.6"
babel-preset-current-node-syntax@^1.0.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30"
- integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz#20730d6cdc7dda5d89401cab10ac6a32067acde6"
+ integrity sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==
dependencies:
"@babel/plugin-syntax-async-generators" "^7.8.4"
"@babel/plugin-syntax-bigint" "^7.8.3"
@@ -1160,9 +1160,9 @@ camelcase@^6.2.0:
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
caniuse-lite@^1.0.30001726:
- version "1.0.30001727"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz#22e9706422ad37aa50556af8c10e40e2d93a8b85"
- integrity sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==
+ version "1.0.30001731"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001731.tgz#277c07416ea4613ec564e5b0ffb47e7b60f32e2f"
+ integrity sha512-lDdp2/wrOmTRWuoB5DpfNkC0rJDU8DqRa6nYL6HK6sytw70QMopt/NIc/9SM7ylItlBWfACXk0tEn37UWM/+mg==
chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0:
version "4.1.2"
@@ -1364,9 +1364,9 @@ ejs@^3.1.10:
jake "^10.8.5"
electron-to-chromium@^1.5.173:
- version "1.5.191"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.191.tgz#8ae49a471447b1ceaf1d4d183a9000082f52363c"
- integrity sha512-xcwe9ELcuxYLUFqZZxL19Z6HVKcvNkIwhbHUz7L3us6u12yR+7uY89dSl570f/IqNthx8dAw3tojG7i4Ni4tDA==
+ version "1.5.192"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.192.tgz#6dfc57a41846a57b18f9c0121821a6df1e165cc1"
+ integrity sha512-rP8Ez0w7UNw/9j5eSXCe10o1g/8B1P5SM90PCCMVkIRQn2R0LEHWz4Eh9RnxkniuDe1W0cTSOB3MLlkTGDcuCg==
emittery@^0.13.1:
version "0.13.1"
@@ -2494,9 +2494,9 @@ npm-run-path@^4.0.1:
path-key "^3.0.0"
nwsapi@^2.2.2:
- version "2.2.20"
- resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.20.tgz#22e53253c61e7b0e7e93cef42c891154bcca11ef"
- integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==
+ version "2.2.21"
+ resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.21.tgz#8df7797079350adda208910d8c33fc4c2d7520c3"
+ integrity sha512-o6nIY3qwiSXl7/LuOU0Dmuctd34Yay0yeuZRLFmDPrrdHpXKFndPj3hM+YEPVHYC5fx2otBx4Ilc/gyYSAUaIA==
once@^1.3.0:
version "1.4.0"
@@ -3074,9 +3074,9 @@ webpack-sources@^3.3.3:
integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==
webpack@^5.97.1:
- version "5.100.2"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.100.2.tgz#e2341facf9f7de1d702147c91bcb65b693adf9e8"
- integrity sha512-QaNKAvGCDRh3wW1dsDjeMdDXwZm2vqq3zn6Pvq4rHOEOGSaUMgOOjG2Y9ZbIGzpfkJk9ZYTHpDqgDfeBDcnLaw==
+ version "5.101.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.101.0.tgz#4b81407ffad9857f81ff03f872e3369b9198cc9d"
+ integrity sha512-B4t+nJqytPeuZlHuIKTbalhljIFXeNRqrUGAQgTGlfOl2lXXKXw+yZu6bicycP+PUlM44CxBjCFD6aciKFT3LQ==
dependencies:
"@types/eslint-scope" "^3.7.7"
"@types/estree" "^1.0.8"