Socket
Book a DemoInstallSign in
Socket

@pipedream/types

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pipedream/types - npm Package Compare versions

Comparing version

to
0.0.4

src/index.ts

133

dist/index.d.ts

@@ -64,7 +64,11 @@ /// <reference types="node" />

}
export declare type Methods = {
[key: string]: Function;
};
export interface Methods {
[key: string]: (...args: any) => unknown;
}
export interface FlowFunctions {
exit: (reason: string) => void;
delay: (ms: number) => {
resume_url: string;
cancel_url: string;
};
}

@@ -82,19 +86,30 @@ export interface Pipedream {

}
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;
};
export interface OptionsMethodArgs {
page?: number;
prevContext?: any;
[key: string]: any;
}
export interface OptionalOptsFn {
(configuredProps: {
[key: string]: any;
}): object;
}
export declare type PropDefinition = [
App<Methods, AppPropDefinitions>,
string
] | [
App<Methods, AppPropDefinitions>,
string,
OptionalOptsFn
];
export interface PropDefinitionReference {
propDefinition: [App, string];
propDefinition: PropDefinition;
}
export interface App {
export interface App<Methods, AppPropDefinitions> {
type: "app";
app: string;
propDefinitions?: AppPropDefinitions | undefined;
methods?: (Methods | undefined) & ThisType<any>;
propDefinitions?: AppPropDefinitions;
methods?: Methods & ThisType<Methods & AppPropDefinitions>;
}
export declare function defineApp<Methods, AppPropDefinitions>(app: App<Methods, AppPropDefinitions>): App<Methods, AppPropDefinitions>;
export interface DefaultConfig {

@@ -104,2 +119,28 @@ intervalSeconds?: number;

}
export interface Field {
name: string;
value: string;
}
export interface HttpAuth {
type?: "basic" | "bearer" | "none";
username?: string;
password?: string;
token?: string;
}
export interface HttpBody {
type?: "fields" | "raw";
contentType?: string;
fields?: Field[];
mode?: "fields" | "raw";
raw?: string;
}
export interface DefaultHttpRequestPropConfig {
auth?: HttpAuth;
body?: HttpBody;
headers?: Field[];
params?: Field[];
tab?: string;
method?: string;
url?: string;
}
export interface BasePropInterface {

@@ -109,8 +150,8 @@ label?: string;

}
export declare type PropOptions = string[] | {
export declare type PropOptions = any[] | Array<{
[key: string]: string;
}[];
}>;
export interface UserProp extends BasePropInterface {
type: UserPropType;
options?: PropOptions | ((opts: OptionsMethodArgs) => Promise<PropOptions>);
type: "boolean" | "boolean[]" | "integer" | "integer[]" | "string" | "string[]" | "object" | "any";
options?: PropOptions | ((this: any, opts: OptionsMethodArgs) => Promise<PropOptions>);
optional?: boolean;

@@ -123,24 +164,28 @@ default?: JSONValue;

export interface InterfaceProp extends BasePropInterface {
type: InterfacePropType;
default: string | DefaultConfig;
type: "$.interface.http" | "$.interface.timer";
default?: string | DefaultConfig;
}
export interface ServiceDBProp extends BasePropInterface {
type: ServiceDBPropType;
type: "$.service.db";
}
export interface DataStoreProp extends BasePropInterface {
type: DataStorePropType;
type: "data_store";
}
export interface HttpRequestProp extends BasePropInterface {
type: "http_request";
default?: DefaultHttpRequestPropConfig;
}
export interface SourcePropDefinitions {
[name: string]: PropDefinitionReference | App | UserProp | InterfaceProp | ServiceDBProp;
[name: string]: PropDefinitionReference | App<Methods, AppPropDefinitions> | UserProp | InterfaceProp | ServiceDBProp | HttpRequestProp;
}
export interface ActionPropDefinitions {
[name: string]: PropDefinitionReference | App | UserProp | DataStoreProp;
[name: string]: PropDefinitionReference | App<Methods, AppPropDefinitions> | UserProp | DataStoreProp | HttpRequestProp;
}
export interface AppPropDefinitions {
[name: string]: PropDefinitionReference | App | UserProp;
[name: string]: PropDefinitionReference | App<Methods, AppPropDefinitions> | UserProp;
}
export interface Hooks {
deploy?: (this: any) => Promise<void>;
activate?: (this: any) => Promise<void>;
deactivate?: (this: any) => Promise<void>;
deploy?: () => Promise<void>;
activate?: () => Promise<void>;
deactivate?: () => Promise<void>;
}

@@ -152,2 +197,3 @@ export interface SourceRunOptions {

$: Pipedream;
steps: JSONValue;
}

@@ -160,7 +206,9 @@ export interface EmitMetadata {

}
export interface EmitConfig {
event: JSONValue;
metadata?: EmitMetadata;
}
export interface Source {
declare type EmitFunction = {
$emit: (event: JSONValue, metadata: EmitMetadata) => Promise<void>;
};
declare type PropThis<Props> = {
[Prop in keyof Props]: Props[Prop] extends App<Methods, AppPropDefinitions> ? any : any;
};
export interface Source<Methods, SourcePropDefinitions> {
key: string;

@@ -171,10 +219,11 @@ name?: string;

type: "source";
methods?: Methods & ThisType<any>;
hooks?: Hooks & ThisType<any>;
methods?: Methods & ThisType<PropThis<SourcePropDefinitions> & Methods & EmitFunction>;
hooks?: Hooks & ThisType<PropThis<SourcePropDefinitions> & Methods & EmitFunction>;
props?: SourcePropDefinitions;
dedupe?: "last" | "greatest" | "unique";
additionalProps?: (previousPropDefs: SourcePropDefinitions) => Promise<SourcePropDefinitions>;
run: (this: any, options?: SourceRunOptions) => Promise<void>;
run: (this: PropThis<SourcePropDefinitions> & Methods & EmitFunction, options?: SourceRunOptions) => void | Promise<void>;
}
export interface Action {
export declare function defineSource<Methods, SourcePropDefinitions>(component: Source<Methods, SourcePropDefinitions>): Source<Methods, SourcePropDefinitions>;
export interface Action<Methods, ActionPropDefinitions> {
key: string;

@@ -185,6 +234,8 @@ name?: string;

type: "action";
methods?: Methods & ThisType<any>;
props?: ActionPropDefinitions & ThisType<any>;
methods?: Methods & ThisType<PropThis<ActionPropDefinitions> & Methods>;
props?: ActionPropDefinitions;
additionalProps?: (previousPropDefs: ActionPropDefinitions) => Promise<ActionPropDefinitions>;
run: (this: any, options?: ActionRunOptions) => Promise<any>;
run: (this: PropThis<ActionPropDefinitions> & Methods, options?: ActionRunOptions) => any;
}
export declare function defineAction<Methods, ActionPropDefinitions>(component: Action<Methods, ActionPropDefinitions>): Action<Methods, ActionPropDefinitions>;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defineAction = exports.defineSource = exports.defineApp = void 0;
function defineApp(app) {
return app;
}
exports.defineApp = defineApp;
function defineSource(component) {
return component;
}
exports.defineSource = defineSource;
function defineAction(component) {
return component;
}
exports.defineAction = defineAction;
{
"name": "@pipedream/types",
"version": "0.0.3",
"version": "0.0.4",
"description": "Pipedream TypeScript types",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -139,3 +139,3 @@ /* eslint-disable no-unused-vars, @typescript-eslint/no-unused-vars */

const googleSheets: Pipedream.App = {
const googleSheets: Pipedream.App<Pipedream.Methods, Pipedream.AppPropDefinitions> = {
type: "app",

@@ -162,3 +162,3 @@ app: "google_sheets",

const github: Pipedream.App = {
const github: Pipedream.App<Pipedream.Methods, Pipedream.AppPropDefinitions> = {
type: "app",

@@ -241,3 +241,3 @@ app: "github",

const source: Pipedream.Source = {
const source: Pipedream.Source<Pipedream.Methods, Pipedream.SourcePropDefinitions> = {
key: "source",

@@ -261,7 +261,9 @@ name: "Test Source",

dedupe: "unique",
async run(event) {
this.$emit(event, {
async run() {
this.$emit({
foo: "bar ",
}, {
id: "foo",
name: "channel",
summmary: "Summary",
summary: "Summary",
ts: 123,

@@ -275,23 +277,23 @@ });

// @ts-expect-error $ExpectError - Missing key
const sourceMissingKey: Pipedream.Source = {
const sourceMissingKey: Pipedream.Source<Pipedream.Methods, Pipedream.SourcePropDefinitions> = {
version: "0.0.1",
type: "source",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
// @ts-expect-error $ExpectError - Missing version
const sourceMissingVersion: Pipedream.Source = {
const sourceMissingVersion: Pipedream.Source<Pipedream.Methods, Pipedream.SourcePropDefinitions> = {
key: "foo",
type: "source",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
// @ts-expect-error $ExpectError - Missing type
const sourceMissingType: Pipedream.Source = {
const sourceMissingType: Pipedream.Source<Pipedream.Methods, Pipedream.SourcePropDefinitions> = {
key: "foo",
version: "0.0.1",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
const sourceWrongType: Pipedream.Source = {
const sourceWrongType: Pipedream.Source<Pipedream.Methods, Pipedream.SourcePropDefinitions> = {
key: "foo",

@@ -301,6 +303,6 @@ version: "0.0.1",

type: "action",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
const sourceWrongDedupeType: Pipedream.Source = {
const sourceWrongDedupeType: Pipedream.Source<Pipedream.Methods, Pipedream.SourcePropDefinitions> = {
key: "foo",

@@ -311,6 +313,6 @@ version: "0.0.1",

dedupe: "badValue",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
const sourceReturningDataShouldWarn: Pipedream.Source = {
const sourceReturningDataShouldWarn: Pipedream.Source<Pipedream.Methods, Pipedream.SourcePropDefinitions> = {
key: "foo",

@@ -323,3 +325,3 @@ version: "0.0.1",

const action: Pipedream.Action = {
const action: Pipedream.Action<Pipedream.Methods, Pipedream.ActionPropDefinitions> = {
key: "action",

@@ -349,23 +351,23 @@ name: "Test Action",

// @ts-expect-error $ExpectError - Missing key
const actionMissingKey: Pipedream.Action = {
const actionMissingKey: Pipedream.Action<Pipedream.Methods, Pipedream.ActionPropDefinitions> = {
version: "0.0.1",
type: "action",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
// @ts-expect-error $ExpectError - Missing version
const actionMissingVersion: Pipedream.Action = {
const actionMissingVersion: Pipedream.Action<Pipedream.Methods, Pipedream.ActionPropDefinitions> = {
key: "foo",
type: "action",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
// @ts-expect-error $ExpectError - Missing type
const actionMissingType: Pipedream.Action = {
const actionMissingType: Pipedream.Action<Pipedream.Methods, Pipedream.ActionPropDefinitions> = {
key: "foo",
version: "0.0.1",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
const actionWrongType: Pipedream.Action = {
const actionWrongType: Pipedream.Action<Pipedream.Methods, Pipedream.ActionPropDefinitions> = {
key: "foo",

@@ -375,3 +377,3 @@ version: "0.0.1",

type: "source",
run(event) { console.log("foo"); },
run() { console.log("foo"); },
};
SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.