Skip to content

Fixing @pipedream/sdk imports #14715

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

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions docs-v2/pages/connect/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can also load the client-side SDK via `<script>` tag. You can run the latest
or a specific version:

```html
<script src="https://unpkg.com/@pipedream/sdk@0.0.13/dist/browser/index.js"></script>
<script src="https://unpkg.com/@pipedream/sdk@1.0.6/dist/browser/index.js"></script>
```

## Authentication
Expand All @@ -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({
Expand All @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -230,7 +230,7 @@ const { token, expires_at } = await pd.createConnectToken({
</Tabs.Tab>
<Tabs.Tab>
```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
Expand Down Expand Up @@ -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
Expand All @@ -341,7 +341,7 @@ const accounts = await pd.getAccounts({
</Tabs.Tab>
<Tabs.Tab>
```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
Expand Down Expand Up @@ -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
Expand All @@ -509,7 +509,7 @@ const account = await pd.getAccountById(accountId, {
</Tabs.Tab>
<Tabs.Tab>
```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
Expand Down Expand Up @@ -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
Expand All @@ -650,7 +650,7 @@ await pd.deleteAccount(accountId);
</Tabs.Tab>
<Tabs.Tab>
```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
Expand Down Expand Up @@ -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
Expand All @@ -734,7 +734,7 @@ await pd.deleteAccountsByApp(appId);
</Tabs.Tab>
<Tabs.Tab>
```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
Expand Down Expand Up @@ -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
Expand All @@ -818,7 +818,7 @@ console.log("All accounts associated with the external ID have been deleted.");
</Tabs.Tab>
<Tabs.Tab>
```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
Expand Down Expand Up @@ -880,7 +880,7 @@ GET /{project_id}/info
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
<Tabs.Tab>
```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
Expand All @@ -898,7 +898,7 @@ const info = await pd.getProjectInfo({
</Tabs.Tab>
<Tabs.Tab>
```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
Expand Down
2 changes: 1 addition & 1 deletion docs-v2/pages/connect/environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
```
Expand All @@ -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()
```

Expand All @@ -74,7 +74,7 @@ You'll need to make three changes to your backend code:
<Tabs items={['TypeScript', 'Node.js']}>
<Tabs.Tab>
```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({
Expand All @@ -87,7 +87,7 @@ const pd = createBackendClient({
</Tabs.Tab>
<Tabs.Tab>
```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({
Expand Down
6 changes: 3 additions & 3 deletions docs-v2/pages/connect/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ In our example, `app/page.tsx` calls the `connectAccount` method from the Pipedr
<Image src="https://res.cloudinary.com/pipedreamin/image/upload/v1724182571/connect-account-button-screenshot_n7vjvq.png" alt="Connect your account button" width={550} height={300} />

```typescript
import { createFrontendClient } from "@pipedream/sdk"
import { createFrontendClient } from "@pipedream/sdk/browser"

export default function Home() {
const pd = createFrontendClient()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs-v2/pages/connect/workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Then invoke the workflow like so:
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
<Tabs.Tab>
```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({
Expand All @@ -148,7 +148,7 @@ await pd.invokeWorkflowForExternalUser(
</Tabs.Tab>
<Tabs.Tab>
```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({
Expand Down
2 changes: 1 addition & 1 deletion docs-v2/pages/rest-api/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions docs-v2/pages/workflows/triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ You can use the Pipedream SDK to automatically refresh access tokens and invoke
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
<Tabs.Tab>
```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({
Expand All @@ -170,7 +170,7 @@ await pd.invokeWorkflow(
</Tabs.Tab>
<Tabs.Tab>
```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({
Expand Down Expand Up @@ -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",
Expand Down
Loading