Skip to content

🌿 Fern Regeneration -- July 22, 2025 #46

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

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ Instantiate and use the client with the following:
```typescript
import { PipedreamClient } from "@pipedream/sdk";

const client = new PipedreamClient({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
});
const client = new PipedreamClient({ token: "YOUR_TOKEN", projectEnvironment: "YOUR_PROJECT_ENVIRONMENT" });
await client.accounts.create({
app_slug: "app_slug",
cfmap_json: "cfmap_json",
Expand Down Expand Up @@ -74,11 +70,7 @@ List endpoints are paginated. The SDK provides an iterator so that you can simpl
```typescript
import { PipedreamClient } from "@pipedream/sdk";

const client = new PipedreamClient({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
});
const client = new PipedreamClient({ token: "YOUR_TOKEN", projectEnvironment: "YOUR_PROJECT_ENVIRONMENT" });
const response = await client.apps.list();
for await (const item of response) {
console.log(item);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/sdk",
"version": "2.0.0",
"version": "1.7.1",
"private": false,
"repository": "github:PipedreamHQ/pipedream-sdk-typescript",
"type": "commonjs",
Expand Down
89 changes: 14 additions & 75 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import * as environments from "./environments.js";
import * as core from "./core/index.js";
import * as Pipedream from "./api/index.js";
import { OauthTokens } from "./api/resources/oauthTokens/client/Client.js";
import { mergeHeaders } from "./core/headers.js";
import { AppCategories } from "./api/resources/appCategories/client/Client.js";
import { Apps } from "./api/resources/apps/client/Client.js";
Expand All @@ -18,15 +17,15 @@ import { DeployedTriggers } from "./api/resources/deployedTriggers/client/Client
import { Projects } from "./api/resources/projects/client/Client.js";
import { Proxy } from "./api/resources/proxy/client/Client.js";
import { Tokens } from "./api/resources/tokens/client/Client.js";
import { OauthTokens } from "./api/resources/oauthTokens/client/Client.js";

export declare namespace PipedreamClient {
export interface Options {
environment?: core.Supplier<environments.PipedreamEnvironment | string>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
clientId?: core.Supplier<string>;
clientSecret?: core.Supplier<string>;
projectId: string;
token?: core.Supplier<core.BearerToken | undefined>;
/** Override the x-pd-environment header */
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
/** Additional headers to include in requests. */
Expand All @@ -49,7 +48,6 @@ export declare namespace PipedreamClient {

export class PipedreamClient {
protected readonly _options: PipedreamClient.Options;
private readonly _oauthTokenProvider: core.OAuthTokenProvider;
protected _appCategories: AppCategories | undefined;
protected _apps: Apps | undefined;
protected _accounts: Accounts | undefined;
Expand Down Expand Up @@ -79,112 +77,53 @@ export class PipedreamClient {
_options?.headers,
),
};

const clientId = this._options.clientId ?? process.env["PIPEDREAM_CLIENT_ID"];
if (clientId == null) {
throw new Error(
"clientId is required; either pass it as an argument or set the PIPEDREAM_CLIENT_ID environment variable",
);
}

const clientSecret = this._options.clientSecret ?? process.env["PIPEDREAM_CLIENT_SECRET"];
if (clientSecret == null) {
throw new Error(
"clientSecret is required; either pass it as an argument or set the PIPEDREAM_CLIENT_SECRET environment variable",
);
}

this._oauthTokenProvider = new core.OAuthTokenProvider({
clientId,
clientSecret,
authClient: new OauthTokens({
...this._options,
environment: this._options.environment,
}),
});
}

public get appCategories(): AppCategories {
return (this._appCategories ??= new AppCategories({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._appCategories ??= new AppCategories(this._options));
}

public get apps(): Apps {
return (this._apps ??= new Apps({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._apps ??= new Apps(this._options));
}

public get accounts(): Accounts {
return (this._accounts ??= new Accounts({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._accounts ??= new Accounts(this._options));
}

public get users(): Users {
return (this._users ??= new Users({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._users ??= new Users(this._options));
}

public get components(): Components {
return (this._components ??= new Components({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._components ??= new Components(this._options));
}

public get actions(): Actions {
return (this._actions ??= new Actions({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._actions ??= new Actions(this._options));
}

public get triggers(): Triggers {
return (this._triggers ??= new Triggers({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._triggers ??= new Triggers(this._options));
}

public get deployedTriggers(): DeployedTriggers {
return (this._deployedTriggers ??= new DeployedTriggers({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._deployedTriggers ??= new DeployedTriggers(this._options));
}

public get projects(): Projects {
return (this._projects ??= new Projects({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._projects ??= new Projects(this._options));
}

public get proxy(): Proxy {
return (this._proxy ??= new Proxy({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._proxy ??= new Proxy(this._options));
}

public get tokens(): Tokens {
return (this._tokens ??= new Tokens({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._tokens ??= new Tokens(this._options));
}

public get oauthTokens(): OauthTokens {
return (this._oauthTokens ??= new OauthTokens({
...this._options,
token: async () => await this._oauthTokenProvider.getToken(),
}));
return (this._oauthTokens ??= new OauthTokens(this._options));
}
}
2 changes: 1 addition & 1 deletion src/api/resources/accounts/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export class Accounts {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/actions/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export class Actions {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/appCategories/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class AppCategories {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/apps/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class Apps {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/components/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export class Components {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/deployedTriggers/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ export class DeployedTriggers {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/oauthTokens/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class OauthTokens {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/projects/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class Projects {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/proxy/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export class Proxy {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/tokens/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class Tokens {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/triggers/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ export class Triggers {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/users/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Users {
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
if (bearer != null) {
return `Bearer ${bearer}`;
}
Expand Down
57 changes: 0 additions & 57 deletions src/core/auth/OAuthTokenProvider.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/core/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { BasicAuth } from "./BasicAuth.js";
export { BearerToken } from "./BearerToken.js";
export { OAuthTokenProvider } from "./OAuthTokenProvider.js";
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from "./auth/index.js";
export * from "./fetcher/index.js";
export * from "./runtime/index.js";
export * as url from "./url/index.js";
export * from "./auth/index.js";
export * from "./base64.js";
export * from "./utils/index.js";
export * from "./pagination/index.js";
Loading
Loading