-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add the `@pipedream/platform` types to the VCS * Improve the specificity of the DB schema types
- Loading branch information
Showing
10 changed files
with
249 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
!*.d.ts | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { AxiosRequestConfig } from "./index"; | ||
export declare function transformConfigForOauth(config: AxiosRequestConfig): { | ||
method: string; | ||
url: string; | ||
}; | ||
declare function callAxios(step: any, config: AxiosRequestConfig, signConfig?: any): Promise<any>; | ||
declare namespace callAxios { | ||
var create: (config?: AxiosRequestConfig | undefined, signConfig?: any) => import("axios").AxiosInstance; | ||
} | ||
export default callAxios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare const DEFAULT_POLLING_SOURCE_TIMER_INTERVAL: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export declare class ConfigurationError extends Error { | ||
exposeStack: boolean; | ||
constructor(message: string, exposeStack?: boolean); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import * as t from "io-ts"; | ||
import axios, { transformConfigForOauth } from "./axios"; | ||
import { AxiosRequestConfig as AxiosConfig } from "axios"; | ||
export { axios, transformConfigForOauth, }; | ||
export { cloneSafe, jsonStringifySafe, } from "./utils"; | ||
export { ConfigurationError, } from "./errors"; | ||
export { default as sqlProp, } from "./sql-prop"; | ||
export { default as sqlProxy, } from "./sql-proxy"; | ||
export { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, } from "./constants"; | ||
export declare const SendConfigEmail: t.PartialC<{ | ||
html: t.StringC; | ||
subject: t.StringC; | ||
text: t.StringC; | ||
}>; | ||
export declare type SendConfigEmail = t.TypeOf<typeof SendConfigEmail>; | ||
export declare const SendConfigEmit_required: t.ExactC<t.TypeC<{ | ||
raw_event: t.ObjectC; | ||
}>>; | ||
export declare const SendConfigEmit_optional: t.PartialC<{ | ||
event: t.ObjectC; | ||
}>; | ||
export declare const SendConfigEmit: t.IntersectionC<[t.ExactC<t.TypeC<{ | ||
raw_event: t.ObjectC; | ||
}>>, t.PartialC<{ | ||
event: t.ObjectC; | ||
}>]>; | ||
export declare type SendConfigEmit = t.TypeOf<typeof SendConfigEmit>; | ||
export declare const HTTP_METHODS: string[]; | ||
export declare const SendConfigHTTP: t.IntersectionC<[t.ExactC<t.TypeC<{ | ||
method: t.KeyofC<{}>; | ||
url: t.StringC; | ||
}>>, t.PartialC<{ | ||
auth: t.ExactC<t.TypeC<{ | ||
password: t.StringC; | ||
username: t.StringC; | ||
}>>; | ||
data: t.UnionC<[t.StringC, t.ObjectC]>; | ||
headers: t.ObjectC; | ||
params: t.ObjectC; | ||
}>]>; | ||
export declare type SendConfigHTTP = t.TypeOf<typeof SendConfigHTTP>; | ||
export declare const SendConfigS3: t.ExactC<t.TypeC<{ | ||
bucket: t.StringC; | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
prefix: t.StringC; | ||
}>>; | ||
export declare type SendConfigS3 = t.TypeOf<typeof SendConfigS3>; | ||
export declare const SendConfigSQL: t.ExactC<t.TypeC<{ | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
table: t.StringC; | ||
}>>; | ||
export declare type SendConfigSQL = t.TypeOf<typeof SendConfigSQL>; | ||
export declare const SendConfigSnowflake: t.ExactC<t.TypeC<{ | ||
account: t.StringC; | ||
database: t.StringC; | ||
host: t.StringC; | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
pipe_name: t.StringC; | ||
private_key: t.StringC; | ||
schema: t.StringC; | ||
stage_name: t.StringC; | ||
user: t.StringC; | ||
}>>; | ||
export declare type SendConfigSnowflake = t.TypeOf<typeof SendConfigSnowflake>; | ||
export declare const SendConfigSSE: t.ExactC<t.TypeC<{ | ||
channel: t.StringC; | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
}>>; | ||
export declare type SendConfigSSE = t.TypeOf<typeof SendConfigSSE>; | ||
interface SendFunctionsWrapper { | ||
email: (config: SendConfigEmail) => void; | ||
emit: (config: SendConfigEmit) => void; | ||
http: (config: SendConfigHTTP) => void; | ||
s3: (config: SendConfigS3) => void; | ||
sql: (config: SendConfigSQL) => void; | ||
snowflake: (config: SendConfigSnowflake) => void; | ||
sse: (config: SendConfigSSE) => void; | ||
} | ||
export declare const sendTypeMap: { | ||
email: t.PartialC<{ | ||
html: t.StringC; | ||
subject: t.StringC; | ||
text: t.StringC; | ||
}>; | ||
emit: t.IntersectionC<[t.ExactC<t.TypeC<{ | ||
raw_event: t.ObjectC; | ||
}>>, t.PartialC<{ | ||
event: t.ObjectC; | ||
}>]>; | ||
http: t.IntersectionC<[t.ExactC<t.TypeC<{ | ||
method: t.KeyofC<{}>; | ||
url: t.StringC; | ||
}>>, t.PartialC<{ | ||
auth: t.ExactC<t.TypeC<{ | ||
password: t.StringC; | ||
username: t.StringC; | ||
}>>; | ||
data: t.UnionC<[t.StringC, t.ObjectC]>; | ||
headers: t.ObjectC; | ||
params: t.ObjectC; | ||
}>]>; | ||
s3: t.ExactC<t.TypeC<{ | ||
bucket: t.StringC; | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
prefix: t.StringC; | ||
}>>; | ||
sql: t.ExactC<t.TypeC<{ | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
table: t.StringC; | ||
}>>; | ||
snowflake: t.ExactC<t.TypeC<{ | ||
account: t.StringC; | ||
database: t.StringC; | ||
host: t.StringC; | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
pipe_name: t.StringC; | ||
private_key: t.StringC; | ||
schema: t.StringC; | ||
stage_name: t.StringC; | ||
user: t.StringC; | ||
}>>; | ||
sse: t.ExactC<t.TypeC<{ | ||
channel: t.StringC; | ||
payload: t.UnionC<[t.StringC, t.ObjectC]>; | ||
}>>; | ||
}; | ||
export declare let $event: any; | ||
export declare const END_NEEDLE = "__pd_end"; | ||
export declare function $end(message?: string): void; | ||
export declare let $send: SendFunctionsWrapper; | ||
export declare const $sendConfigRuntimeTypeChecker: {}; | ||
export interface AxiosRequestConfig extends AxiosConfig { | ||
debug?: boolean; | ||
body?: any; | ||
returnFullResponse?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { JsonPrimitive } from "type-fest"; | ||
export declare type DbSchema = { | ||
[tableName: string]: { | ||
[columnName: string]: { | ||
columnDefault: JsonPrimitive; | ||
dataType: string; | ||
isNullable: boolean; | ||
tableSchema?: string; | ||
}; | ||
}; | ||
}; | ||
export declare type RowCount = { | ||
[tableName: string]: { | ||
_rowCount?: number; | ||
}; | ||
}; | ||
declare const _default: { | ||
methods: { | ||
/** | ||
* A helper method to get the schema of the database. Used by other features | ||
* (like the `sql` prop) to enrich the code editor and provide the user with | ||
* auto-complete and fields suggestion. | ||
* | ||
* @returns {DbSchema} The schema of the database, which is a | ||
* JSON-serializable object. | ||
* @throws {ConfigurationError} If the method is not implemented. | ||
*/ | ||
getSchema(): DbSchema | RowCount; | ||
}; | ||
}; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export declare type ClientConfiguration = object; | ||
export declare type ProxyArgs = { | ||
query: string; | ||
params?: unknown[]; | ||
}; | ||
export declare type ExecuteQueryArgs = object | string; | ||
export declare type Row = object; | ||
declare const _default: { | ||
methods: { | ||
/** | ||
* A helper method to get the configuration object that's directly fed to | ||
* the DB client constructor. Used by other features (like SQL proxy) to | ||
* initialize their client in an identical way. | ||
* | ||
* @returns The configuration object for the DB client | ||
*/ | ||
getClientConfiguration(): ClientConfiguration; | ||
/** | ||
* Executes a query against the database. This method takes care of | ||
* connecting to the database, executing the query, and closing the | ||
* connection. | ||
* | ||
* @param args - The query string or object to be sent to the DB. SQL query. | ||
* @returns The rows returned by the DB as a result of the query. | ||
*/ | ||
executeQuery(args: ExecuteQueryArgs): Row[]; | ||
/** | ||
* Adapts the arguments to `executeQuery` so that they can be consumed by | ||
* the SQL proxy (when applicable). Note that this method is not intended to | ||
* be used by the component directly. | ||
* | ||
* @param args - The query string or object to be sent to the DB. | ||
* @returns The adapted query and parameters. | ||
*/ | ||
proxyAdapter(args: ExecuteQueryArgs): ProxyArgs; | ||
/** | ||
* A method that performs the inverse transformation of `proxyAdapter`. | ||
* | ||
* @param args - The output of `proxyAdapter`. | ||
* @returns The query string or object to be sent to the DB. | ||
*/ | ||
executeQueryAdapter(args: ProxyArgs): ExecuteQueryArgs; | ||
}; | ||
}; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare function cloneSafe(o: any): any; | ||
export declare function jsonStringifySafe(v: any, set?: Set<any>): string | undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters