/
generic.ts
76 lines (63 loc) · 1.49 KB
/
generic.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/** @module @twilio-labs/serverless-api */
import { Got } from 'got';
import { ClientConfig } from './client';
export type GotClient = Got;
export type EnvironmentVariables = {
[key: string]: string | undefined;
};
export type FileInfo = {
name: string;
path: string;
};
/**
* Necessary info to deploy a function
*/
export type ServerlessResourceConfig = {
/**
* Access for the function
*/
access: AccessOptions;
/**
* Content of the uploaded function
*/
content: string | Buffer;
/**
* Function name
*/
name: string;
/**
* Path for the serverless resource
* Functions: '/some-function'
* Assets: '/some-assets.jpg'
*/
path: string;
};
export type ServerlessResourceConfigWithFilePath = ServerlessResourceConfig & {
/**
* Path to the actual file on the file system.
*/
filePath: string;
};
export type FunctionResource = ServerlessResourceConfig & {
sid: string;
} & Partial<ServerlessResourceConfigWithFilePath>;
export type AssetResource = ServerlessResourceConfig & {
sid: string;
} & Partial<ServerlessResourceConfigWithFilePath>;
export type Dependency = {
name: string;
version: string;
};
export type Variable = {
key: string;
value: string;
};
export type AccessOptions = 'private' | 'protected' | 'public';
export type ResourcePathAndAccess = {
path: string;
access: AccessOptions;
};
export type DirectoryContent = {
assets: ServerlessResourceConfigWithFilePath[];
functions: ServerlessResourceConfigWithFilePath[];
};