Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.5",
"version": "2.0.6",
"private": false,
"repository": "github:PipedreamHQ/pipedream-sdk-typescript",
"type": "commonjs",
Expand Down
140 changes: 140 additions & 0 deletions src/api/resources/fileStash/client/Client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as environments from "../../../../environments.js";
import * as core from "../../../../core/index.js";
import * as Pipedream from "../../../index.js";
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
import * as errors from "../../../../errors/index.js";

export declare namespace FileStash {
export interface Options {
environment?: core.Supplier<environments.PipedreamEnvironment | string>;
/** Specify a custom URL to connect the client to. */
baseUrl?: 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. */
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
}

export interface RequestOptions {
/** The maximum time to wait for a response in seconds. */
timeoutInSeconds?: number;
/** The number of times to retry the request. Defaults to 2. */
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the x-pd-environment header */
projectEnvironment?: Pipedream.ProjectEnvironment | undefined;
/** Additional query string parameters to include in the request. */
queryParams?: Record<string, unknown>;
/** Additional headers to include in the request. */
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
}
}

export class FileStash {
protected readonly _options: FileStash.Options;

constructor(_options: FileStash.Options) {
this._options = _options;
}

/**
* Download a file from File Stash
*
* @param {Pipedream.FileStashDownloadFileRequest} request
* @param {FileStash.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Pipedream.TooManyRequestsError}
*
* @example
* await client.fileStash.downloadFile({
* s3Key: "s3_key"
* })
*/
public downloadFile(
request: Pipedream.FileStashDownloadFileRequest,
requestOptions?: FileStash.RequestOptions,
): core.HttpResponsePromise<void> {
return core.HttpResponsePromise.fromPromise(this.__downloadFile(request, requestOptions));
}

private async __downloadFile(
request: Pipedream.FileStashDownloadFileRequest,
requestOptions?: FileStash.RequestOptions,
): Promise<core.WithRawResponse<void>> {
const { s3Key } = request;
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
_queryParams["s3_key"] = s3Key;
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({
Authorization: await this._getAuthorizationHeader(),
"x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment,
}),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
(await core.Supplier.get(this._options.environment)) ??
environments.PipedreamEnvironment.Prod,
`v1/connect/${encodeURIComponent(this._options.projectId)}/file_stash/download`,
),
method: "GET",
headers: _headers,
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return { data: undefined, rawResponse: _response.rawResponse };
}

if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 429:
throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse);
default:
throw new errors.PipedreamError({
statusCode: _response.error.statusCode,
body: _response.error.body,
rawResponse: _response.rawResponse,
});
}
}

switch (_response.error.reason) {
case "non-json":
throw new errors.PipedreamError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
rawResponse: _response.rawResponse,
});
case "timeout":
throw new errors.PipedreamTimeoutError(
"Timeout exceeded when calling GET /v1/connect/{project_id}/file_stash/download.",
);
case "unknown":
throw new errors.PipedreamError({
message: _response.error.errorMessage,
rawResponse: _response.rawResponse,
});
}
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
}
}
2 changes: 2 additions & 0 deletions src/api/resources/fileStash/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {};
export * from "./requests/index.js";
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* @example
* {
* s3Key: "s3_key"
* }
*/
export interface FileStashDownloadFileRequest {
s3Key: string;
}
1 change: 1 addition & 0 deletions src/api/resources/fileStash/client/requests/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { type FileStashDownloadFileRequest } from "./FileStashDownloadFileRequest.js";
1 change: 1 addition & 0 deletions src/api/resources/fileStash/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./client/index.js";
2 changes: 2 additions & 0 deletions src/api/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * as components from "./components/index.js";
export * as actions from "./actions/index.js";
export * as triggers from "./triggers/index.js";
export * as deployedTriggers from "./deployedTriggers/index.js";
export * as fileStash from "./fileStash/index.js";
export * as projects from "./projects/index.js";
export * as proxy from "./proxy/index.js";
export * as tokens from "./tokens/index.js";
Expand All @@ -18,6 +19,7 @@ export * from "./components/client/requests/index.js";
export * from "./actions/client/requests/index.js";
export * from "./triggers/client/requests/index.js";
export * from "./deployedTriggers/client/requests/index.js";
export * from "./fileStash/client/requests/index.js";
export * from "./proxy/client/requests/index.js";
export * from "./tokens/client/requests/index.js";
export * from "./oauthTokens/client/requests/index.js";
Expand Down
4 changes: 3 additions & 1 deletion src/api/types/PropOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as Pipedream from "../index.js";

