1 | /* @flow */
|
2 |
|
3 |
|
4 | /* ::
|
5 | import type BmResponse from './lib/bm-response.js'
|
6 | import type BlinkMobileIdentity from '@blinkmobile/bm-identity'
|
7 | */
|
8 |
|
9 | /* ::
|
10 | export type BlinkMRC = {
|
11 | server?: BlinkMRCServer
|
12 | }
|
13 |
|
14 | export type BlinkMRCServer = {
|
15 | project?: string,
|
16 | region?: string,
|
17 | cors?: CorsConfiguration | boolean,
|
18 | routes?: Array<RouteConfiguration>,
|
19 | timeout?: number,
|
20 | service?: {
|
21 | bucket: string,
|
22 | origin: string
|
23 | },
|
24 | variables?: {
|
25 | [id:string]: string | {
|
26 | [id:string]: string
|
27 | }
|
28 | }
|
29 | }
|
30 |
|
31 | export type BmRequest = {
|
32 | body: any,
|
33 | headers: Headers,
|
34 | method: string,
|
35 | route: string,
|
36 | url: {
|
37 | host: string,
|
38 | hostname: string,
|
39 | params: { [id:string]: string },
|
40 | pathname: string,
|
41 | protocol: Protocol,
|
42 | query: { [id:string]: string }
|
43 | }
|
44 | }
|
45 |
|
46 | export type CLIFlags = {
|
47 | bmServerVersion: string,
|
48 | deploymentBucket?: string,
|
49 | cwd: string,
|
50 | env: string,
|
51 | executionRole?: string,
|
52 | filter?: string,
|
53 | force: boolean,
|
54 | out?: string,
|
55 | port?: string,
|
56 | region: string,
|
57 | startTime?: string,
|
58 | tail: boolean,
|
59 | vpcSecurityGroups?: string,
|
60 | vpcSubnets?: string
|
61 | }
|
62 |
|
63 | export type CLIOptions = {
|
64 | blinkMobileIdentity: BlinkMobileIdentity
|
65 | }
|
66 |
|
67 | export type CorsConfiguration = {
|
68 | credentials: boolean,
|
69 | exposedHeaders: Array<string>,
|
70 | headers: Array<string>,
|
71 | maxAge: number,
|
72 | origins: Array<string>
|
73 | }
|
74 |
|
75 | export type Handler = (BmRequest, BmResponse) => any
|
76 |
|
77 | export type HandlerConfiguration = {
|
78 | handler: Handler | void,
|
79 | params: {
|
80 | [id:string]: string
|
81 | }
|
82 | }
|
83 |
|
84 | export type Headers = {
|
85 | [id:string]: string
|
86 | }
|
87 |
|
88 | export type LambdaEvent = {
|
89 | body: any,
|
90 | headers: Headers,
|
91 | httpMethod: string,
|
92 | path: string,
|
93 | pathParameters: { [id:string]: string },
|
94 | queryStringParameters: { [id:string]: string },
|
95 | resource: string
|
96 | }
|
97 |
|
98 | export type MapObject = { [id:string]: any }
|
99 |
|
100 | export type ProjectConfig = {
|
101 | load: () => Promise<BlinkMRC>,
|
102 | update: ((BlinkMRC) => BlinkMRC) => Promise<BlinkMRC>
|
103 | }
|
104 |
|
105 | export type Protocol = 'http:' | 'https:'
|
106 |
|
107 | export type RouteConfiguration = {
|
108 | route: string,
|
109 | module: string,
|
110 | timeout: number,
|
111 | params?: {[id:string]: string}
|
112 | }
|
113 | */
|