diff --git a/docs-v2/pages/connect/api.mdx b/docs-v2/pages/connect/api.mdx index bf3e90b1e7b10..5408e2867f668 100644 --- a/docs-v2/pages/connect/api.mdx +++ b/docs-v2/pages/connect/api.mdx @@ -36,7 +36,7 @@ You can also load the client-side SDK via ` + ``` ## Authentication @@ -50,7 +50,7 @@ Most of your interactions with the Connect API will happen on the server, to pro [Create a Pipedream OAuth client](/rest-api/auth#oauth) and instantiate the SDK with your client ID and secret: ```typescript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const pd = createBackendClient({ @@ -73,7 +73,7 @@ You'll primarily use the browser SDK to let your users securely connect apps fro Here's a Next.js example [from our quickstart](/connect/quickstart): ```typescript -import { createFrontendClient } from "@pipedream/sdk" +import { createFrontendClient } from "@pipedream/sdk/browser" // Example from our Next.js app import { serverConnectTokenCreate } from "./server" @@ -109,7 +109,7 @@ Some API endpoints accept an [environment](/connect/environments) parameter. Thi Always set the environment when you create the SDK client: ```typescript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -211,7 +211,7 @@ import { type ConnectAPIResponse, type ConnectTokenCreateOpts, type ConnectTokenResponse, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -230,7 +230,7 @@ const { token, expires_at } = await pd.createConnectToken({ ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -320,7 +320,7 @@ Pass `include_credentials=true` as a query-string parameter to include the accou ```typescript import { createBackendClient, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -341,7 +341,7 @@ const accounts = await pd.getAccounts({ ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -488,7 +488,7 @@ Pass `include_credentials=true` as a query-string parameter to include the accou ```typescript import { createBackendClient, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -509,7 +509,7 @@ const account = await pd.getAccountById(accountId, { ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -632,7 +632,7 @@ DELETE /{project_id}/accounts/{account_id} ```typescript import { createBackendClient, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -650,7 +650,7 @@ await pd.deleteAccount(accountId); ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -716,7 +716,7 @@ The app ID for which you want to delete all connected accounts. `app_id` can be ```typescript import { createBackendClient, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -734,7 +734,7 @@ await pd.deleteAccountsByApp(appId); ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -800,7 +800,7 @@ DELETE /{project_id}/users/{external_user_id} ```typescript import { createBackendClient, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -818,7 +818,7 @@ console.log("All accounts associated with the external ID have been deleted."); ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -880,7 +880,7 @@ GET /{project_id}/info ```typescript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -898,7 +898,7 @@ const info = await pd.getProjectInfo({ ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production diff --git a/docs-v2/pages/connect/environments.mdx b/docs-v2/pages/connect/environments.mdx index 1833ab99aac06..aefe5b1e79c15 100644 --- a/docs-v2/pages/connect/environments.mdx +++ b/docs-v2/pages/connect/environments.mdx @@ -14,7 +14,7 @@ You specify the environment when [creating a new Connect token](/connect/api/#cr Always set the environment when you create the SDK client: ```typescript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production diff --git a/docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx b/docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx index 77d25cde30f8a..5a08587603636 100644 --- a/docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx +++ b/docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx @@ -32,7 +32,7 @@ Change the `@pipedream/sdk` version in your `package.json`: ```json { "dependencies": { - "@pipedream/sdk": "1.0.0" + "@pipedream/sdk": "^1.0.0" } } ``` @@ -59,7 +59,7 @@ You'll need to make two changes to your frontend client code: 2. Change the `createClient` method to `createFrontendClient`. ```typescript -import { createFrontendClient } from "@pipedream/sdk" +import { createFrontendClient } from "@pipedream/sdk/browser" const pd = createFrontendClient() ``` @@ -74,7 +74,7 @@ You'll need to make three changes to your backend code: ```typescript -import { createBackendClient, HTTPAuthType } from "@pipedream/sdk"; +import { createBackendClient, HTTPAuthType } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const pd = createBackendClient({ @@ -87,7 +87,7 @@ const pd = createBackendClient({ ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const pd = createBackendClient({ diff --git a/docs-v2/pages/connect/quickstart.mdx b/docs-v2/pages/connect/quickstart.mdx index c37f30e755ff0..928344d1d47fd 100644 --- a/docs-v2/pages/connect/quickstart.mdx +++ b/docs-v2/pages/connect/quickstart.mdx @@ -119,7 +119,7 @@ In our example, `app/page.tsx` calls the `connectAccount` method from the Pipedr Connect your account button ```typescript -import { createFrontendClient } from "@pipedream/sdk" +import { createFrontendClient } from "@pipedream/sdk/browser" export default function Home() { const pd = createFrontendClient() @@ -171,7 +171,7 @@ This example shows you how to fetch credentials by your end user's `external_use ```typescript import { createBackendClient, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production @@ -197,7 +197,7 @@ async function getUserAccounts(external_user_id: string, include_credentials: bo ```javascript import { createBackendClient, -} from "@pipedream/sdk"; +} from "@pipedream/sdk/server"; const pd = createBackendClient({ environment: "development", // change to production if running for a test production account, or in production diff --git a/docs-v2/pages/connect/workflows.mdx b/docs-v2/pages/connect/workflows.mdx index de41d24ae06ba..579f16b6b85bf 100644 --- a/docs-v2/pages/connect/workflows.mdx +++ b/docs-v2/pages/connect/workflows.mdx @@ -121,7 +121,7 @@ Then invoke the workflow like so: ```typescript -import { createBackendClient, HTTPAuthType } from "@pipedream/sdk"; +import { createBackendClient, HTTPAuthType } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const pd = createBackendClient({ @@ -148,7 +148,7 @@ await pd.invokeWorkflowForExternalUser( ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const client = createBackendClient({ diff --git a/docs-v2/pages/rest-api/auth.mdx b/docs-v2/pages/rest-api/auth.mdx index d6d6a995fd987..531a8fee30893 100644 --- a/docs-v2/pages/rest-api/auth.mdx +++ b/docs-v2/pages/rest-api/auth.mdx @@ -32,7 +32,7 @@ In the client credentials model, you exchange your OAuth client ID and secret fo If you're running a server that executes JavaScript, we recommend using [the Pipedream SDK](/connect/api#installing-the-typescript-sdk), which automatically refreshes tokens for you. ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const pd = createBackendClient({ diff --git a/docs-v2/pages/workflows/triggers.mdx b/docs-v2/pages/workflows/triggers.mdx index 1a7c0a3b3a246..57f41841ba24c 100644 --- a/docs-v2/pages/workflows/triggers.mdx +++ b/docs-v2/pages/workflows/triggers.mdx @@ -146,7 +146,7 @@ You can use the Pipedream SDK to automatically refresh access tokens and invoke ```typescript -import { createBackendClient, HTTPAuthType } from "@pipedream/sdk"; +import { createBackendClient, HTTPAuthType } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const pd = createBackendClient({ @@ -170,7 +170,7 @@ await pd.invokeWorkflow( ```javascript -import { createBackendClient } from "@pipedream/sdk"; +import { createBackendClient } from "@pipedream/sdk/server"; // These secrets should be saved securely and passed to your environment const pd = createBackendClient({ @@ -242,7 +242,7 @@ curl -F 'name=Leia' -F 'title=General' https://myendpoint.m.pipedream.net Pipedream will convert that to a JavaScript object, `event.body`, with the following shape: -```json +```js { name: "Leia", title: "General",