Merge pull request #31976 from javonharper/add-iopipe

Add iopipe-js
This commit is contained in:
Daniel Rosenwasser
2019-01-17 15:39:26 -08:00
committed by GitHub
4 changed files with 72 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for iopipe__iopipe 1.12
// Project: https://github.com/iopipe/iopipe (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.)
// Definitions by: Javon Harper <https://github.com/javonharper>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function iopipe(config?: iopipe.LibraryConfig): iopipe.FunctionWrapper;
declare namespace iopipe {
function label(label: string): void;
function metric(label: string, value: number): void;
namespace mark {
function start(label: string): void;
function end(label: string): void;
}
interface LibraryConfig {
debug?: boolean;
token?: string;
networkTimeout?: number;
timeoutWindow?: number;
}
type FunctionWrapper = (handler: any) => void;
}
export = iopipe;
@@ -0,0 +1,17 @@
import iopipe = require('iopipe__iopipe');
const config = {
token: "ABCDEFG"
};
function run(event: any, context: any, callback?: any) {
iopipe.label('my label');
iopipe.metric("magic number", 42);
iopipe.mark.start("my-db-call");
// an expensive database query
iopipe.mark.end("my-db-call");
}
iopipe(config)(run);
+26
View File
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"iopipe__iopipe-tests.ts"
],
"paths": {
"@iopipe/iopipe": ["iopipe__iopipe"]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }