From 8c40839b82426815a49a8013c2e08ef363654b53 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Tue, 10 Jun 2025 11:15:14 -0700 Subject: [PATCH 1/4] Type improvements for configurable props * Add types for the missing configurable props * Fix the `Defaultable` type to correctly handle arrays * Fixed the `ConfigurablePropTimer` type to define cron expressions and time intervals * Mark the `auth` field in the SQL prop type as optional --- packages/sdk/CHANGELOG.md | 13 +++ packages/sdk/package.json | 2 +- packages/sdk/src/shared/component.ts | 113 ++++++++++++++++++++++++--- 3 files changed, 116 insertions(+), 12 deletions(-) diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index c9eb03a463910..bded648c9e36e 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -2,6 +2,19 @@ # Changelog +## [1.6.9] - 2025-06-10 + +### Added + +- Added types for the missing configurable props + +## Changed + +- Fixed the `Defaultable` type to correctly handle arrays +- Fixed the `ConfigurablePropTimer` type to define cron expressions and + time intervals +- Marked the `auth` field in the SQL prop type as optional + ## [1.6.8] - 2025-06-07 ### Added diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 7cead7cce89a4..0ace4a5b6e5b7 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,7 +1,7 @@ { "name": "@pipedream/sdk", "type": "module", - "version": "1.6.8", + "version": "1.6.9", "description": "Pipedream SDK", "main": "./dist/server.js", "module": "./dist/server.js", diff --git a/packages/sdk/src/shared/component.ts b/packages/sdk/src/shared/component.ts index 159969c96f480..e0672abc72022 100644 --- a/packages/sdk/src/shared/component.ts +++ b/packages/sdk/src/shared/component.ts @@ -55,59 +55,150 @@ type BaseConfigurableProp = { }; // XXX fix duplicating mapping to value type here and with PropValue -type Defaultable = { default?: T; options?: T[]; }; + +type LabelValueOption = { + label: string; + value: T; +}; + +type Defaultable = { + default?: T + options?: SingleT[] | Array>; +} export type ConfigurablePropAlert = BaseConfigurableProp & { type: "alert"; alertType: "info" | "neutral" | "warning" | "error"; // TODO check the types content: string; }; + export type ConfigurablePropAny = BaseConfigurableProp & { type: "any"; } & Defaultable; // eslint-disable-line @typescript-eslint/no-explicit-any + export type ConfigurablePropApp = BaseConfigurableProp & { type: "app"; app: string; }; -export type ConfigurablePropBoolean = BaseConfigurableProp & { type: "boolean"; }; + +export type ConfigurablePropBoolean = BaseConfigurableProp & { + type: "boolean"; +} & Defaultable; + export type ConfigurablePropInteger = BaseConfigurableProp & { type: "integer"; min?: number; max?: number; } & Defaultable; + export type ConfigurablePropObject = BaseConfigurableProp & { type: "object"; } & Defaultable; + export type ConfigurablePropString = BaseConfigurableProp & { type: "string"; secret?: boolean; } & Defaultable; + export type ConfigurablePropStringArray = BaseConfigurableProp & { type: "string[]"; secret?: boolean; // TODO is this supported -} & Defaultable; // TODO +} & Defaultable; + +export type TimerInterval = { + intervalSeconds: number; +} + +export type TimerCron = { + cron: string; +} + +export type ConfigurablePropTimer = BaseConfigurableProp & { + type: "$.interface.timer"; + static?: TimerInterval | TimerCron; +} & Defaultable; + +export type ConfigurablePropApphook = BaseConfigurableProp & { + type: "$.interface.apphook"; + appProp: string; + eventNames?: Array; + remote?: boolean; + static?: Array; +} + +export type ConfigurablePropIntegerArray = BaseConfigurableProp & { + type: "integer[]"; + min?: number; + max?: number; +} & Defaultable + +export type ConfigurablePropHttp = BaseConfigurableProp & { + type: "$.interface.http"; + customResponse?: boolean; +} + +export type ConfigurablePropDb = BaseConfigurableProp & { + type: "$.service.db"; +} + export type ConfigurablePropSql = BaseConfigurableProp & { type: "sql"; - auth: { + auth?: { app: string; }; } & Defaultable; -// | { type: "$.interface.http" } // source only -// | { type: "$.interface.timer" } // source only -// | { type: "$.service.db" } -// | { type: "data_store" } -// | { type: "http_request" } + +export type ConfigurablePropAirtableBaseId = BaseConfigurableProp & { + type: "$.airtable.baseId"; + appProp: string; +} + +export type ConfigurablePropAirtableTableId = BaseConfigurableProp & { + type: "$.airtable.tableId"; + baseIdProp: string; +} + +export type ConfigurablePropAirtableViewId = BaseConfigurableProp & { + type: "$.airtable.viewId"; + tableIdProp: string; +} + +export type ConfigurablePropAirtableFieldId = BaseConfigurableProp & { + type: "$.airtable.fieldId"; + tableIdProp: string; +} + +export type ConfigurablePropDiscordChannel = BaseConfigurableProp & { + type: "$.discord.channel"; + appProp: string; +} + +export type ConfigurablePropDiscordChannelArray = BaseConfigurableProp & { + type: "$.discord.channel[]"; + appProp: string; +} + export type ConfigurableProp = + | ConfigurablePropAirtableBaseId + | ConfigurablePropAirtableFieldId + | ConfigurablePropAirtableTableId + | ConfigurablePropAirtableViewId | ConfigurablePropAlert | ConfigurablePropAny | ConfigurablePropApp + | ConfigurablePropApphook | ConfigurablePropBoolean + | ConfigurablePropDb + | ConfigurablePropDiscordChannel + | ConfigurablePropDiscordChannelArray + | ConfigurablePropHttp | ConfigurablePropInteger + | ConfigurablePropIntegerArray | ConfigurablePropObject + | ConfigurablePropSql | ConfigurablePropString | ConfigurablePropStringArray - | ConfigurablePropSql - | (BaseConfigurableProp & { type: "$.discord.channel"; }); + | ConfigurablePropTimer export type ConfigurableProps = Readonly; From 42d742050f5ce063bf3d1353e849e6c75977e0a7 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Tue, 10 Jun 2025 11:29:53 -0700 Subject: [PATCH 2/4] Mark alertType as not required --- packages/sdk/src/shared/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sdk/src/shared/component.ts b/packages/sdk/src/shared/component.ts index e0672abc72022..47c11f2ebaa01 100644 --- a/packages/sdk/src/shared/component.ts +++ b/packages/sdk/src/shared/component.ts @@ -68,7 +68,7 @@ type Defaultable = { export type ConfigurablePropAlert = BaseConfigurableProp & { type: "alert"; - alertType: "info" | "neutral" | "warning" | "error"; // TODO check the types + alertType?: "info" | "neutral" | "warning" | "error"; // TODO check the types content: string; }; From 171cdee047102c44f8ee27c1069ff4edb01a8469 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Tue, 10 Jun 2025 11:35:48 -0700 Subject: [PATCH 3/4] Add missing semicolon --- packages/sdk/src/shared/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sdk/src/shared/component.ts b/packages/sdk/src/shared/component.ts index 47c11f2ebaa01..32510a2cc3297 100644 --- a/packages/sdk/src/shared/component.ts +++ b/packages/sdk/src/shared/component.ts @@ -62,7 +62,7 @@ type LabelValueOption = { }; type Defaultable = { - default?: T + default?: T; options?: SingleT[] | Array>; } From e6c47a5142bbbc1e784f4487529c3382d8b90169 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Tue, 10 Jun 2025 11:55:29 -0700 Subject: [PATCH 4/4] Add missing fields for the getApps call --- packages/sdk/CHANGELOG.md | 2 ++ packages/sdk/src/shared/index.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index bded648c9e36e..37dbdf294211b 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -14,6 +14,8 @@ - Fixed the `ConfigurablePropTimer` type to define cron expressions and time intervals - Marked the `auth` field in the SQL prop type as optional +- Fixed the `App` type to include the `description` field returned by the API +- Fixed the `GetAppsResponse` type to include the pagination stuff ## [1.6.8] - 2025-06-07 diff --git a/packages/sdk/src/shared/index.ts b/packages/sdk/src/shared/index.ts index ca9bcb7bc6896..0b4daa82d77f8 100644 --- a/packages/sdk/src/shared/index.ts +++ b/packages/sdk/src/shared/index.ts @@ -90,6 +90,11 @@ export type App = AppInfo & { */ name: string; + /** + * A short description of the app. + */ + description: string; + /** * The authentication type used by the app. */ @@ -509,7 +514,9 @@ export type AccountsRequestResponse = GetAccountsResponse; /** * The response received when retrieving a list of apps. */ -export type GetAppsResponse = { data: App[]; }; +export type GetAppsResponse = PaginationResponse & { + data: App[]; +}; /** * @deprecated Use `GetAppsResponse` instead.