From 8e11849e242943c8077ce8b4a1851369b401846d Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 30 Sep 2025 16:28:40 -0300 Subject: [PATCH 1/5] Adding 'annotations' to component typing for actions --- scripts/tool-annotations/apply-annotations.js | 30 ++++++++++++++----- types/src/index.ts | 5 ++++ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/scripts/tool-annotations/apply-annotations.js b/scripts/tool-annotations/apply-annotations.js index 697ab5696f9b3..f5626ace85134 100644 --- a/scripts/tool-annotations/apply-annotations.js +++ b/scripts/tool-annotations/apply-annotations.js @@ -30,7 +30,8 @@ class AnnotationApplier { processed: 0, modified: 0, errors: 0, - skipped: 0 + skipped: 0, + modifiedFiles: [] }; } @@ -186,9 +187,10 @@ class AnnotationApplier { } isActionFile(fileName, fullPath) { + const normalizedPath = fullPath.replace(/\\/g, '/'); return (fileName.endsWith('.mjs') || fileName.endsWith('.ts')) && - fullPath.includes('/actions/') && - !fullPath.includes('/common/'); + normalizedPath.includes('/actions/') && + !normalizedPath.includes('/common/'); } extractActionKey(fileContent) { @@ -221,8 +223,15 @@ class AnnotationApplier { } applyAnnotations(fileContent, annotations) { - // Find and replace version - const versionMatch = fileContent.match(/(.*version:\s*["'])([^"']+)(["'],?\s*\n)/s); + // Find and replace version - handle both orders: type before version OR version before type + // Try lookahead first (version comes before type: "action") + let versionMatch = fileContent.match(/(.*version:\s*["'])([^"']+)(["'],?\s*\n)(?=[\s\S]*?type:\s*["']action["'])/s); + + // If not found, try lookbehind (type: "action" comes before version) + if (!versionMatch) { + versionMatch = fileContent.match(/(?<=type:\s*["']action["'][\s\S]{0,1000}?)(.*version:\s*["'])([^"']+)(["'],?\s*\n)/s); + } + if (!versionMatch) { throw new Error('Could not find version field in file'); } @@ -270,7 +279,7 @@ class AnnotationApplier { const modifiedContent = this.applyAnnotations(fileContent, annotations); fs.writeFileSync(filePath, modifiedContent, 'utf8'); - this.recordModification(fileContent, actionKey); + this.recordModification(fileContent, actionKey, filePath); return true; } catch (error) { @@ -290,8 +299,9 @@ class AnnotationApplier { this.log(`Error processing ${filePath}: ${error.message}`, 'error'); } - recordModification(fileContent, actionKey) { + recordModification(fileContent, actionKey, filePath) { this.stats.modified++; + this.stats.modifiedFiles.push(filePath); const currentVersionMatch = fileContent.match(/version:\s*["']([^"']+)["']/); const currentVersion = currentVersionMatch ? currentVersionMatch[1] : 'unknown'; @@ -341,6 +351,12 @@ class AnnotationApplier { this.log('\n=== ERRORS ==='); this.errors.forEach(error => this.log(error, 'error')); } + + // Output modified files as JSON + if (this.stats.modifiedFiles.length > 0) { + this.log('\n=== MODIFIED FILES (JSON) ==='); + console.log(JSON.stringify(this.stats.modifiedFiles, null, 2)); + } } async run() { diff --git a/types/src/index.ts b/types/src/index.ts index efcf1b25083d7..2d8ef7f0f1de2 100644 --- a/types/src/index.ts +++ b/types/src/index.ts @@ -384,6 +384,11 @@ export interface Action< type: "action"; methods?: Methods & ThisType & Methods>; props?: ActionPropDefinitions; + annotations?: { + destructiveHint?: boolean; + openWorldHint?: boolean; + readOnlyHint?: boolean; + } additionalProps?: ( previousPropDefs: ActionPropDefinitions ) => Promise; From 67074414c474123f3b6c5147d28bca44db657f54 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 30 Sep 2025 16:40:54 -0300 Subject: [PATCH 2/5] Package bump --- scripts/tool-annotations/apply-annotations.js | 30 +++++-------------- types/package.json | 2 +- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/scripts/tool-annotations/apply-annotations.js b/scripts/tool-annotations/apply-annotations.js index f5626ace85134..697ab5696f9b3 100644 --- a/scripts/tool-annotations/apply-annotations.js +++ b/scripts/tool-annotations/apply-annotations.js @@ -30,8 +30,7 @@ class AnnotationApplier { processed: 0, modified: 0, errors: 0, - skipped: 0, - modifiedFiles: [] + skipped: 0 }; } @@ -187,10 +186,9 @@ class AnnotationApplier { } isActionFile(fileName, fullPath) { - const normalizedPath = fullPath.replace(/\\/g, '/'); return (fileName.endsWith('.mjs') || fileName.endsWith('.ts')) && - normalizedPath.includes('/actions/') && - !normalizedPath.includes('/common/'); + fullPath.includes('/actions/') && + !fullPath.includes('/common/'); } extractActionKey(fileContent) { @@ -223,15 +221,8 @@ class AnnotationApplier { } applyAnnotations(fileContent, annotations) { - // Find and replace version - handle both orders: type before version OR version before type - // Try lookahead first (version comes before type: "action") - let versionMatch = fileContent.match(/(.*version:\s*["'])([^"']+)(["'],?\s*\n)(?=[\s\S]*?type:\s*["']action["'])/s); - - // If not found, try lookbehind (type: "action" comes before version) - if (!versionMatch) { - versionMatch = fileContent.match(/(?<=type:\s*["']action["'][\s\S]{0,1000}?)(.*version:\s*["'])([^"']+)(["'],?\s*\n)/s); - } - + // Find and replace version + const versionMatch = fileContent.match(/(.*version:\s*["'])([^"']+)(["'],?\s*\n)/s); if (!versionMatch) { throw new Error('Could not find version field in file'); } @@ -279,7 +270,7 @@ class AnnotationApplier { const modifiedContent = this.applyAnnotations(fileContent, annotations); fs.writeFileSync(filePath, modifiedContent, 'utf8'); - this.recordModification(fileContent, actionKey, filePath); + this.recordModification(fileContent, actionKey); return true; } catch (error) { @@ -299,9 +290,8 @@ class AnnotationApplier { this.log(`Error processing ${filePath}: ${error.message}`, 'error'); } - recordModification(fileContent, actionKey, filePath) { + recordModification(fileContent, actionKey) { this.stats.modified++; - this.stats.modifiedFiles.push(filePath); const currentVersionMatch = fileContent.match(/version:\s*["']([^"']+)["']/); const currentVersion = currentVersionMatch ? currentVersionMatch[1] : 'unknown'; @@ -351,12 +341,6 @@ class AnnotationApplier { this.log('\n=== ERRORS ==='); this.errors.forEach(error => this.log(error, 'error')); } - - // Output modified files as JSON - if (this.stats.modifiedFiles.length > 0) { - this.log('\n=== MODIFIED FILES (JSON) ==='); - console.log(JSON.stringify(this.stats.modifiedFiles, null, 2)); - } } async run() { diff --git a/types/package.json b/types/package.json index d83ece932b6b1..f5c5c5248739e 100644 --- a/types/package.json +++ b/types/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/types", - "version": "0.3.2", + "version": "0.3.3", "description": "Pipedream TypeScript types", "keywords": [ "pipedream", From d6f20593d2981765279f3a444bd8b1951acc952e Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 30 Sep 2025 16:55:59 -0300 Subject: [PATCH 3/5] Adding idempotentHint --- types/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/src/index.ts b/types/src/index.ts index 2d8ef7f0f1de2..91f2c73e50af9 100644 --- a/types/src/index.ts +++ b/types/src/index.ts @@ -386,6 +386,7 @@ export interface Action< props?: ActionPropDefinitions; annotations?: { destructiveHint?: boolean; + idempotentHint?: boolean; openWorldHint?: boolean; readOnlyHint?: boolean; } From 4b100b9421f1d826b77e801a22f5aafcd42f0b07 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 4 Oct 2025 13:29:18 -0300 Subject: [PATCH 4/5] adding skiplibcheck --- types/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/tsconfig.json b/types/tsconfig.json index c9ce351b00baa..a66644eeb6ace 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -11,6 +11,7 @@ "lib": ["es6"], "strictFunctionTypes": true, "strictNullChecks": true, + "skipLibCheck": true, /* Skip type checking of declaration files in node_modules. */ "baseUrl": ".", "paths": { "@pipedream/types": ["."] } }, From 8dbcb816cf7a1303f3a8403163e6b9bb281ac0b8 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 4 Oct 2025 13:35:05 -0300 Subject: [PATCH 5/5] Removing unused ban-types rule --- types/src/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/types/src/index.ts b/types/src/index.ts index 91f2c73e50af9..6ea9aa5cf0c4b 100644 --- a/types/src/index.ts +++ b/types/src/index.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/ban-types */ /* eslint-disable @typescript-eslint/no-explicit-any */ export type JSONValue = | string @@ -70,7 +69,7 @@ export interface HTTPResponse { /** * Http Body */ - body: string | Buffer | NodeJS.ReadableStream; + body: string | Buffer | ReadableStream; /** * If true, issue the response when the promise returned is resolved, otherwise issue * the response at the end of the workflow execution @@ -115,13 +114,13 @@ export interface IApi { export interface IFile { delete(): Promise; - createReadStream(): Promise; - createWriteStream(contentType?: string, contentLength?: number): Promise; + createReadStream(): Promise; + createWriteStream(contentType?: string, contentLength?: number): Promise; toEncodedString(encoding?: string, start?: number, end?: number): Promise; toUrl(): Promise; toFile(localFilePath: string): Promise; toBuffer(): Promise; - fromReadableStream(readableStream: NodeJS.ReadableStream, contentType?: string, contentSize?: number): Promise; + fromReadableStream(readableStream: ReadableStream, contentType?: string, contentSize?: number): Promise; fromFile(localFilePath: string, contentType?: string): Promise; fromUrl(url: string, options?: any): Promise; toJSON(): any;