/**
* A configuration option for a component's prop
*/
export interface PropOption {
/** The human-readable label for the option */
label: string;
value?: unknown;
value?: Pipedream.PropOptionValue;
}
8 changes: 8 additions & 0 deletions src/api/types/PropOptionValue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* The value of a prop option
*/
export type PropOptionValue = string | number | boolean;
1 change: 1 addition & 0 deletions src/api/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export * from "./ProjectEnvironment.js";
export * from "./ProjectInfoResponse.js";
export * from "./ProjectInfoResponseApp.js";
export * from "./PropOption.js";
export * from "./PropOptionValue.js";
export * from "./PropOptionNested.js";
export * from "./ProxyResponse.js";
export * from "./ReloadPropsOpts.js";
Expand Down
5 changes: 3 additions & 2 deletions src/serialization/types/PropOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
import * as serializers from "../index.js";
import * as Pipedream from "../../api/index.js";
import * as core from "../../core/index.js";
import { PropOptionValue } from "./PropOptionValue.js";

export const PropOption: core.serialization.ObjectSchema<serializers.PropOption.Raw, Pipedream.PropOption> =
core.serialization.object({
label: core.serialization.string(),
value: core.serialization.unknown(),
value: PropOptionValue.optional(),
});

export declare namespace PropOption {
export interface Raw {
label: string;
value?: unknown;
value?: PropOptionValue.Raw | null;
}
}
18 changes: 18 additions & 0 deletions src/serialization/types/PropOptionValue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "../index.js";
import * as Pipedream from "../../api/index.js";
import * as core from "../../core/index.js";

export const PropOptionValue: core.serialization.Schema<serializers.PropOptionValue.Raw, Pipedream.PropOptionValue> =
core.serialization.undiscriminatedUnion([
core.serialization.string(),
core.serialization.number(),
core.serialization.boolean(),
]);

export declare namespace PropOptionValue {
export type Raw = string | number | boolean;
}
1 change: 1 addition & 0 deletions src/serialization/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export * from "./ProjectInfoResponse.js";
export * from "./ProjectInfoResponseApp.js";
export * from "./PropOption.js";
export * from "./PropOptionNested.js";
export * from "./PropOptionValue.js";
export * from "./ProxyResponse.js";
export * from "./ReloadPropsOpts.js";
export * from "./ReloadPropsResponse.js";
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SDK_VERSION = "2.0.5";
export const SDK_VERSION = "2.0.6";
56 changes: 28 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -733,16 +733,16 @@
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==

"@types/node@*":
version "24.4.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-24.4.0.tgz#4ca9168c016a55ab15b7765ad1674ab807489600"
integrity sha512-gUuVEAK4/u6F9wRLznPUU4WGUacSEBDPoC2TrBkw3GAnOLHBL45QdfHOXp1kJ4ypBGLxTOB+t7NJLpKoC3gznQ==
version "24.5.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-24.5.2.tgz#52ceb83f50fe0fcfdfbd2a9fab6db2e9e7ef6446"
integrity sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==
dependencies:
undici-types "~7.11.0"
undici-types "~7.12.0"

"@types/node@^18.19.70":
version "18.19.124"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.124.tgz#6f49e4fab8274910691a900e8a14316cbf3c7a31"
integrity sha512-hY4YWZFLs3ku6D2Gqo3RchTd9VRCcrjqp/I0mmohYeUVA5Y8eCXKJEasHxLAJVZRJuQogfd1GiJ9lgogBgKeuQ==
version "18.19.127"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.127.tgz#7c2e47fa79ad7486134700514d4a975c4607f09d"
integrity sha512-gSjxjrnKXML/yo0BO099uPixMqfpJU0TKYjpfLU7TrtA2WWDki412Np/RSTPRil1saKBhvVVKzVx/p/6p94nVA==
dependencies:
undici-types "~5.26.4"

Expand Down Expand Up @@ -1077,10 +1077,10 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==

baseline-browser-mapping@^2.8.2:
version "2.8.4"
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.8.4.tgz#e553e12272c4965682743705efd8b4b4cf0d709b"
integrity sha512-L+YvJwGAgwJBV1p6ffpSTa2KRc69EeeYGYjRVWKs0GKrK+LON0GC0gV+rKSNtALEDvMDqkvCFq9r1r94/Gjwxw==
baseline-browser-mapping@^2.8.3:
version "2.8.6"
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.8.6.tgz#c37dea4291ed8d01682f85661dbe87967028642e"
integrity sha512-wrH5NNqren/QMtKUEEJf7z86YjfqW/2uw3IL3/xpqZUC95SSVIFXYQeeGjL6FT/X68IROu6RMehZQS5foy2BXw==

