Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/types",
"version": "0.3.2",
"version": "0.3.3",
"description": "Pipedream TypeScript types",
"keywords": [
"pipedream",
Expand Down
15 changes: 10 additions & 5 deletions types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
export type JSONValue =
| string
Expand Down Expand Up @@ -70,7 +69,7 @@ export interface HTTPResponse {
/**
* Http Body
*/
body: string | Buffer | NodeJS.ReadableStream;
body: string | Buffer | ReadableStream;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Non-blocking-

I'm not sure if it matters, but I think the instances of ReadableStream in this file could instead be Readable. And WritableStream could be Writeable. For example:

import {
  Readable, Writable,
} from "stream";
// ...
body: string | Buffer | Readable;
// ...
export interface IFile {
  delete(): Promise<void>;
  createReadStream(): Promise<Readable>;
  createWriteStream(contentType?: string, contentLength?: number): Promise<Writable>;
  toEncodedString(encoding?: string, start?: number, end?: number): Promise<string>;
  toUrl(): Promise<string>;
  toFile(localFilePath: string): Promise<void>;
  toBuffer(): Promise<Buffer>;
  fromReadableStream(readableStream: Readable, contentType?: string, contentSize?: number): Promise<IFile>;

If you call File.fromReadableStream(readStream) with a stream derived from fs.createReadStream(), for example, then the readStream would have the type fs.ReadStream, which extends stream.Readable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - I'll follow up on this. Shipping the current change for now to unblock building components

/**
* If true, issue the response when the promise returned is resolved, otherwise issue
* the response at the end of the workflow execution
Expand Down Expand Up @@ -115,13 +114,13 @@ export interface IApi {

export interface IFile {
delete(): Promise<void>;
createReadStream(): Promise<NodeJS.ReadableStream>;
createWriteStream(contentType?: string, contentLength?: number): Promise<NodeJS.WritableStream>;
createReadStream(): Promise<ReadableStream>;
createWriteStream(contentType?: string, contentLength?: number): Promise<WritableStream>;
toEncodedString(encoding?: string, start?: number, end?: number): Promise<string>;
toUrl(): Promise<string>;
toFile(localFilePath: string): Promise<void>;
toBuffer(): Promise<Buffer>;
fromReadableStream(readableStream: NodeJS.ReadableStream, contentType?: string, contentSize?: number): Promise<IFile>;
fromReadableStream(readableStream: ReadableStream, contentType?: string, contentSize?: number): Promise<IFile>;
fromFile(localFilePath: string, contentType?: string): Promise<IFile>;
fromUrl(url: string, options?: any): Promise<IFile>;
toJSON(): any;
Expand Down Expand Up @@ -384,6 +383,12 @@ export interface Action<
type: "action";
methods?: Methods & ThisType<PropThis<ActionPropDefinitions> & Methods>;
props?: ActionPropDefinitions;
annotations?: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should add idempotentHint? while you're at it, even though we aren't backfilling that value for any components right now

destructiveHint?: boolean;
idempotentHint?: boolean;
openWorldHint?: boolean;
readOnlyHint?: boolean;
}
additionalProps?: (
previousPropDefs: ActionPropDefinitions
) => Promise<ActionPropDefinitions>;
Expand Down
1 change: 1 addition & 0 deletions types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": ["."] }
},
Expand Down
Loading