@pipedream/types
Advanced tools
Comparing version
/// <reference types="node" /> | ||
declare type JSONValue = string | number | boolean | null | JSONValue[] | { | ||
export declare type JSONValue = string | number | boolean | null | JSONValue[] | { | ||
[key: string]: JSONValue; | ||
}; | ||
declare type SendPayload = any; | ||
interface SendConfigHTTPKv { | ||
export declare type SendPayload = any; | ||
export interface SendConfigHTTPKv { | ||
[key: string]: string; | ||
} | ||
interface SendConfigHTTPAuth { | ||
export interface SendConfigHTTPAuth { | ||
username: string; | ||
password: string; | ||
} | ||
declare type UppercaseHTTPMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH"; | ||
interface SendConfigHTTP { | ||
export declare type UppercaseHTTPMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH"; | ||
export interface SendConfigHTTP { | ||
method?: UppercaseHTTPMethod; | ||
@@ -22,3 +22,3 @@ url: string; | ||
} | ||
interface SendConfigS3 { | ||
export interface SendConfigS3 { | ||
bucket: string; | ||
@@ -28,3 +28,3 @@ prefix: string; | ||
} | ||
interface SendConfigEmail { | ||
export interface SendConfigEmail { | ||
subject: string; | ||
@@ -34,10 +34,10 @@ text?: string; | ||
} | ||
interface SendConfigEmit { | ||
export interface SendConfigEmit { | ||
raw_event: SendPayload; | ||
} | ||
interface SendConfigSSE { | ||
export interface SendConfigSSE { | ||
channel: string; | ||
payload: SendPayload; | ||
} | ||
interface SendFunctionsWrapper { | ||
export interface SendFunctionsWrapper { | ||
http: (config: SendConfigHTTP) => void; | ||
@@ -52,3 +52,3 @@ email: (config: SendConfigEmail) => void; | ||
*/ | ||
interface HTTPResponse { | ||
export interface HTTPResponse { | ||
/** | ||
@@ -61,3 +61,3 @@ * HTTP Status | ||
*/ | ||
body: string | Buffer | ReadableStream; | ||
body: string | Buffer | NodeJS.ReadableStream; | ||
/** | ||
@@ -69,6 +69,9 @@ * If true, issue the response when the promise returned is resolved, otherwise issue | ||
} | ||
interface FlowFunctions { | ||
export declare type Methods = { | ||
[key: string]: Function; | ||
}; | ||
export interface FlowFunctions { | ||
exit: (reason: string) => void; | ||
} | ||
interface Pipedream { | ||
export interface Pipedream { | ||
export: (key: string, value: JSONValue) => void; | ||
@@ -84,30 +87,28 @@ send: SendFunctionsWrapper; | ||
} | ||
declare type UserPropType = "boolean" | "boolean[]" | "integer" | "integer[]" | "string" | "string[]" | "object" | "any"; | ||
declare type InterfacePropType = "$.interface.http" | "$.interface.timer"; | ||
declare type ServiceDBPropType = "$.service.db"; | ||
declare type DataStorePropType = "data_store"; | ||
declare type OptionsMethodArgs = { | ||
export declare type UserPropType = "boolean" | "boolean[]" | "integer" | "integer[]" | "string" | "string[]" | "object" | "any"; | ||
export declare type InterfacePropType = "$.interface.http" | "$.interface.timer"; | ||
export declare type ServiceDBPropType = "$.service.db"; | ||
export declare type DataStorePropType = "data_store"; | ||
export declare type OptionsMethodArgs = { | ||
page: number; | ||
prevContext: string; | ||
}; | ||
declare type DollarAuth<AuthKeys> = { | ||
$auth: Record<keyof AuthKeys, string>; | ||
}; | ||
interface App<AppPropDefinitions, Methods, AuthKeys> { | ||
export interface PropDefinitionReference { | ||
propDefinition: [App, string]; | ||
} | ||
export interface App { | ||
type: "app"; | ||
app: string; | ||
propDefinitions?: AppPropDefinitions | undefined; | ||
methods?: (Methods | undefined) & ThisType<AppPropDefinitions & Methods & DollarAuth<AuthKeys>>; | ||
$auth?: AuthKeys; | ||
methods?: (Methods | undefined) & ThisType<any>; | ||
} | ||
export declare function defineApp<AppPropDefinitions, Methods, AuthKeys>(app: App<AppPropDefinitions, Methods, AuthKeys>): App<AppPropDefinitions, Methods, AuthKeys>; | ||
interface DefaultConfig { | ||
export interface DefaultConfig { | ||
intervalSeconds?: number; | ||
cron?: string; | ||
} | ||
interface BasePropInterface { | ||
export interface BasePropInterface { | ||
label?: string; | ||
description?: string; | ||
} | ||
declare type PropOptions = string[] | { | ||
export declare type PropOptions = string[] | { | ||
[key: string]: string; | ||
@@ -117,8 +118,8 @@ }[]; | ||
type: UserPropType; | ||
options: PropOptions | ((opts: OptionsMethodArgs) => Promise<PropOptions>); | ||
optional: boolean; | ||
default: string; | ||
secret: boolean; | ||
min: number; | ||
max: number; | ||
options?: PropOptions | ((opts: OptionsMethodArgs) => Promise<PropOptions>); | ||
optional?: boolean; | ||
default?: JSONValue; | ||
secret?: boolean; | ||
min?: number; | ||
max?: number; | ||
} | ||
@@ -135,14 +136,23 @@ export interface InterfaceProp extends BasePropInterface { | ||
} | ||
interface Hooks { | ||
deploy?: () => Promise<void>; | ||
activate?: () => Promise<void>; | ||
deactivate?: () => Promise<void>; | ||
export interface SourcePropDefinitions { | ||
[name: string]: PropDefinitionReference | App | UserProp | InterfaceProp | ServiceDBProp; | ||
} | ||
interface SourceRunOptions { | ||
export interface ActionPropDefinitions { | ||
[name: string]: PropDefinitionReference | App | UserProp | DataStoreProp; | ||
} | ||
export interface AppPropDefinitions { | ||
[name: string]: PropDefinitionReference | App | UserProp; | ||
} | ||
export interface Hooks { | ||
deploy?: (this: any) => Promise<void>; | ||
activate?: (this: any) => Promise<void>; | ||
deactivate?: (this: any) => Promise<void>; | ||
} | ||
export interface SourceRunOptions { | ||
event: JSONValue; | ||
} | ||
interface ActionRunOptions { | ||
export interface ActionRunOptions { | ||
$: Pipedream; | ||
} | ||
interface EmitMetadata { | ||
export interface EmitMetadata { | ||
id?: string | number; | ||
@@ -157,12 +167,11 @@ name?: string; | ||
} | ||
declare type PropKeys<PropDefinitions> = Record<keyof PropDefinitions, string>; | ||
export interface Source<SourcePropDefinitions, Methods> { | ||
key?: string; | ||
export interface Source { | ||
key: string; | ||
name?: string; | ||
description?: string; | ||
version?: string; | ||
version: string; | ||
type: "source"; | ||
methods?: Methods & ThisType<any>; | ||
hooks?: Hooks & ThisType<any>; | ||
props: SourcePropDefinitions; | ||
props?: SourcePropDefinitions; | ||
dedupe?: "last" | "greatest" | "unique"; | ||
@@ -172,21 +181,12 @@ additionalProps?: (previousPropDefs: SourcePropDefinitions) => Promise<SourcePropDefinitions>; | ||
} | ||
export declare function defineSource<SourcePropDefinitions, Methods>(source: Source<SourcePropDefinitions, Methods>): Source<SourcePropDefinitions, Methods>; | ||
export interface Action<ActionPropDefinitions, Methods> { | ||
key?: string; | ||
export interface Action { | ||
key: string; | ||
name?: string; | ||
description?: string; | ||
version?: string; | ||
version: string; | ||
type: "action"; | ||
methods?: Methods & ThisType<any>; | ||
props: ActionPropDefinitions & ThisType<any>; | ||
props?: ActionPropDefinitions & ThisType<any>; | ||
additionalProps?: (previousPropDefs: ActionPropDefinitions) => Promise<ActionPropDefinitions>; | ||
run: (this: any, options?: ActionRunOptions) => Promise<void> & ThisType<PropKeys<ActionPropDefinitions> & Methods>; | ||
run: (this: any, options?: ActionRunOptions) => Promise<any>; | ||
} | ||
export declare function defineAction<ActionPropDefinitions, Methods>(action: Action<ActionPropDefinitions, Methods>): Action<ActionPropDefinitions, Methods>; | ||
export declare class HTTPError extends Error { | ||
statusCode: number; | ||
name: string; | ||
message: string; | ||
constructor(code: number, name: string, message: string); | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HTTPError = exports.defineAction = exports.defineSource = exports.defineApp = void 0; | ||
function defineApp(app) { | ||
return Object.assign({}, app); | ||
} | ||
exports.defineApp = defineApp; | ||
function defineSource(source) { | ||
return Object.assign({}, source); | ||
} | ||
exports.defineSource = defineSource; | ||
function defineAction(action) { | ||
return Object.assign({}, action); | ||
} | ||
exports.defineAction = defineAction; | ||
// Custom errors | ||
// HTTPErrors are used to throw status-code specific errors | ||
// in components that make HTTP requests | ||
class HTTPError extends Error { | ||
constructor(code, name, message) { | ||
super(message); | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = `HTTP${code}Error`; | ||
this.message = `(${name}) ${message}`; | ||
this.statusCode = code; | ||
} | ||
} | ||
exports.HTTPError = HTTPError; |
"use strict"; | ||
// Source methods the right `this` | ||
// Source run has the right `this` | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const stringData = "foo"; | ||
const num = 3; | ||
const bool = true; | ||
const n = null; | ||
const arr = [ | ||
"hello", | ||
"world", | ||
]; | ||
const arraysAreJSONToo = arr; | ||
const soAreObject = { | ||
"foo": "bar", | ||
"blah": [ | ||
"hello", | ||
"world", | ||
], | ||
"null": null, | ||
"bool": false, | ||
}; | ||
// $ExpectError | ||
const func = function () { console.log("foo"); }; | ||
const httpConfig = { | ||
method: "POST", | ||
url: "https://example.com", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
params: { | ||
foo: "bar", | ||
}, | ||
auth: { | ||
username: "user", | ||
password: "pass", | ||
}, | ||
data: { | ||
foo: "bar", | ||
}, | ||
}; | ||
// Source methods have the right `this` | ||
// Source run have the right `this` | ||
// Source hooks have the right `this` |
{ | ||
"name": "@pipedream/types", | ||
"version": "0.0.1", | ||
"description": "Pipedream TypeScript types", | ||
"main": "dist/index.js", | ||
"keywords": [ | ||
"pipedream", | ||
"typescript", | ||
"types" | ||
], | ||
"types": "dist/index.d.ts", | ||
"prepublish": "tsc", | ||
"homepage": "https://github.com/PipedreamHQ/pipedream", | ||
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": {} | ||
} | ||
"name": "@pipedream/types", | ||
"version": "0.0.2", | ||
"description": "Pipedream TypeScript types", | ||
"main": "dist/index.js", | ||
"keywords": [ | ||
"pipedream", | ||
"typescript", | ||
"types" | ||
], | ||
"types": "src", | ||
"prepublish": "test && tsc", | ||
"homepage": "https://github.com/PipedreamHQ/pipedream", | ||
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"dtslint": "^4.2.1" | ||
}, | ||
"scripts": { | ||
"test": "dtslint src" | ||
} | ||
} |
@@ -10,6 +10,2 @@ # `@pipedream/types` | ||
- `npm link` | ||
- (in this directory) `npm run dev` | ||
## Deploying | ||
Lerna deploys this package automatically on merge to `master`. Make sure to increment the `version` in `package.json`. | ||
- (in this directory) `npm run dev` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
763
26.74%22685
-18.37%1
Infinity%10
-28.57%1
Infinity%