UNPKG

2.76 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as ts from 'typescript';
3import { EventEmitter } from 'events';
4export interface Hooks {
5 precompile?: string;
6 postcompile?: string;
7 preinstall?: string;
8 postinstall?: string;
9 prezip?: string;
10 postzip?: string;
11 predeploy?: string;
12 postdeploy?: string;
13 prebuild?: string;
14 postbuild?: string;
15}
16export interface FunctionOptions {
17 projectName: string;
18 name: string;
19 description: string;
20 memory?: number;
21 timeout?: number;
22 role?: string;
23 runtime?: string;
24 environment: {
25 [index: string]: string;
26 };
27 handler: string;
28 buildDir: string;
29 installCmd?: string;
30 hooks?: Hooks;
31 deploy?: {
32 using: string;
33 };
34}
35export interface TemplateContext {
36 [index: string]: any;
37}
38export interface CompileResultSuccess {
39 diagnostics: ts.Diagnostic[];
40 externals: ts.ResolvedModuleFull[];
41 success: true;
42}
43export interface CompileResultFailure {
44 diagnostics: ts.Diagnostic[];
45 success: false;
46}
47export declare type CompileResult = CompileResultSuccess | CompileResultFailure;
48export interface AlttEnvironment {
49}
50export declare type AnyPromise = Promise<any>;
51export declare type TaskFunction = (input?: any) => AnyPromise;
52export interface Task extends EventEmitter {
53 name: string;
54 error: boolean;
55 done: boolean;
56 running: boolean;
57 run(): Promise<void>;
58}
59export declare type Deployer = (environment: AlttEnvironment, argv: string[]) => Promise<void>;
60export interface AlttFunction {
61 alttOptions: FunctionOptions;
62 name: string;
63 env: AlttEnvironment;
64 root: string;
65 dir: string;
66 buildDir: string;
67 entry: string;
68 tsOptions: ts.CompilerOptions;
69 zipPath: string;
70 prepare(): Promise<void>;
71 compile(): Promise<CompileResult>;
72 installDependencies(): Promise<void>;
73 zip(): Promise<void>;
74}
75export interface LambdaClientContext {
76 client: {
77 installation_id: string;
78 app_title: string;
79 app_version_name: string;
80 app_version_code: string;
81 app_package_name: string;
82 };
83 Custom: any;
84 env: {
85 platform_version: string;
86 platform: string;
87 make: string;
88 model: string;
89 locale: string;
90 };
91}
92export interface LambdaContext {
93 getRemainingTimeInMillis(): number;
94 callbackWaitsForEmptyEventLoop: boolean;
95 functionName: string;
96 functionVersion: string;
97 invokedFunctionArn: string;
98 memoryLimitInMB: number;
99 awsRequestId: string;
100 logGroupName: string;
101 logStreamName: string;
102 identity: string | null;
103 clientContext: LambdaClientContext | null;
104}
105export declare type LambdaCallback<T> = (error: any, result: T) => void;