Skip to content

Commit 91ea950

Browse files
dylburgerjvercecoderabbitai[bot]
authored
Fixes DJ-2470 (#14106)
@pipedream/sdk 1.0.0 --------- Co-authored-by: Jay Vercellone <jay@pipedream.com> Co-authored-by: Jay Vercellone <jverce@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 7060440 commit 91ea950

File tree

14 files changed

+1139
-460
lines changed

14 files changed

+1139
-460
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint SDK Markdown Files
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
paths:
7+
- 'packages/sdk/**/*.md'
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Lint markdown files
22+
uses: DavidAnson/markdownlint-cli2-action@v17
23+
with:
24+
globs: 'packages/sdk/**/*.md'

.github/workflows/pipedream-sdk-test.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ on:
66
paths:
77
- 'packages/sdk/**'
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
test:
1115
runs-on: ubuntu-latest
1216

1317
steps:
1418
- name: Checkout code
15-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
1620

1721
- name: Set up Node.js
1822
uses: actions/setup-node@v3

packages/sdk/.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 22.10.0

packages/sdk/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
## [1.0.0-rc.1] - 2024-11-01
4+
5+
### Changed
6+
7+
- Renamed the server-side client class from `ServerClient` to `BackendClient` to
8+
better indicate its purpose.
9+
- Removed the `oauthClient` optional argument to the `BackendClient` constructor
10+
- Renamed the client factory methods so that developers can know exactly the
11+
kind of client they are creating.
12+
- Removed project-key-based authentication in favor of a more secure
13+
token-based authentication using OAuth.

packages/sdk/CONTRIBUTING.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# How to Contribute to the SDK
2+
3+
## Local Environment Setup
4+
5+
### Global Dependencies
6+
7+
Clone the repo (ideally your own fork of it) and initialize the global
8+
dependencies like Node.js, NPM, etc. We use [`asdf`](https://asdf-vm.com/) to
9+
manage these, so assuming we're located in this directory (i.e. `packages/sdk/`)
10+
we can run the following command to install them:
11+
12+
```shell
13+
asdf install
14+
```
15+
16+
If you prefer to use another tool make sure you use the same versions that are
17+
specified in the `.tool-versions` files [in this current directory, and
18+
recursively going up until you reach the root of the
19+
repo](https://asdf-vm.com/guide/getting-started.html#_6-set-a-version).
20+
21+
### Local Dependencies
22+
23+
You can install the package's dependencies by using `pnpm` or `npm`:
24+
25+
```shell
26+
pnpm install
27+
```
28+
29+
Since other packages in this repository already use `pnpm`, we recommend you use
30+
it in this case too to keep your `node_modules` footprint low.
31+
32+
## Build the Package
33+
34+
There's a script that you can invoke with `pnpm` to build the package artifacts:
35+
36+
```shell
37+
pnpm build
38+
```
39+
40+
You can also watch the code for changes, and automatically build a new artifact
41+
after each change with the `watch` script:
42+
43+
```shell
44+
pnpm watch
45+
```
46+
47+
### Use the Package
48+
49+
You can use pnpm's `link` command to point other code to your local version of
50+
this package during development. This lets you test the SDK in other local apps,
51+
end-to-end.
52+
53+
In this `packages/sdk/` directory:
54+
55+
```shell
56+
pnpm link --global
57+
```
58+
59+
> [!NOTE]
60+
When using the version of Node.js specified in
61+
[`.tool-versions`](./.tool-versions) (via `asdf`), the command above will
62+
install the package in the `asdf` Node.js environment. To use this package
63+
elsewhere, you'll need to use the same version of Node.js. Please reference the
64+
latest version of [the `.tool-versions` file](./.tool-versions) and add that to
65+
the `.tool-versions` file in your local project where you'd like to use the SDK.
66+
67+
For example, in your app's directory:
68+
69+
```shell
70+
# Replace /path/to/pipedream with the actual path to this repository
71+
grep nodejs /path/to/pipedream/packages/sdk/.tool-versions >> .tool-versions
72+
asdf install
73+
pnpm install @pipedream/sdk
74+
```
75+
76+
Then, link the SDK package to it's local path:
77+
78+
```shell
79+
pnpm link @pipedream/sdk
80+
```
81+
82+
To confirm you successfully installed the correct version of the SDK, and that
83+
it's tied to your local copy of the Pipedream SDK:
84+
85+
```shell
86+
ls -l node_modules/@pipedream
87+
```
88+
89+
You should see an output like this one (notice the last line):
90+
91+
```text
92+
total 0
93+
drwxr-xr-x 9 jay staff 288 30 Oct 14:01 mysql
94+
drwxr-xr-x 10 jay staff 320 30 Oct 14:01 platform
95+
lrwxr-xr-x 1 jay staff 31 30 Oct 14:06 sdk -> ../../../pipedream/packages/sdk
96+
```

packages/sdk/README.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# `@pipedream/sdk`
22

3-
TypeScript SDK for [Pipedream](https://pipedream.com). [See the docs](https://pipedream.com/docs/connect) for usage instructions.
3+
TypeScript SDK for [Pipedream](https://pipedream.com). [See the
4+
docs](https://pipedream.com/docs/connect) for usage instructions.
45

56
## Install
67

@@ -10,12 +11,39 @@ npm i @pipedream/sdk
1011

1112
## Quickstart
1213

13-
The [quickstart](https://pipedream.com/docs/connect/quickstart) is the easiest way to get started with the SDK and Pipedream Connect.
14+
The [quickstart](https://pipedream.com/docs/connect/quickstart) is the easiest
15+
way to get started with the SDK and Pipedream Connect.
1416

1517
## Usage
1618

17-
[See the SDK docs](https://pipedream.com/docs/connect) for full usage instructions and examples for each method.
19+
[See the SDK docs](https://pipedream.com/docs/connect) for full usage
20+
instructions and examples for each method.
1821

19-
## Example app
22+
## Example App
2023

21-
Clone and run the [example app](https://github.com/PipedreamHQ/pipedream-connect-examples/) to get started.
24+
Clone and run the [example
25+
app](https://github.com/PipedreamHQ/pipedream-connect-examples/) to get started.
26+
27+
## Importing the Client
28+
29+
You can import the SDK from the root package name, and it will automatically
30+
load the appropriate code depending on the environment (e.g. Node.js server,
31+
browser, etc.).
32+
33+
### CommonJS Modules
34+
35+
```javascript
36+
const { createClient } = require("@pipedream/sdk");
37+
```
38+
39+
### ES Modules
40+
41+
```javascript
42+
import { createClient } from "@pipedream/sdk";
43+
```
44+
45+
### Browser
46+
47+
```javascript
48+
import { createClient } from "@pipedream/sdk";
49+
```

packages/sdk/jest.setup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
const fetchMock = require("jest-fetch-mock");
22
fetchMock.enableMocks();
33
global.fetch = fetchMock;
4+
5+
jest.mock("simple-oauth2");

0 commit comments

Comments
 (0)