diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index e02e531f4cdf7..de87a18edcd2d 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,6 +1,22 @@ + # Changelog -## [1.0.0-rc.1] - 2024-11-01 +## [1.0.2] - 2024-11-14 + +### Changed + +- Deprecated the `environment_name` field in the `ConnectTokenOpts` type, as it + is no longer used by the SDK nor the Connect API. The environment name is now + exclusively determined by the `environment` field in the `BackendClientOpts` + type, read during the client creation. + +### Added + +- Added a new optional flag to `RequestOptions` called `fullResponse`, which + allows the user to get the full HTTP response object, including the headers + and status code. + +## [1.0.0] - 2024-11-01 ### Changed diff --git a/packages/sdk/package-lock.json b/packages/sdk/package-lock.json index b76751d1c47a2..b7c59eef29b5d 100644 --- a/packages/sdk/package-lock.json +++ b/packages/sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pipedream/sdk", - "version": "1.0.0-rc.1", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pipedream/sdk", - "version": "1.0.0-rc.1", + "version": "1.0.2", "license": "SEE LICENSE IN LICENSE", "dependencies": { "simple-oauth2": "^5.1.0" diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 3b7c49e47682a..e56bb2c947e0a 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/sdk", - "version": "1.0.1", + "version": "1.0.2", "description": "Pipedream SDK", "main": "dist/server/index.js", "module": "dist/server/index.js", diff --git a/packages/sdk/src/server/index.ts b/packages/sdk/src/server/index.ts index c83fb77d6bbeb..0616c32fefb21 100644 --- a/packages/sdk/src/server/index.ts +++ b/packages/sdk/src/server/index.ts @@ -87,6 +87,9 @@ export type ConnectTokenOpts = { /** * Specify the environment ("production" or "development") to use for the * account connection flow. Defaults to "production". + * + * @deprecated in favor of the `environment` field in `BackendClientOpts`. + * This field is completely ignored. */ environment_name?: string; }; @@ -292,6 +295,14 @@ interface RequestOptions extends Omit { * The body of the request. */ body?: Record | string | FormData | URLSearchParams | null; + + /** + * A flag to indicate that you want to get the full response object, not just + * the body. Note that when this flag is set, responses with unsuccessful HTTP + * statuses won't throw exceptions. Instead, you'll need to check the status + * code in the response object. Defaults to false. + */ + fullResponse?: boolean; } /** @@ -422,6 +433,7 @@ export class BackendClient { body, method = "GET", baseURL = this.baseApiUrl, + fullResponse = false, ...fetchOpts } = opts; @@ -472,6 +484,9 @@ export class BackendClient { } const response: Response = await fetch(url.toString(), requestOptions); + if (fullResponse) { + return response as unknown as T; + } if (!response.ok) { const errorBody = await response.text();