UNPKG

2.1 kBJavaScriptView Raw
1/* @flow */
2'use strict'
3
4/* ::
5import type BmResponse from './lib/bm-response.js'
6import type BlinkMobileIdentity from '@blinkmobile/bm-identity'
7*/
8
9/* ::
10export type BlinkMRC = {
11 server?: BlinkMRCServer
12}
13
14export 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
31export 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
46export 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
63export type CLIOptions = {
64 blinkMobileIdentity: BlinkMobileIdentity
65}
66
67export type CorsConfiguration = {
68 credentials: boolean,
69 exposedHeaders: Array<string>,
70 headers: Array<string>,
71 maxAge: number,
72 origins: Array<string>
73}
74
75export type Handler = (BmRequest, BmResponse) => any
76
77export type HandlerConfiguration = {
78 handler: Handler | void,
79 params: {
80 [id:string]: string
81 }
82}
83
84export type Headers = {
85 [id:string]: string
86}
87
88export 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
98export type MapObject = { [id:string]: any }
99
100export type ProjectConfig = {
101 load: () => Promise<BlinkMRC>,
102 update: ((BlinkMRC) => BlinkMRC) => Promise<BlinkMRC>
103}
104
105export type Protocol = 'http:' | 'https:'
106
107export type RouteConfiguration = {
108 route: string,
109 module: string,
110 timeout: number,
111 params?: {[id:string]: string}
112}
113*/