@pipedream/types
Advanced tools
Comparing version
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
export declare type JSONValue = string | number | boolean | null | JSONValue[] | { | ||
export type JSONValue = string | number | boolean | null | JSONValue[] | { | ||
[key: string]: JSONValue; | ||
}; | ||
export declare type SendPayload = any; | ||
export type SendPayload = any; | ||
export interface SendConfigHTTPKv { | ||
@@ -14,3 +14,3 @@ [key: string]: string; | ||
} | ||
export declare type UppercaseHTTPMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH"; | ||
export type UppercaseHTTPMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH"; | ||
export interface SendConfigHTTP { | ||
@@ -71,7 +71,42 @@ method?: UppercaseHTTPMethod; | ||
exit: (reason: string) => void; | ||
delay: (ms: number) => { | ||
delay: (ms: number, context: object) => { | ||
resume_url: string; | ||
cancel_url: string; | ||
}; | ||
rerun: (ms: number, context: object) => { | ||
resume_url: string; | ||
cancel_url: string; | ||
}; | ||
suspend: (ms: number, context: object) => { | ||
resume_url: string; | ||
cancel_url: string; | ||
}; | ||
refreshTimeout: () => string; | ||
} | ||
export interface IApi { | ||
open(path: string): IFile; | ||
openDescriptor(descriptor: any): IFile; | ||
dir(path?: string): AsyncGenerator<{ | ||
isDirectory: () => boolean; | ||
isFile: () => boolean; | ||
path: string; | ||
name: string; | ||
size?: number; | ||
modifiedAt?: Date; | ||
file?: IFile; | ||
}>; | ||
} | ||
export interface IFile { | ||
delete(): Promise<void>; | ||
createReadStream(): Promise<ReadableStream<any>>; | ||
createWriteStream(contentType?: string, contentLength?: number): Promise<WritableStream<any>>; | ||
toEncodedString(encoding?: string, start?: number, end?: number): Promise<string>; | ||
toUrl(): Promise<string>; | ||
toFile(localFilePath: string): Promise<void>; | ||
toBuffer(): Promise<Buffer>; | ||
fromReadableStream(readableStream: ReadableStream<any>, contentType?: string, contentSize?: number): Promise<IFile>; | ||
fromFile(localFilePath: string, contentType?: string): Promise<IFile>; | ||
fromUrl(url: string, options?: any): Promise<IFile>; | ||
toJSON(): any; | ||
} | ||
export interface Pipedream { | ||
@@ -87,2 +122,3 @@ export: (key: string, value: JSONValue) => void; | ||
flow: FlowFunctions; | ||
files: IApi; | ||
} | ||
@@ -99,3 +135,3 @@ export interface OptionsMethodArgs { | ||
} | ||
export declare type PropDefinition = [ | ||
export type PropDefinition = [ | ||
App<Methods, AppPropDefinitions>, | ||
@@ -152,3 +188,3 @@ string | ||
} | ||
export declare type PropOptions = any[] | Array<{ | ||
export type PropOptions = any[] | Array<{ | ||
[key: string]: string; | ||
@@ -193,3 +229,3 @@ }>; | ||
} | ||
export declare type SourceHttpRunOptions = { | ||
export type SourceHttpRunOptions = { | ||
method: string; | ||
@@ -208,7 +244,7 @@ path: string; | ||
}; | ||
export declare type SourceTimerRunOptions = { | ||
export type SourceTimerRunOptions = { | ||
timestamp: number; | ||
interval_seconds: number; | ||
}; | ||
export declare type SourceRunOptions = SourceHttpRunOptions | SourceTimerRunOptions; | ||
export type SourceRunOptions = SourceHttpRunOptions | SourceTimerRunOptions; | ||
export interface ActionRunOptions { | ||
@@ -224,6 +260,6 @@ $: Pipedream; | ||
} | ||
declare type EmitFunction = { | ||
type EmitFunction = { | ||
$emit: (event: JSONValue, metadata?: EmitMetadata) => Promise<void>; | ||
}; | ||
declare type PropThis<Props> = { | ||
type PropThis<Props> = { | ||
[Prop in keyof Props]: Props[Prop] extends App<Methods, AppPropDefinitions> ? any : any; | ||
@@ -230,0 +266,0 @@ }; |
@@ -107,17 +107,2 @@ "use strict"; | ||
}; | ||
const flowFunctions = { | ||
exit: (reason) => { console.log(reason); }, | ||
delay: (ms) => { | ||
return { | ||
resume_url: "https://example.com", | ||
cancel_url: "https://example.com", | ||
}; | ||
}, | ||
}; | ||
const theDollar = { | ||
export: (key, value) => { console.log("foo"); }, | ||
send: dollarSend, | ||
respond: (response) => { console.log("foo"); }, | ||
flow: flowFunctions, | ||
}; | ||
const googleSheets = { | ||
@@ -124,0 +109,0 @@ type: "app", |
{ | ||
"name": "@pipedream/types", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"description": "Pipedream TypeScript types", | ||
@@ -24,6 +24,7 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/node": "^20.9.2", | ||
"dtslint": "^4.2.1" | ||
}, | ||
"dependencies": { | ||
"typescript": "^4.6.4" | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -30,0 +31,0 @@ "scripts": { |
23456
3.77%619
3.51%2
100%+ Added
- Removed
Updated