Skip to content

Commit 197394f

Browse files
committed
SDK regeneration
1 parent fe894b0 commit 197394f

File tree

13 files changed

+226
-68
lines changed

13 files changed

+226
-68
lines changed

package.json

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/sdk",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"private": false,
55
"repository": "github:PipedreamHQ/pipedream-sdk-typescript",
66
"type": "commonjs",
@@ -10,11 +10,6 @@
1010
"exports": {
1111
".": {
1212
"types": "./dist/cjs/index.d.ts",
13-
"browser": {
14-
"types": "./dist/esm/browser/index.d.mts",
15-
"import": "./dist/esm/browser/index.mjs",
16-
"default": "./dist/esm/browser/index.mjs"
17-
},
1813
"import": {
1914
"types": "./dist/esm/index.d.mts",
2015
"default": "./dist/esm/index.mjs"
@@ -25,18 +20,6 @@
2520
},
2621
"default": "./dist/cjs/index.js"
2722
},
28-
"./browser": {
29-
"types": "./dist/esm/browser/index.d.mts",
30-
"import": {
31-
"types": "./dist/esm/browser/index.d.mts",
32-
"default": "./dist/esm/browser/index.mjs"
33-
},
34-
"require": {
35-
"types": "./dist/cjs/browser/index.d.ts",
36-
"default": "./dist/cjs/browser/index.js"
37-
},
38-
"default": "./dist/esm/browser/index.mjs"
39-
},
4023
"./serialization": {
4124
"types": "./dist/cjs/serialization/index.d.ts",
4225
"import": {
@@ -49,18 +32,6 @@
4932
},
5033
"default": "./dist/cjs/serialization/index.js"
5134
},
52-
"./server": {
53-
"types": "./dist/cjs/index.d.ts",
54-
"import": {
55-
"types": "./dist/esm/index.d.mts",
56-
"default": "./dist/esm/index.mjs"
57-
},
58-
"require": {
59-
"types": "./dist/cjs/index.d.ts",
60-
"default": "./dist/cjs/index.js"
61-
},
62-
"default": "./dist/cjs/index.js"
63-
},
6435
"./package.json": "./package.json"
6536
},
6637
"files": [
@@ -80,17 +51,17 @@
8051
"test:wire": "jest --selectProjects wire"
8152
},
8253
"devDependencies": {
54+
"webpack": "^5.97.1",
55+
"ts-loader": "^9.5.1",
56+
"jest": "^29.7.0",
8357
"@jest/globals": "^29.7.0",
8458
"@types/jest": "^29.5.14",
85-
"@types/node": "^18.19.70",
86-
"jest": "^29.7.0",
59+
"ts-jest": "^29.3.4",
8760
"jest-environment-jsdom": "^29.7.0",
8861
"msw": "^2.8.4",
62+
"@types/node": "^18.19.70",
8963
"prettier": "^3.4.2",
90-
"ts-jest": "^29.3.4",
91-
"ts-loader": "^9.5.1",
92-
"typescript": "~5.7.2",
93-
"webpack": "^5.97.1"
64+
"typescript": "~5.7.2"
9465
},
9566
"browser": {
9667
"fs": false,
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as environments from "../../../../environments.js";
6+
import * as core from "../../../../core/index.js";
7+
import * as Pipedream from "../../../index.js";
8+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
9+
import * as errors from "../../../../errors/index.js";
10+
11+
export declare namespace FileStash {
12+
export interface Options {
13+
environment?: core.Supplier<environments.PipedreamEnvironment | string>;
14+
/** Specify a custom URL to connect the client to. */
15+
baseUrl?: core.Supplier<string>;
16+
projectId: string;
17+
token?: core.Supplier<core.BearerToken | undefined>;
18+
/** Override the x-pd-environment header */
19+
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
20+
/** Additional headers to include in requests. */
21+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
22+
}
23+
24+
export interface RequestOptions {
25+
/** The maximum time to wait for a response in seconds. */
26+
timeoutInSeconds?: number;
27+
/** The number of times to retry the request. Defaults to 2. */
28+
maxRetries?: number;
29+
/** A hook to abort the request. */
30+
abortSignal?: AbortSignal;
31+
/** Override the x-pd-environment header */
32+
projectEnvironment?: Pipedream.ProjectEnvironment | undefined;
33+
/** Additional query string parameters to include in the request. */
34+
queryParams?: Record<string, unknown>;
35+
/** Additional headers to include in the request. */
36+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
37+
}
38+
}
39+
40+
export class FileStash {
41+
protected readonly _options: FileStash.Options;
42+
43+
constructor(_options: FileStash.Options) {
44+
this._options = _options;
45+
}
46+
47+
/**
48+
* Download a file from File Stash
49+
*
50+
* @param {Pipedream.FileStashDownloadFileRequest} request
51+
* @param {FileStash.RequestOptions} requestOptions - Request-specific configuration.
52+
*
53+
* @throws {@link Pipedream.TooManyRequestsError}
54+
*
55+
* @example
56+
* await client.fileStash.downloadFile({
57+
* s3Key: "s3_key"
58+
* })
59+
*/
60+
public downloadFile(
61+
request: Pipedream.FileStashDownloadFileRequest,
62+
requestOptions?: FileStash.RequestOptions,
63+
): core.HttpResponsePromise<void> {
64+
return core.HttpResponsePromise.fromPromise(this.__downloadFile(request, requestOptions));
65+
}
66+
67+
private async __downloadFile(
68+
request: Pipedream.FileStashDownloadFileRequest,
69+
requestOptions?: FileStash.RequestOptions,
70+
): Promise<core.WithRawResponse<void>> {
71+
const { s3Key } = request;
72+
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
73+
_queryParams["s3_key"] = s3Key;
74+
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
75+
this._options?.headers,
76+
mergeOnlyDefinedHeaders({
77+
Authorization: await this._getAuthorizationHeader(),
78+
"x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment,
79+
}),
80+
requestOptions?.headers,
81+
);
82+
const _response = await core.fetcher({
83+
url: core.url.join(
84+
(await core.Supplier.get(this._options.baseUrl)) ??
85+
(await core.Supplier.get(this._options.environment)) ??
86+
environments.PipedreamEnvironment.Prod,
87+
`v1/connect/${encodeURIComponent(this._options.projectId)}/file_stash/download`,
88+
),
89+
method: "GET",
90+
headers: _headers,
91+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
92+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
93+
maxRetries: requestOptions?.maxRetries,
94+
abortSignal: requestOptions?.abortSignal,
95+
});
96+
if (_response.ok) {
97+
return { data: undefined, rawResponse: _response.rawResponse };
98+
}
99+
100+
if (_response.error.reason === "status-code") {
101+
switch (_response.error.statusCode) {
102+
case 429:
103+
throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse);
104+
default:
105+
throw new errors.PipedreamError({
106+
statusCode: _response.error.statusCode,
107+
body: _response.error.body,
108+
rawResponse: _response.rawResponse,
109+
});
110+
}
111+
}
112+
113+
switch (_response.error.reason) {
114+
case "non-json":
115+
throw new errors.PipedreamError({
116+
statusCode: _response.error.statusCode,
117+
body: _response.error.rawBody,
118+
rawResponse: _response.rawResponse,
119+
});
120+
case "timeout":
121+
throw new errors.PipedreamTimeoutError(
122+
"Timeout exceeded when calling GET /v1/connect/{project_id}/file_stash/download.",
123+
);
124+
case "unknown":
125+
throw new errors.PipedreamError({
126+
message: _response.error.errorMessage,
127+
rawResponse: _response.rawResponse,
128+
});
129+
}
130+
}
131+
132+
protected async _getAuthorizationHeader(): Promise<string | undefined> {
133+
const bearer = await core.Supplier.get(this._options.token);
134+
if (bearer != null) {
135+
return `Bearer ${bearer}`;
136+
}
137+
138+
return undefined;
139+
}
140+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export {};
2+
export * from "./requests/index.js";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
/**
6+
* @example
7+
* {
8+
* s3Key: "s3_key"
9+
* }
10+
*/
11+
export interface FileStashDownloadFileRequest {
12+
s3Key: string;
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { type FileStashDownloadFileRequest } from "./FileStashDownloadFileRequest.js";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./client/index.js";

src/api/types/PropOption.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
* This file was auto-generated by Fern from our API Definition.
33
*/
44

5+
import * as Pipedream from "../index.js";
6+
57
/**
68
* A configuration option for a component's prop
79
*/
810
export interface PropOption {
911
/** The human-readable label for the option */
1012
label: string;
11-
value?: unknown;
13+
value: Pipedream.PropOptionValue;
1214
}

src/api/types/PropOptionValue.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
/**
6+
* The value of a prop option
7+
*/
8+
export type PropOptionValue = string | number | boolean;

src/serialization/types/PropOption.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
import * as serializers from "../index.js";
66
import * as Pipedream from "../../api/index.js";
77
import * as core from "../../core/index.js";
8+
import { PropOptionValue } from "./PropOptionValue.js";
89

910
export const PropOption: core.serialization.ObjectSchema<serializers.PropOption.Raw, Pipedream.PropOption> =
1011
core.serialization.object({
1112
label: core.serialization.string(),
12-
value: core.serialization.unknown(),
13+
value: PropOptionValue,
1314
});
1415

1516
export declare namespace PropOption {
1617
export interface Raw {
1718
label: string;
18-
value?: unknown;
19+
value: PropOptionValue.Raw;
1920
}
2021
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as serializers from "../index.js";
6+
import * as Pipedream from "../../api/index.js";
7+
import * as core from "../../core/index.js";
8+
9+
export const PropOptionValue: core.serialization.Schema<serializers.PropOptionValue.Raw, Pipedream.PropOptionValue> =
10+
core.serialization.undiscriminatedUnion([
11+
core.serialization.string(),
12+
core.serialization.number(),
13+
core.serialization.boolean(),
14+
]);
15+
16+
export declare namespace PropOptionValue {
17+
export type Raw = string | number | boolean;
18+
}

0 commit comments

Comments
 (0)