Skip to content
Open
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
10 changes: 10 additions & 0 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"cliVersion": "1.0.4",
"generatorName": "fernapi/fern-typescript-node-sdk",
"generatorVersion": "3.29.2",
"generatorConfig": {
"includeApiReference": true,
"namespaceExport": "Pipedream",
"noSerdeLayer": false
}
}
11 changes: 0 additions & 11 deletions .npmignore

This file was deleted.

133 changes: 133 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Contributing

Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.

## Getting Started

### Prerequisites

- Node.js 20 or higher
- pnpm package manager

### Installation

Install the project dependencies:

```bash
pnpm install
```

### Building

Build the project:

```bash
pnpm build
```

### Testing

Run the test suite:

```bash
pnpm test
```

Run specific test types:
- `pnpm test:unit` - Run unit tests
- `pnpm test:wire` - Run wire/integration tests

### Linting and Formatting

Check code style:

```bash
pnpm run lint
pnpm run format:check
```

Fix code style issues:

```bash
pnpm run lint:fix
pnpm run format:fix
```

Or use the combined check command:

```bash
pnpm run check:fix
```

## About Generated Code

**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.

### Generated Files

The following directories contain generated code:
- `src/api/` - API client classes and types
- `src/serialization/` - Serialization/deserialization logic
- Most TypeScript files in `src/`

### How to Customize

If you need to customize the SDK, you have two options:

#### Option 1: Use `.fernignore`

For custom code that should persist across SDK regenerations:

1. Create a `.fernignore` file in the project root
2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
3. Add your custom code to those files

Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.

For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).

#### Option 2: Contribute to the Generator

If you want to change how code is generated for all users of this SDK:

1. The TypeScript SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
2. Generator code is located at `generators/typescript/sdk/`
3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
4. Submit a pull request with your changes to the generator

This approach is best for:
- Bug fixes in generated code
- New features that would benefit all users
- Improvements to code generation patterns

## Making Changes

### Workflow

1. Create a new branch for your changes
2. Make your modifications
3. Run tests to ensure nothing breaks: `pnpm test`
4. Run linting and formatting: `pnpm run check:fix`
5. Build the project: `pnpm build`
6. Commit your changes with a clear commit message
7. Push your branch and create a pull request

### Commit Messages

Write clear, descriptive commit messages that explain what changed and why.

### Code Style

This project uses automated code formatting and linting. Run `pnpm run check:fix` before committing to ensure your code meets the project's style guidelines.

## Questions or Issues?

If you have questions or run into issues:

1. Check the [Fern documentation](https://buildwithfern.com)
2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
3. Open a new issue if your question hasn't been addressed

## License

By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
89 changes: 71 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { PipedreamClient } from "@pipedream/sdk";

const client = new PipedreamClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", projectEnvironment: "YOUR_PROJECT_ENVIRONMENT", projectId: "YOUR_PROJECT_ID" });
await client.actions.run({
projectId: "project_id",
id: "id",
externalUserId: "external_user_id"
});
Expand All @@ -42,7 +43,7 @@ following namespace:
```typescript
import { Pipedream } from "@pipedream/sdk";

const request: Pipedream.AppsListRequest = {
const request: Pipedream.RetrieveAppCategoriesRequest = {
...
};
```
Expand Down Expand Up @@ -464,30 +465,19 @@ List endpoints are paginated. The SDK provides an iterator so that you can simpl
import { PipedreamClient } from "@pipedream/sdk";

const client = new PipedreamClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", projectEnvironment: "YOUR_PROJECT_ENVIRONMENT", projectId: "YOUR_PROJECT_ID" });
const response = await client.apps.list({
after: "after",
before: "before",
limit: 1,
q: "q",
sortKey: "name",
sortDirection: "asc"
});
for await (const item of response) {
const pageableResponse = await client.apps.list();
for await (const item of pageableResponse) {
console.log(item);
}

// Or you can manually iterate page-by-page
let page = await client.apps.list({
after: "after",
before: "before",
limit: 1,
q: "q",
sortKey: "name",
sortDirection: "asc"
});
let page = await client.apps.list();
while (page.hasNextPage()) {
page = page.getNextPage();
}

// You can also access the underlying response
const response = page.response;
```

## Advanced
Expand Down Expand Up @@ -570,6 +560,69 @@ console.log(data);
console.log(rawResponse.headers['X-My-Header']);
```

### Logging

The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.

```typescript
import { PipedreamClient, logging } from "@pipedream/sdk";

const client = new PipedreamClient({
...
logging: {
level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
silent: false, // defaults to true, set to false to enable logging
}
});
```
The `logging` object can have the following properties:
- `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
- `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
- `silent`: Whether to silence the logger. Defaults to `true`.

The `level` property can be one of the following values:
- `logging.LogLevel.Debug`
- `logging.LogLevel.Info`
- `logging.LogLevel.Warn`
- `logging.LogLevel.Error`

To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.

<details>
<summary>Custom logger examples</summary>

Here's an example using the popular `winston` logging library.
```ts
import winston from 'winston';

const winstonLogger = winston.createLogger({...});

const logger: logging.ILogger = {
debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
info: (msg, ...args) => winstonLogger.info(msg, ...args),
warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
error: (msg, ...args) => winstonLogger.error(msg, ...args),
};
```

Here's an example using the popular `pino` logging library.

```ts
import pino from 'pino';

const pinoLogger = pino({...});

const logger: logging.ILogger = {
debug: (msg, ...args) => pinoLogger.debug(args, msg),
info: (msg, ...args) => pinoLogger.info(args, msg),
warn: (msg, ...args) => pinoLogger.warn(args, msg),
error: (msg, ...args) => pinoLogger.error(args, msg),
};
```
</details>


### Runtime Compatibility


Expand Down
27 changes: 16 additions & 11 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.1/schema.json",
"root": true,
"vcs": {
"enabled": false
},
"files": {
"ignoreUnknown": true,
"includes": [
"./**",
"!dist",
"!lib",
"!*.tsbuildinfo",
"!_tmp_*",
"!*.tmp",
"!.tmp/",
"!*.log",
"!.DS_Store",
"!Thumbs.db"
"**",
"!!dist",
"!!**/dist",
"!!lib",
"!!**/lib",
"!!_tmp_*",
"!!**/_tmp_*",
"!!*.tmp",
"!!**/*.tmp",
"!!.tmp/",
"!!**/.tmp/",
"!!*.log",
"!!**/*.log",
"!!**/.DS_Store",
"!!**/Thumbs.db"
]
},
"formatter": {
Expand Down
Loading
Loading