Skip to content
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
43 changes: 7 additions & 36 deletions 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 All @@ -10,11 +10,6 @@
"exports": {
".": {
"types": "./dist/cjs/index.d.ts",
"browser": {
"types": "./dist/esm/browser/index.d.mts",
"import": "./dist/esm/browser/index.mjs",
"default": "./dist/esm/browser/index.mjs"
},
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
Expand All @@ -25,18 +20,6 @@
},
"default": "./dist/cjs/index.js"
},
"./browser": {
"types": "./dist/esm/browser/index.d.mts",
"import": {
"types": "./dist/esm/browser/index.d.mts",
"default": "./dist/esm/browser/index.mjs"
},
"require": {
"types": "./dist/cjs/browser/index.d.ts",
"default": "./dist/cjs/browser/index.js"
},
"default": "./dist/esm/browser/index.mjs"
},
"./serialization": {
"types": "./dist/cjs/serialization/index.d.ts",
"import": {
Expand All @@ -49,18 +32,6 @@
},
"default": "./dist/cjs/serialization/index.js"
},
"./server": {
"types": "./dist/cjs/index.d.ts",
"import": {
"types": "./dist/esm/index.d.mts",
"default": "./dist/esm/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"default": "./dist/cjs/index.js"
},
"./package.json": "./package.json"
},
"files": [
Expand All @@ -80,17 +51,17 @@
"test:wire": "jest --selectProjects wire"
},
"devDependencies": {
"webpack": "^5.97.1",
"ts-loader": "^9.5.1",
"jest": "^29.7.0",
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.14",
"@types/node": "^18.19.70",
"jest": "^29.7.0",
"ts-jest": "^29.3.4",
"jest-environment-jsdom": "^29.7.0",
"msw": "^2.8.4",
"@types/node": "^18.19.70",
"prettier": "^3.4.2",
"ts-jest": "^29.3.4",
"ts-loader": "^9.5.1",
"typescript": "~5.7.2",
"webpack": "^5.97.1"
"typescript": "~5.7.2"
},
"browser": {
"fs": false,
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,

Check failure on line 61 in src/api/resources/fileStash/client/Client.ts

View workflow job for this annotation

GitHub Actions / compile

Namespace '"/home/runner/work/pipedream-sdk-typescript/pipedream-sdk-typescript/src/api/index"' has no exported member 'FileStashDownloadFileRequest'.
requestOptions?: FileStash.RequestOptions,
): core.HttpResponsePromise<void> {
return core.HttpResponsePromise.fromPromise(this.__downloadFile(request, requestOptions));
}

private async __downloadFile(
request: Pipedream.FileStashDownloadFileRequest,

Check failure on line 68 in src/api/resources/fileStash/client/Client.ts

View workflow job for this annotation

GitHub Actions / compile

Namespace '"/home/runner/work/pipedream-sdk-typescript/pipedream-sdk-typescript/src/api/index"' has no exported member '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";
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;

Check failure on line 13 in src/api/types/PropOption.ts

View workflow job for this annotation

GitHub Actions / compile

'"/home/runner/work/pipedream-sdk-typescript/pipedream-sdk-typescript/src/api/index"' has no exported member named 'PropOptionValue'. Did you mean 'PropOption'?
}
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;
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> =

Check failure on line 10 in src/serialization/types/PropOption.ts

View workflow job for this annotation

GitHub Actions / compile

Type 'inferObjectSchemaFromPropertySchemas<{ label: Schema<string, string>; value: Schema<Raw | null | undefined, any>; }>' is not assignable to type 'ObjectSchema<Raw, 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> =

Check failure on line 9 in src/serialization/types/PropOptionValue.ts

View workflow job for this annotation

GitHub Actions / compile

'"/home/runner/work/pipedream-sdk-typescript/pipedream-sdk-typescript/src/api/index"' has no exported member named 'PropOptionValue'. Did you mean 'PropOption'?
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";
Loading
Loading