diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index c9eb03a463910..37dbdf294211b 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -2,6 +2,21 @@ # 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 +- 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 ### 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..32510a2cc3297 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 + 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; 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.