Skip to content

Commit a44dc28

Browse files
committed
SDK fixes
1 parent 19be8ab commit a44dc28

File tree

3 files changed

+94
-5
lines changed

3 files changed

+94
-5
lines changed

packages/sdk/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
# Changelog
44

5+
## [1.2.1] - 2025-01-24
6+
7+
### Added
8+
9+
- New types related to API paginated responses
10+
- New type for a prop configuration options
11+
12+
### Changed
13+
14+
- Fixed the types of the trigger retrieval and deployment methods in the backend
15+
client to correctly reflect the actual response (which is nested inside a
16+
`data` field).
17+
518
## [1.2.0] - 2025-01-23
619

720
### Added

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/sdk",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Pipedream SDK",
55
"main": "dist/server/server/index.js",
66
"module": "dist/server/server/index.js",

packages/sdk/src/shared/index.ts

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ export type App = AppInfo & {
116116
*/
117117
export type AppResponse = App;
118118

119+
/**
120+
* A configuration option for a component's prop.
121+
*/
122+
export type PropOption = {
123+
label: string;
124+
value: string;
125+
};
126+
119127
/**
120128
* The response received after configuring a component's prop.
121129
*/
@@ -135,7 +143,7 @@ export type ConfigureComponentResponse = {
135143
* }
136144
* ```
137145
*/
138-
options: { label: string; value: string; }[];
146+
options: PropOption[];
139147

140148
/**
141149
* The options for the prop that's being configured. This field is applicable
@@ -169,6 +177,41 @@ export type RelationOpts = {
169177
limit?: number;
170178
};
171179

180+
/**
181+
* Pagination attributes for API responses.
182+
*/
183+
export type ResponsePageInfo = {
184+
/**
185+
* The total number of records available.
186+
*/
187+
total_count: number;
188+
189+
/**
190+
* The number of records returned in the current response.
191+
*/
192+
count: number;
193+
194+
/**
195+
* The cursor to retrieve the next page of records.
196+
*/
197+
start_cursor: string;
198+
199+
/**
200+
* The cursor of the last page of records.
201+
*/
202+
end_cursor: string;
203+
};
204+
205+
/**
206+
* The response attributes for paginated API responses.
207+
*/
208+
export type PaginationResponse = {
209+
/**
210+
* The pagination information for the response.
211+
*/
212+
page_info: ResponsePageInfo;
213+
}
214+
172215
/**
173216
* @deprecated Use `ConfigureComponentResponse` instead.
174217
*/
@@ -566,6 +609,16 @@ export type DeployTriggerOpts = ExternalUserId & {
566609
webhookUrl?: string;
567610
};
568611

612+
/**
613+
* The response received after deploying a trigger.
614+
*/
615+
export type DeployTriggerResponse = {
616+
/**
617+
* The contents of the deployed trigger.
618+
*/
619+
data: V1DeployedComponent;
620+
}
621+
569622
/**
570623
* The request options for deleting a deployed trigger owned by a particular
571624
* user.
@@ -605,6 +658,16 @@ export type GetTriggerOpts = {
605658
externalUserId: string;
606659
};
607660

661+
/**
662+
* The response received after retrieving a deployed trigger.
663+
*/
664+
export type GetTriggerResponse = {
665+
/**
666+
* The contents of the deployed trigger.
667+
*/
668+
data: V1DeployedComponent;
669+
};
670+
608671
/**
609672
* The request options for retrieving the events emitted by a deployed trigger.
610673
*/
@@ -692,6 +755,19 @@ export type GetTriggersOpts = RelationOpts & {
692755
externalUserId: string;
693756
};
694757

758+
/**
759+
* The response received after retrieving a list of deployed triggers.
760+
*/
761+
export type GetTriggersResponse = PaginationResponse & {
762+
/**
763+
* The list of deployed triggers.
764+
*/
765+
data: V1DeployedComponent[];
766+
};
767+
768+
/**
769+
* The request options for updating a trigger.
770+
*/
695771
export type UpdateTriggerOpts = {
696772
/**
697773
* The ID of the trigger you're updating.
@@ -1314,7 +1390,7 @@ export abstract class BaseClient {
13141390
dynamic_props_id: opts.dynamicPropsId,
13151391
webhook_url: opts.webhookUrl,
13161392
};
1317-
return this.makeConnectRequest<V1DeployedComponent>("/triggers/deploy", {
1393+
return this.makeConnectRequest<DeployTriggerResponse>("/triggers/deploy", {
13181394
method: "POST",
13191395
body,
13201396
});
@@ -1361,7 +1437,7 @@ export abstract class BaseClient {
13611437
externalUserId,
13621438
} = opts;
13631439

1364-
return this.makeConnectRequest<V1DeployedComponent>(`/deployed-triggers/${id}`, {
1440+
return this.makeConnectRequest<GetTriggerResponse>(`/deployed-triggers/${id}`, {
13651441
method: "GET",
13661442
params: {
13671443
external_user_id: externalUserId,
@@ -1378,7 +1454,7 @@ export abstract class BaseClient {
13781454
public getTriggers(opts: GetTriggersOpts) {
13791455
const { externalUserId } = opts;
13801456

1381-
return this.makeConnectRequest<V1DeployedComponent[]>("/deployed-triggers", {
1457+
return this.makeConnectRequest<GetTriggersResponse>("/deployed-triggers", {
13821458
method: "GET",
13831459
params: {
13841460
external_user_id: externalUserId,

0 commit comments

Comments
 (0)