brace-expansion@^1.1.7:
version "1.1.12"
Expand All @@ -1098,11 +1098,11 @@ braces@^3.0.3:
fill-range "^7.1.1"

browserslist@^4.24.0:
version "4.26.0"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.26.0.tgz#035ca84b4ff312a3c6a7014a77beb83456a882dd"
integrity sha512-P9go2WrP9FiPwLv3zqRD/Uoxo0RSHjzFCiQz7d4vbmwNqQFo9T9WCeP/Qn5EbcKQY6DBbkxEXNcpJOmncNrb7A==
version "4.26.2"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.26.2.tgz#7db3b3577ec97f1140a52db4936654911078cef3"
integrity sha512-ECFzp6uFOSB+dcZ5BK/IBaGWssbSYBHvuMeMt3MMFyhI0Z8SqGgEkBLARgpRH3hutIgPVsALcMwbDrJqPxQ65A==
dependencies:
baseline-browser-mapping "^2.8.2"
baseline-browser-mapping "^2.8.3"
caniuse-lite "^1.0.30001741"
electron-to-chromium "^1.5.218"
node-releases "^2.0.21"
Expand Down Expand Up @@ -1151,9 +1151,9 @@ camelcase@^6.2.0:
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==

caniuse-lite@^1.0.30001741:
version "1.0.30001741"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001741.tgz#67fb92953edc536442f3c9da74320774aa523143"
integrity sha512-QGUGitqsc8ARjLdgAfxETDhRbJ0REsP6O3I96TAth/mVjh2cYzN2u+3AzPP3aVSm2FehEItaJw1xd+IGBXWeSw==
version "1.0.30001743"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001743.tgz#50ff91a991220a1ee2df5af00650dd5c308ea7cd"
integrity sha512-e6Ojr7RV14Un7dz6ASD0aZDmQPT/A+eZU+nuTNfjqmRrmkmQlnTNWH0SKmqagx9PeW87UVqapSurtAXifmtdmw==

chalk@^4.0.0, chalk@^4.1.0:
version "4.1.2"
Expand Down Expand Up @@ -1348,9 +1348,9 @@ dunder-proto@^1.0.1:
gopd "^1.2.0"

electron-to-chromium@^1.5.218:
version "1.5.218"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.218.tgz#921042a011a98a4620853c9d391ab62bcc124400"
integrity sha512-uwwdN0TUHs8u6iRgN8vKeWZMRll4gBkz+QMqdS7DDe49uiK68/UX92lFb61oiFPrpYZNeZIqa4bA7O6Aiasnzg==
version "1.5.222"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.222.tgz#965c93783ad989116b74593ae3068b9466fdb237"
integrity sha512-gA7psSwSwQRE60CEoLz6JBCQPIxNeuzB2nL8vE03GK/OHxlvykbLyeiumQy1iH5C2f3YbRAZpGCMT12a/9ih9w==

emittery@^0.13.1:
version "0.13.1"
Expand Down Expand Up @@ -2958,9 +2958,9 @@ tr46@^3.0.0:
punycode "^2.1.1"

ts-jest@^29.3.4:
version "29.4.2"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.2.tgz#095fe8770df81f2e39f2c34a6bcafac58b834423"
integrity sha512-pBNOkn4HtuLpNrXTMVRC9b642CBaDnKqWXny4OzuoULT9S7Kf8MMlaRe2veKax12rjf5WcpMBhVPbQurlWGNxA==
version "29.4.3"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.3.tgz#23264489bebb5b3e2c7966dbf6788e960f244f7c"
integrity sha512-KTWbK2Wot8VXargsLoxhSoEQ9OyMdzQXQoUDeIulWu2Tf7gghuBHeg+agZqVLdTOHhQHVKAaeuctBDRkhWE7hg==
dependencies:
bs-logger "^0.2.6"
fast-json-stable-stringify "^2.1.0"
Expand Down Expand Up @@ -3013,10 +3013,10 @@ undici-types@~5.26.4:
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

undici-types@~7.11.0:
version "7.11.0"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.11.0.tgz#075798115d0bbc4e4fc7c173f38727ca66bfb592"
integrity sha512-kt1ZriHTi7MU+Z/r9DOdAI3ONdaR3M3csEaRc6ewa4f4dTvX4cQCbJ4NkEn0ohE4hHtq85+PhPSTY+pO/1PwgA==
undici-types@~7.12.0:
version "7.12.0"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.12.0.tgz#15c5c7475c2a3ba30659529f5cdb4674b622fafb"
integrity sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==

universalify@^0.2.0:
version "0.2.0"
Expand Down