flowtyped everything, some functional, safety, and structural changes

This commit is contained in:
41666 2019-03-10 03:18:11 -05:00
parent 6f3eca7a64
commit d2aecb38ca
92 changed files with 17554 additions and 1440 deletions

View file

@ -1,8 +1,14 @@
{ {
"presets": [ "presets": [ ["@babel/preset-env", {
"next/babel" "targets": {
], "node": true
}
}], "@babel/preset-flow" ],
"plugins": [ "plugins": [
"transform-flow-strip-types" "@babel/plugin-syntax-dynamic-import",
] "@babel/plugin-proposal-class-properties",
["@babel/plugin-transform-runtime",
{ "helpers": false }]
],
"ignore": ["ui/**/*"]
} }

View file

@ -1,4 +0,0 @@
{
"extends": [ "standard" ],
"parser": "babel-eslint"
}

4
.gitignore vendored
View file

@ -1,9 +1,11 @@
.env .env
*.env *.env
dist
/docker-compose.test.yml /docker-compose.test.yml
node_modules node_modules
.vscode .vscode
.data .data
yarn-error\.log

View file

@ -10,4 +10,4 @@ FROM mhart/alpine-node:10
ENV NODE_ENV production ENV NODE_ENV production
WORKDIR /dist WORKDIR /dist
COPY --from=builder /src /dist COPY --from=builder /src /dist
CMD node index.js CMD npm start

View file

@ -1,29 +1,94 @@
const log = new (require('./logger'))('Roleypoly') // @flow
const Sequelize = require('sequelize') import Sequelize from 'sequelize'
const fetchModels = require('./models') import Next from 'next'
const fetchApis = require('./api') import betterRouter from 'koa-better-router'
const Next = require('next') import EventEmitter from 'events'
const betterRouter = require('koa-better-router') import fs from 'fs'
import logger from './logger'
import ServerService from './services/server'
import DiscordService from './services/discord'
import SessionService from './services/sessions'
import PresentationService from './services/presentation'
import RPCServer from './rpc'
import fetchModels, { type Models } from './models'
import fetchApis from './api'
import type SocketIO from 'socket.io'
import type KoaApp, { Context } from 'koa'
const log = logger(__filename)
type HTTPHandler = (path: string, handler: (ctx: Context, next: () => void) => any) => void
export type Router = {
get: HTTPHandler,
post: HTTPHandler,
patch: HTTPHandler,
delete: HTTPHandler,
put: HTTPHandler,
middleware: () => any
}
export type AppContext = {
config: {
appUrl: string,
dev: boolean,
hotReload: boolean
},
ui: Next,
uiHandler: Next.Handler,
io: SocketIO,
server: ServerService,
discord: DiscordService,
sessions: SessionService,
P: PresentationService,
RPC: RPCServer,
M: Models,
sql: Sequelize
}
class Roleypoly { class Roleypoly {
constructor (io, app) { ctx: AppContext|any
io: SocketIO
router: Router
M: Models
__app: KoaApp
__initialized: Promise<void>
__apiWatcher: EventEmitter
__rpcWatcher: EventEmitter
constructor (io: SocketIO, app: KoaApp) {
this.io = io this.io = io
this.ctx = {}
this.ctx.config = {
appUrl: process.env.APP_URL,
dev: process.env.NODE_ENV !== 'production',
hotReload: process.env.NO_HOT_RELOAD !== '1'
}
this.ctx.io = io
this.__app = app this.__app = app
if (log.debugOn) log.warn('debug mode is on') if (log.debugOn) log.warn('debug mode is on')
const dev = process.env.NODE_ENV !== 'production' const dev = process.env.NODE_ENV !== 'production'
this.ctx.ui = Next({ dev, dir: './ui' })
this.ctx.uiHandler = this.ctx.ui.getRequestHandler() // simple check if we're in a compiled situation or not.
let uiDir = './ui'
if (!fs.existsSync(uiDir) && fs.existsSync('../ui')) {
uiDir = '../ui'
}
const ui = Next({ dev, dir: uiDir })
const uiHandler = ui.getRequestHandler()
const appUrl = process.env.APP_URL
if (appUrl == null) {
throw new Error('APP_URL was unset.')
}
this.ctx = {
config: {
appUrl,
dev,
hotReload: process.env.NO_HOT_RELOAD !== '1'
},
io,
ui,
uiHandler
}
this.__initialized = this._mountServices() this.__initialized = this._mountServices()
} }
@ -33,31 +98,30 @@ class Roleypoly {
} }
async _mountServices () { async _mountServices () {
const sequelize = new Sequelize(process.env.DB_URL, { logging: log.sql.bind(log, log) }) const dbUrl: ?string = process.env.DB_URL
if (dbUrl == null) {
throw log.fatal('DB_URL not set.')
}
const sequelize = new Sequelize(dbUrl, { logging: log.sql.bind(log, log) })
this.ctx.sql = sequelize this.ctx.sql = sequelize
this.M = fetchModels(sequelize) this.M = fetchModels(sequelize)
this.ctx.M = this.M this.ctx.M = this.M
await sequelize.sync() await sequelize.sync()
// this.ctx.redis = new (require('ioredis'))({ this.ctx.server = new ServerService(this.ctx)
// port: process.env.REDIS_PORT || '6379', this.ctx.discord = new DiscordService(this.ctx)
// host: process.env.REDIS_HOST || 'localhost', this.ctx.sessions = new SessionService(this.ctx)
// parser: 'hiredis', this.ctx.P = new PresentationService(this.ctx)
// dropBufferSupport: true, this.ctx.RPC = new RPCServer(this)
// enableReadyCheck: true,
// enableOfflineQueue: true
// })
this.ctx.server = new (require('./services/server'))(this.ctx)
this.ctx.discord = new (require('./services/discord'))(this.ctx)
this.ctx.sessions = new (require('./services/sessions'))(this.ctx)
this.ctx.P = new (require('./services/presentation'))(this.ctx)
} }
async loadRoutes (forceClear = false) { async loadRoutes (forceClear: boolean = false) {
await this.ctx.ui.prepare() await this.ctx.ui.prepare()
this.router = betterRouter().loadMethods() this.router = betterRouter().loadMethods()
fetchApis(this.router, this.ctx, { forceClear }) fetchApis(this.router, this.ctx, { forceClear })
this.ctx.RPC.hookRoutes(this.router)
// after routing, add the * for ui handler // after routing, add the * for ui handler
this.router.get('*', async ctx => { this.router.get('*', async ctx => {
@ -83,6 +147,12 @@ class Roleypoly {
hotMiddleware = await this.loadRoutes(true) hotMiddleware = await this.loadRoutes(true)
}) })
this.__rpcWatcher = chokidar.watch('rpc/**')
this.__rpcWatcher.on('all', (path) => {
log.info('reloading RPCs...', path)
this.ctx.RPC.reload()
})
// custom passthrough so we use a specially scoped middleware. // custom passthrough so we use a specially scoped middleware.
mw = (ctx, next) => { mw = (ctx, next) => {
return hotMiddleware(ctx, next) return hotMiddleware(ctx, next)

5
UI/.babelrc Normal file
View file

@ -0,0 +1,5 @@
{
"presets": [
"next/babel", "@babel/preset-flow"
]
}

View file

@ -1,3 +1,6 @@
// @flow
import * as React from 'react'
export const colors = { export const colors = {
white: '#efefef', white: '#efefef',
c9: '#EBD6D4', c9: '#EBD6D4',
@ -12,7 +15,7 @@ export const colors = {
} }
const getColors = () => { const getColors = () => {
Object.keys(colors).map(key => { return Object.keys(colors).map(key => {
const nk = key.replace(/c([0-9])/, '$1') const nk = key.replace(/c([0-9])/, '$1')
return `--c-${nk}: ${colors[key]};` return `--c-${nk}: ${colors[key]};`
}).join(' \n') }).join(' \n')
@ -26,6 +29,18 @@ body {
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
/* prevent FOUC */
transition: opacity 0.2s ease-in-out;
opacity: 0;
}
.wf-active body {
opacity: 1;
}
// FOUC guard if we take too long
.force-active body {
opacity: 1;
} }
.font-sans-serif { .font-sans-serif {

View file

@ -0,0 +1,11 @@
// @flow
import * as React from 'react'
import HeaderBarCommon from './common'
const HeaderBarAuth: React.StatelessFunctionalComponent<{}> = () => (
<HeaderBarCommon>
hi
</HeaderBarCommon>
)
export default HeaderBarAuth

View file

@ -0,0 +1,14 @@
// @flow
import * as React from 'react'
export type CommonProps = {
children: React.Element<any>
}
const HeaderBarCommon: React.StatelessFunctionalComponent<CommonProps> = ({ children }) => (
<div>
{ children }
</div>
)
export default HeaderBarCommon

View file

@ -0,0 +1,11 @@
// @flow
import * as React from 'react'
import HeaderBarCommon from './common'
const HeaderBarUnauth: React.StatelessFunctionalComponent<{}> = () => (
<HeaderBarCommon>
hi
</HeaderBarCommon>
)
export default HeaderBarUnauth

View file

@ -0,0 +1,36 @@
// @flow
import * as React from 'react'
import NextHead from 'next/head'
export type SocialCardProps = {
title?: string,
description?: string,
image?: string,
imageSize?: number
}
const defaultProps: SocialCardProps = {
title: 'Roleypoly',
description: 'Tame your Discord roles.',
image: 'https://rp.kat.cafe/static/social.png',
imageSize: 200
}
const SocialCards: React.StatelessFunctionalComponent<SocialCardProps> = (props) => {
props = {
...defaultProps,
...props
}
return <NextHead>
<meta key='og:title' property='og:title' content={props.title} />
<meta key='og:description' property='og:description' content={props.description} />
<meta key='twitter:card' name='twitter:card' content='summary_large_image' />
<meta key='twitter:image' name='twitter:image' content={props.image} />
<meta key='og:image' property='og:image' content={props.image} />
<meta key='og:image:width' property='og:image:width' content={props.imageSize} />
<meta key='og:image:height' property='og:image:height' content={props.imageSize} />
</NextHead>
}
export default SocialCards

15
UI/config/redux.js Normal file
View file

@ -0,0 +1,15 @@
import { createStore, applyMiddleware } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunkMiddleware from 'redux-thunk'
import withNextRedux from 'next-redux-wrapper'
import { rootReducer } from 'fast-redux'
export const initStore = (initialState = {}) => {
return createStore(
rootReducer,
initialState,
composeWithDevTools(applyMiddleware(thunkMiddleware))
)
}
export const withRedux = (comp) => withNextRedux(initStore)(comp)

4
UI/config/rpc.js Normal file
View file

@ -0,0 +1,4 @@
// @flow
import RPCClient from '../rpc'
export default (new RPCClient({ forceDev: false })).rpc

View file

@ -0,0 +1,30 @@
// @flow
import * as React from 'react'
import dynamic from 'next/dynamic'
import { withRedux } from '../config/redux'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { namespaceConfig } from 'fast-redux'
import * as User from './user'
type Props = {
user: User.User
}
const HeaderBarAuth = dynamic(() => import('../components/header/auth'))
const HeaderBarUnauth = dynamic(() => import('../components/header/unauth'))
const HeaderBar: React.StatelessFunctionalComponent<Props> = () => {
// if ()
return null
}
const mapStateToProps = (state): Props => {
return {}
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({ }, dispatch)
}
export default withRedux(connect(mapStateToProps, mapDispatchToProps)(HeaderBar))

32
UI/containers/user.js Normal file
View file

@ -0,0 +1,32 @@
// @flow
import { namespaceConfig } from 'fast-redux'
export type User = {
id: string,
username: string,
discriminator: string,
avatar: string,
nicknameCache: {
[server: string]: string
}
}
export type UserState = {
currentUser: User | null,
userCache: {
[id: string]: User
}
}
const DEFAULT_STATE: UserState = {
currentUser: null,
userCache: {}
}
export const {
action, getState: getUserStore
} = namespaceConfig('userStore', DEFAULT_STATE)
export const getCurrentUser = () => async (dispatch: Function) => {
}

View file

@ -1,6 +1,9 @@
import * as React from 'react'
import App, { Container } from 'next/app' import App, { Container } from 'next/app'
import Head from 'next/head' import Head from 'next/head'
import GlobalColors from '../components/global-colors' import GlobalColors from '../components/global-colors'
import SocialCards from '../components/social-cards'
// import RPCClient from '../rpc'
class RoleypolyApp extends App { class RoleypolyApp extends App {
static async getInitialProps ({ Component, ctx }) { static async getInitialProps ({ Component, ctx }) {
@ -15,6 +18,7 @@ class RoleypolyApp extends App {
componentDidMount () { componentDidMount () {
this.loadTypekit(document) this.loadTypekit(document)
this.waitForFOUC()
} }
loadTypekit (d) { loadTypekit (d) {
@ -42,14 +46,26 @@ class RoleypolyApp extends App {
s.parentNode.insertBefore(tk, s) s.parentNode.insertBefore(tk, s)
} }
// wait one second, add FOUC de-protection.
waitForFOUC () {
setTimeout(() => {
document.documentElement.className += ' force-active'//
}, 2000)
}
render () { render () {
const { Component, pageProps, router } = this.props const { Component, pageProps, router, rpc } = this.props
return ( return (
<Container> <Container>
<Head /> <Head>
<meta charSet='utf-8' />
<title key='title'>Roleypoly</title>
<meta name='viewport' content='width=device-width, initial-scale=1' />
</Head>
<GlobalColors /> <GlobalColors />
<Component {...pageProps} router={router} /> <SocialCards />
<Component {...pageProps} router={router} rpc={rpc} />
</Container> </Container>
) )
} }

View file

@ -1,7 +1,19 @@
const Server = ({ router: { query: { id } } }) => ( // @flow
<div> import * as React from 'react'
{id} import Head from 'next/head'
</div> import type { PageProps } from '../../types'
) import SocialCards from '../../components/social-cards'
export default Server export default class Server extends React.Component<PageProps> {
render () {
return (
<div>
<Head>
<title key='title'>server name!</title>
</Head>
<SocialCards title={'server test'} />
hello {this.props.router.query.id}
</div>
)
}
}

View file

@ -5,24 +5,24 @@ import Nav from '../components/nav'
const Home = () => ( const Home = () => (
<div> <div>
<Head title="Home" /> <Head title='Home' />
<Nav /> <Nav />
<div className="hero"> <div className='hero'>
<h1 className="title">Welcome to Next!</h1> <h1 className='title'>Welcome to Next!</h1>
<p className="description"> <p className='description'>
To get started, edit <code>pages/index.js</code> and save to reload. To get started, edit <code>pages/index.js</code> and save to reload.
</p> </p>
<div className="row"> <div className='row'>
<Link href="https://github.com/zeit/next.js#getting-started"> <Link href='https://github.com/zeit/next.js#getting-started'>
<a className="card"> <a className='card'>
<h3>Getting Started &rarr;</h3> <h3>Getting Started &rarr;</h3>
<p>Learn more about Next on Github and in their examples</p> <p>Learn more about Next on Github and in their examples</p>
</a> </a>
</Link> </Link>
<Link href="https://open.segment.com/create-next-app"> <Link href='https://open.segment.com/create-next-app'>
<a className="card"> <a className='card'>
<h3>Examples &rarr;</h3> <h3>Examples &rarr;</h3>
<p> <p>
Find other example boilerplates on the{' '} Find other example boilerplates on the{' '}
@ -30,8 +30,8 @@ const Home = () => (
</p> </p>
</a> </a>
</Link> </Link>
<Link href="https://github.com/segmentio/create-next-app"> <Link href='https://github.com/segmentio/create-next-app'>
<a className="card"> <a className='card'>
<h3>Create Next App &rarr;</h3> <h3>Create Next App &rarr;</h3>
<p>Was this tool helpful? Let us know how we can improve it</p> <p>Was this tool helpful? Let us know how we can improve it</p>
</a> </a>

24
UI/pages/testrpc.js Normal file
View file

@ -0,0 +1,24 @@
import * as React from 'react'
import RPC from '../config/rpc'
export default class TestRPC extends React.Component {
static async getInitialProps (ctx) {
return {
// hello: await RPC.hello('world')
}
}
componentDidMount () {
window.$RPC = RPC
}
componentDidCatch (error, errorInfo) {
if (error) {
console.log(error, errorInfo)
}
}
render () {
return <div>hello, { this.props.hello }</div>
}
}

106
UI/rpc/index.js Normal file
View file

@ -0,0 +1,106 @@
// @flow
import superagent from 'superagent'
import RPCError from '../../rpc/_error'
export type RPCResponse = {
response?: mixed,
hash?: string,
// error stuff
error?: boolean,
msg?: string,
trace?: string
}
export type RPCRequest = {
fn: string,
args: mixed[]
}
export default class RPCClient {
dev: boolean = false
baseUrl: string
firstKnownHash: string
recentHash: string
rpc: {
[fn: string]: (...args: any[]) => Promise<mixed> | string
} = {}
__rpcAvailable: Array<{
name: string,
args: number
}> = []
constructor ({ forceDev, baseUrl = '/api/_rpc' }: { forceDev?: boolean, baseUrl?: string } = {}) {
this.baseUrl = (process.env.APP_URL || '') + baseUrl
if (forceDev != null) {
this.dev = forceDev
} else {
this.dev = process.env.NODE_ENV === 'development'
}
this.rpc = new Proxy({
toJSON () {
return '{}'
}
}, { get: this.__rpcCall, has: this.__checkCall, ownKeys: this.__listCalls, delete: () => {} })
if (this.dev) {
this.updateCalls()
}
}
async updateCalls () {
// this is for development only. doing in prod is probably dumb.
const rsp = await superagent.get(this.baseUrl)
if (rsp.status !== 200) {
console.error(rsp)
return
}
const { hash, available } = rsp.body
this.__rpcAvailable = available
if (this.firstKnownHash == null) {
this.firstKnownHash = hash
}
this.recentHash = hash
// just kinda prefill. none of these get called anyway.
// and don't matter in prod either.
for (let { name } of available) {
this.rpc[name] = async () => {}
}
}
async call (fn: string, ...args: any[]): mixed {
const req: RPCRequest = { fn, args }
const rsp = await superagent.post(this.baseUrl).send(req).ok(() => true)
const body: RPCResponse = rsp.body
if (body.error === true) {
throw RPCError.fromResponse(body, rsp.status)
}
if (body.hash != null) {
if (this.firstKnownHash == null) {
this.firstKnownHash = body.hash
}
this.recentHash = body.hash
if (this.firstKnownHash !== this.recentHash) {
this.updateCalls()
}
}
return body.response
}
// PROXY HANDLERS
__rpcCall = (_: {}, fn: string) => this.call.bind(this, fn)
__checkCall = (_: {}, fn: string) => this.dev ? this.__listCalls(_).includes(fn) : true
__listCalls = (_: {}): string[] => this.__rpcAvailable.map(x => x.name)
}

8
UI/types.js Normal file
View file

@ -0,0 +1,8 @@
// @flow
export type PageProps = {
router: {
query: {
[key: string]: string
}
}
}

View file

@ -1,6 +1,11 @@
module.exports = (R, $) => { // @flow
R.post('/api/auth/token', async (ctx) => { import { type Context } from 'koa'
const { token } = ctx.request.body import { type AppContext, type Router } from '../Roleypoly'
import ksuid from 'ksuid'
export default (R: Router, $: AppContext) => {
R.post('/api/auth/token', async (ctx: Context) => {
const { token } = ((ctx.request.body: any): { token: string })
if (token == null || token === '') { if (token == null || token === '') {
ctx.body = { err: 'token_missing' } ctx.body = { err: 'token_missing' }
@ -29,14 +34,15 @@ module.exports = (R, $) => {
} }
}) })
R.get('/api/auth/user', async ctx => { R.get('/api/auth/user', async (ctx: Context) => {
if (ctx.session.accessToken === undefined) { const { accessToken } = (ctx.session: { accessToken?: string })
if (accessToken === undefined) {
ctx.body = { err: 'not_logged_in' } ctx.body = { err: 'not_logged_in' }
ctx.status = 401 ctx.status = 401
return return
} }
const user = await $.discord.getUser(ctx.session.accessToken) const user = await $.discord.getUser(accessToken)
ctx.session.userId = user.id ctx.session.userId = user.id
ctx.session.avatarHash = user.avatar ctx.session.avatarHash = user.avatar
@ -48,8 +54,8 @@ module.exports = (R, $) => {
} }
}) })
R.get('/api/auth/redirect', ctx => { R.get('/api/auth/redirect', async (ctx: Context) => {
const url = $.discord.getAuthUrl() const url = $.discord.getAuthUrl(ksuid.randomSync().string)
if (ctx.query.url === '✔️') { if (ctx.query.url === '✔️') {
ctx.body = { url } ctx.body = { url }
return return
@ -58,11 +64,11 @@ module.exports = (R, $) => {
ctx.redirect(url) ctx.redirect(url)
}) })
R.post('/api/auth/logout', ctx => { R.post('/api/auth/logout', async (ctx: Context) => {
ctx.session = null ctx.session = null
}) })
R.get('/api/oauth/bot', ctx => { R.get('/api/oauth/bot', async (ctx: Context) => {
const url = $.discord.getBotJoinUrl() const url = $.discord.getBotJoinUrl()
if (ctx.query.url === '✔️') { if (ctx.query.url === '✔️') {
ctx.body = { url } ctx.body = { url }
@ -72,7 +78,7 @@ module.exports = (R, $) => {
ctx.redirect(url) ctx.redirect(url)
}) })
R.get('/api/oauth/bot/callback', ctx => { R.get('/api/oauth/bot/callback', async (ctx: Context) => {
console.log(ctx.request) // console.log(ctx.request)
}) })
} }

View file

@ -1,9 +1,14 @@
const log = new (require('../logger'))('api/index') // @flow
const glob = require('glob') import logger from '../logger'
import glob from 'glob'
import type { Router, AppContext } from '../Roleypoly'
const log = logger(__filename)
const PROD = process.env.NODE_ENV === 'production' const PROD = process.env.NODE_ENV === 'production'
module.exports = async (router, ctx, { forceClear = false } = {}) => { export default async (router: Router, ctx: AppContext, { forceClear = false }: { forceClear: boolean } = {}) => {
const apis = glob.sync(`./api/**/!(index).js`) const apis = glob.sync(`./api/**/!(index).js`)
log.debug('found apis', apis) log.debug('found apis', apis)
@ -18,7 +23,8 @@ module.exports = async (router, ctx, { forceClear = false } = {}) => {
if (forceClear) { if (forceClear) {
delete require.cache[require.resolve(pathname)] delete require.cache[require.resolve(pathname)]
} }
require(pathname)(router, ctx) // $FlowFixMe this isn't an important error. potentially dangerous, but irrelevant.
require(pathname).default(router, ctx)
} catch (e) { } catch (e) {
log.error(`couldn't mount ${a}`, e) log.error(`couldn't mount ${a}`, e)
} }

View file

@ -1,5 +1,10 @@
module.exports = (R, $) => { // @flow
R.get('/api/servers', async (ctx) => { import { type Context } from 'koa'
import { type AppContext, type Router } from '../Roleypoly'
import { type ServerModel } from '../models/Server'
export default (R: Router, $: AppContext) => {
R.get('/api/servers', async (ctx: Context) => {
try { try {
const { userId } = ctx.session const { userId } = ctx.session
const srv = $.discord.getRelevantServers(userId) const srv = $.discord.getRelevantServers(userId)
@ -11,7 +16,7 @@ module.exports = (R, $) => {
} }
}) })
R.get('/api/server/:id', async (ctx) => { R.get('/api/server/:id', async (ctx: Context) => {
const { userId } = ctx.session const { userId } = ctx.session
const { id } = ctx.params const { id } = ctx.params
@ -28,17 +33,21 @@ module.exports = (R, $) => {
gm = $.discord.gm(id, userId) gm = $.discord.gm(id, userId)
} else if ($.discord.isRoot(userId)) { } else if ($.discord.isRoot(userId)) {
gm = $.discord.fakeGm({ id: userId }) gm = $.discord.fakeGm({ id: userId })
} else { }
if (gm == null) {
ctx.body = { err: 'not_a_member' } ctx.body = { err: 'not_a_member' }
ctx.status = 400 ctx.status = 400
return return
} }
const server = await $.P.presentableServer(srv, gm) const server = await $.P.presentableServer(srv, gm)
// $FlowFixMe bad koa type
ctx.body = server ctx.body = server
}) })
R.get('/api/server/:id/slug', async (ctx) => { R.get('/api/server/:id/slug', async (ctx: Context) => {
// const { userId } = ctx.session // const { userId } = ctx.session
const { id } = ctx.params const { id } = ctx.params
@ -52,16 +61,25 @@ module.exports = (R, $) => {
return return
} }
// $FlowFixMe bad koa type
ctx.body = await $.P.serverSlug(srv) ctx.body = await $.P.serverSlug(srv)
}) })
R.patch('/api/server/:id', async (ctx) => { R.patch('/api/server/:id', async (ctx: Context) => {
const { userId } = ctx.session const { userId } = (ctx.session: { userId: string })
const { id } = ctx.params const { id } = (ctx.params: { id: string })
let gm = $.discord.gm(id, userId) let gm = $.discord.gm(id, userId)
if (gm == null && $.discord.isRoot(userId)) { if (gm == null) {
gm = $.discord.fakeGm({ id: userId }) if ($.discord.isRoot(userId)) {
gm = $.discord.fakeGm({ id: userId })
} else {
ctx.status = 403
ctx.body = {
err: 'not permitted'
}
return
}
} }
// check perms // check perms
@ -71,7 +89,7 @@ module.exports = (R, $) => {
return return
} }
const { message = null, categories = null } = ctx.request.body const { message, categories } = ((ctx.request.body: any): $Shape<ServerModel>)
// todo make less nasty // todo make less nasty
await $.server.update(id, { await $.server.update(id, {
@ -82,32 +100,33 @@ module.exports = (R, $) => {
ctx.body = { ok: true } ctx.body = { ok: true }
}) })
R.get('/api/admin/servers', async ctx => { R.get('/api/admin/servers', async (ctx: Context) => {
const { userId } = ctx.session const { userId } = (ctx.session: { userId: string })
if (!$.discord.isRoot(userId)) { if (!$.discord.isRoot(userId)) {
return return
} }
ctx.body = $.discord.client.guilds.map(g => ({ url: `${process.env.APP_URL}/s/${g.id}`, name: g.name, members: g.members.array().length, roles: g.roles.array().length })) ctx.body = $.discord.client.guilds.map(g => ({ url: `${$.config.appUrl}/s/${g.id}`, name: g.name, members: g.members.array().length, roles: g.roles.array().length }))
}) })
R.patch('/api/servers/:server/roles', async ctx => { R.patch('/api/servers/:server/roles', async (ctx: Context) => {
const { userId } = ctx.session const { userId } = (ctx.session: { userId: string })
const { server } = ctx.params const { server } = (ctx.params: { server: string })
let gm = $.discord.gm(server, userId) let gm = $.discord.gm(server, userId)
if (gm == null && $.discord.isRoot(userId)) { if (gm == null) {
gm = $.discord.fakeGm({ id: userId }) if ($.discord.isRoot(userId)) {
gm = $.discord.fakeGm({ id: userId })
} else {
ctx.status = 403
ctx.body = {
err: 'not permitted'
}
return
}
} }
// check perms const { added, removed } = ((ctx.request.body: any): { added: string[], removed: string[] })
// if (!$.discord.getPermissions(gm).canManageRoles) {
// ctx.status = 403
// ctx.body = { err: 'cannot_manage_roles' }
// return
// }
const { added, removed } = ctx.request.body
const allowedRoles = await $.server.getAllowedRoles(server) const allowedRoles = await $.server.getAllowedRoles(server)
@ -118,13 +137,20 @@ module.exports = (R, $) => {
} }
setTimeout(() => { setTimeout(() => {
if (gm == null) {
ctx.body = {
err: 'guild member disappeared on remove, this should never happen.'
}
ctx.status = 500
return
}
if (removed.length > 0) { if (removed.length > 0) {
gm.removeRoles(removed.filter(pred)) gm.removeRoles(removed.filter(pred))
} }
}, 1000) }, 1000)
// console.log('role patch', { added, removed, allowedRoles, addedFiltered: added.filterNot(pred), removedFiltered: removed.filterNot(pred) })
ctx.body = { ok: true } ctx.body = { ok: true }
}) })
} }

View file

@ -1,25 +1,28 @@
module.exports = (R, $) => { // @flow
R.get('/api/~/relevant-servers/:user', (ctx, next) => { import { type Context } from 'koa'
import { type AppContext, type Router } from '../Roleypoly'
export default (R: Router, $: AppContext) => {
R.get('/api/~/relevant-servers/:user', async (ctx: Context, next: () => void) => {
// ctx.body = 'ok' // ctx.body = 'ok'
const srv = $.discord.getRelevantServers(ctx.params.user) const srv = $.discord.getRelevantServers(ctx.params.user)
ctx.body = $.discord.presentableServers(srv, ctx.params.user) ctx.body = $.P.presentableServers(srv, ctx.params.user)
}) })
R.get('/api/~/roles/:id/:userId', (ctx, next) => { // R.get('/api/~/roles/:id/:userId', (ctx, next) => {
// ctx.body = 'ok' // // ctx.body = 'ok'
const { id, userId } = ctx.params // const { id, userId } = ctx.params
const srv = $.discord.client.guilds.get(id) // const srv = $.discord.client.guilds.get(id)
if (srv === undefined) { // if (srv === undefined) {
ctx.body = { err: 'not found' } // ctx.body = { err: 'not found' }
ctx.status = 404 // ctx.status = 404
return // return
} // }
const gm = srv.members.get(userId) // const gm = srv.members.get(userId)
const roles = $.discord.presentableRoles(id, gm) // const roles = $.P.presentableRoles(id, gm)
ctx.boy = roles // ctx.boy = roles
}) // })
} }

View file

@ -1,17 +1,36 @@
// note, this file only contains stuff for complicated routes. // @flow
// next.js will handle anything beyond this. import { type Context } from 'koa'
module.exports = (R, $) => { import { type AppContext, type Router } from '../Roleypoly'
const processMappings = mapping => { export default (R: Router, $: AppContext) => {
// note, this file only contains stuff for complicated routes.
// next.js will handle anything beyond this.
const processMappings = (mapping: { [path: string]: { path: string, noAutoFix?: boolean } }) => {
for (let p in mapping) { for (let p in mapping) {
R.get(p, ctx => { R.get(p, (ctx: Context) => {
return $.ui.render(ctx.req, ctx.res, mapping[p], { ...ctx.query, ...ctx.params }) return $.ui.render(ctx.req, ctx.res, mapping[p].path || mapping[p], { ...ctx.query, ...ctx.params })
}) })
const { path } = mapping[p]
if (!mapping[p].noAutoFix) {
R.get(path, ctx => ctx.redirect(p))
}
} }
} }
processMappings({ processMappings({
'/s/add': '/_internal/_server_add', '/s/add': { path: '/_internal/_server_add' },
'/s/:id': '/_internal/_server', '/s/:id': { path: '/_internal/_server', noAutoFix: true },
'/test': '/test' '/test': { path: '/test_wwsw' }
}) })
// edge cases
R.get('/_internal/_server', (ctx: Context) => {
if (ctx.query.id) {
return ctx.redirect(`/s/${ctx.query.id}`)
}
return ctx.redirect('/s/add')
})
R.get('/s/', (ctx: Context) => ctx.redirect('/s/add'))
} }

6
babel.config.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
babelrcRoots: [
'.'
],
ignore: [ './ui', './node_modules', './flow-typed' ]
}

35
flow-typed/next.js vendored Normal file
View file

@ -0,0 +1,35 @@
// @flow
declare module 'next' {
declare type NextApp = {
prepare(): Promise<void>;
getRequestHandler(): any;
render(req: any, res: any, pathname: string, query: any): any;
renderToHTML(req: any, res: any, pathname: string, query: string): string;
renderError(err: Error, req: any, res: any, pathname: any, query: any): any;
renderErrorToHTML(err: Error, req: any, res: any, pathname: string, query: any): string;
};
declare module.exports: (...opts: any) => NextApp
}
declare module 'next/head' {
declare module.exports: Class<React$Component<any, any>>;
}
declare module 'next/link' {
declare module.exports: Class<React$Component<{href: string, prefetch?: bool}, any>>;
}
declare module 'next/error' {
declare module.exports: Class<React$Component<{statusCode: number}, any>>;
}
declare module 'next/document' {
declare export var Head: Class<React$Component<any, any>>;
declare export var Main: Class<React$Component<any, any>>;
declare export var NextScript: Class<React$Component<any, any>>;
declare export default Class<React$Component<any, any>> & {
getInitialProps: (ctx: {pathname: string, query: any, req?: any, res?: any, err?: any}) => Promise<any>;
renderPage(cb: Function): void;
};
}

87
flow-typed/npm/@babel/cli_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,87 @@
// flow-typed signature: 74fab1906a8a81fd7bcd9d6693845eba
// flow-typed version: <<STUB>>/@babel/cli_v^7.2.3/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* '@babel/cli'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@babel/cli' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@babel/cli/bin/babel-external-helpers' {
declare module.exports: any;
}
declare module '@babel/cli/bin/babel' {
declare module.exports: any;
}
declare module '@babel/cli/lib/babel-external-helpers' {
declare module.exports: any;
}
declare module '@babel/cli/lib/babel/dir' {
declare module.exports: any;
}
declare module '@babel/cli/lib/babel/file' {
declare module.exports: any;
}
declare module '@babel/cli/lib/babel/index' {
declare module.exports: any;
}
declare module '@babel/cli/lib/babel/options' {
declare module.exports: any;
}
declare module '@babel/cli/lib/babel/util' {
declare module.exports: any;
}
// Filename aliases
declare module '@babel/cli/bin/babel-external-helpers.js' {
declare module.exports: $Exports<'@babel/cli/bin/babel-external-helpers'>;
}
declare module '@babel/cli/bin/babel.js' {
declare module.exports: $Exports<'@babel/cli/bin/babel'>;
}
declare module '@babel/cli/index' {
declare module.exports: $Exports<'@babel/cli'>;
}
declare module '@babel/cli/index.js' {
declare module.exports: $Exports<'@babel/cli'>;
}
declare module '@babel/cli/lib/babel-external-helpers.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel-external-helpers'>;
}
declare module '@babel/cli/lib/babel/dir.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/dir'>;
}
declare module '@babel/cli/lib/babel/file.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/file'>;
}
declare module '@babel/cli/lib/babel/index.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/index'>;
}
declare module '@babel/cli/lib/babel/options.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/options'>;
}
declare module '@babel/cli/lib/babel/util.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/util'>;
}

46
flow-typed/npm/@babel/node_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,46 @@
// flow-typed signature: 9634098c001c2efa44e659b57f7d4b14
// flow-typed version: <<STUB>>/@babel/node_v^7.2.2/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* '@babel/node'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@babel/node' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@babel/node/bin/babel-node' {
declare module.exports: any;
}
declare module '@babel/node/lib/_babel-node' {
declare module.exports: any;
}
declare module '@babel/node/lib/babel-node' {
declare module.exports: any;
}
// Filename aliases
declare module '@babel/node/bin/babel-node.js' {
declare module.exports: $Exports<'@babel/node/bin/babel-node'>;
}
declare module '@babel/node/lib/_babel-node.js' {
declare module.exports: $Exports<'@babel/node/lib/_babel-node'>;
}
declare module '@babel/node/lib/babel-node.js' {
declare module.exports: $Exports<'@babel/node/lib/babel-node'>;
}

View file

@ -0,0 +1,144 @@
// flow-typed signature: 748b5d288cc53368f09f32c65aff2c02
// flow-typed version: <<STUB>>/@babel/preset-env_v^7.3.4/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* '@babel/preset-env'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@babel/preset-env' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@babel/preset-env/data/built-in-features' {
declare module.exports: any;
}
declare module '@babel/preset-env/data/plugin-features' {
declare module.exports: any;
}
declare module '@babel/preset-env/data/shipped-proposals' {
declare module.exports: any;
}
declare module '@babel/preset-env/data/unreleased-labels' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/available-plugins' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/built-in-definitions' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/debug' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/default-includes' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/defaults' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/index' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/module-transformations' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/normalize-options' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/options' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/targets-parser' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/use-built-ins-entry-plugin' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/use-built-ins-plugin' {
declare module.exports: any;
}
declare module '@babel/preset-env/lib/utils' {
declare module.exports: any;
}
// Filename aliases
declare module '@babel/preset-env/data/built-in-features.js' {
declare module.exports: $Exports<'@babel/preset-env/data/built-in-features'>;
}
declare module '@babel/preset-env/data/plugin-features.js' {
declare module.exports: $Exports<'@babel/preset-env/data/plugin-features'>;
}
declare module '@babel/preset-env/data/shipped-proposals.js' {
declare module.exports: $Exports<'@babel/preset-env/data/shipped-proposals'>;
}
declare module '@babel/preset-env/data/unreleased-labels.js' {
declare module.exports: $Exports<'@babel/preset-env/data/unreleased-labels'>;
}
declare module '@babel/preset-env/lib/available-plugins.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/available-plugins'>;
}
declare module '@babel/preset-env/lib/built-in-definitions.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/built-in-definitions'>;
}
declare module '@babel/preset-env/lib/debug.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/debug'>;
}
declare module '@babel/preset-env/lib/default-includes.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/default-includes'>;
}
declare module '@babel/preset-env/lib/defaults.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/defaults'>;
}
declare module '@babel/preset-env/lib/index.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/index'>;
}
declare module '@babel/preset-env/lib/module-transformations.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/module-transformations'>;
}
declare module '@babel/preset-env/lib/normalize-options.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/normalize-options'>;
}
declare module '@babel/preset-env/lib/options.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/options'>;
}
declare module '@babel/preset-env/lib/targets-parser.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/targets-parser'>;
}
declare module '@babel/preset-env/lib/use-built-ins-entry-plugin.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/use-built-ins-entry-plugin'>;
}
declare module '@babel/preset-env/lib/use-built-ins-plugin.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/use-built-ins-plugin'>;
}
declare module '@babel/preset-env/lib/utils.js' {
declare module.exports: $Exports<'@babel/preset-env/lib/utils'>;
}

View file

@ -0,0 +1,32 @@
// flow-typed signature: ad96fb37691315cf15ed6c2a7d890024
// flow-typed version: <<STUB>>/@babel/preset-flow_v^7.0.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* '@babel/preset-flow'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@babel/preset-flow' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@babel/preset-flow/lib/index' {
declare module.exports: any;
}
// Filename aliases
declare module '@babel/preset-flow/lib/index.js' {
declare module.exports: $Exports<'@babel/preset-flow/lib/index'>;
}

32
flow-typed/npm/@discordjs/uws_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,32 @@
// flow-typed signature: fc5d257a33526e413374777a0ca3fa56
// flow-typed version: <<STUB>>/@discordjs/uws_v^11.149.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* '@discordjs/uws'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@discordjs/uws' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@discordjs/uws/uws' {
declare module.exports: any;
}
// Filename aliases
declare module '@discordjs/uws/uws.js' {
declare module.exports: $Exports<'@discordjs/uws/uws'>;
}

View file

@ -0,0 +1,403 @@
// flow-typed signature: 79c7c0ba71f3008918485db388c0023b
// flow-typed version: <<STUB>>/@primer/components_v^11.0.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* '@primer/components'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module '@primer/components' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@primer/components/codemods/__tests__/v1' {
declare module.exports: any;
}
declare module '@primer/components/codemods/__tests__/v2' {
declare module.exports: any;
}
declare module '@primer/components/codemods/__tests__/v3' {
declare module.exports: any;
}
declare module '@primer/components/codemods/__tests__/v4' {
declare module.exports: any;
}
declare module '@primer/components/codemods/lib/modifyProps' {
declare module.exports: any;
}
declare module '@primer/components/codemods/lib/prettify' {
declare module.exports: any;
}
declare module '@primer/components/codemods/lib/renameImports' {
declare module.exports: any;
}
declare module '@primer/components/codemods/lib/replaceImportSource' {
declare module.exports: any;
}
declare module '@primer/components/codemods/v1' {
declare module.exports: any;
}
declare module '@primer/components/codemods/v2' {
declare module.exports: any;
}
declare module '@primer/components/codemods/v3' {
declare module.exports: any;
}
declare module '@primer/components/codemods/v4' {
declare module.exports: any;
}
declare module '@primer/components/css' {
declare module.exports: any;
}
declare module '@primer/components/dist/css' {
declare module.exports: any;
}
declare module '@primer/components/dist/index.esm' {
declare module.exports: any;
}
declare module '@primer/components/dist/index.umd' {
declare module.exports: any;
}
declare module '@primer/components/src/Avatar' {
declare module.exports: any;
}
declare module '@primer/components/src/AvatarPair' {
declare module.exports: any;
}
declare module '@primer/components/src/BaseStyles' {
declare module.exports: any;
}
declare module '@primer/components/src/BorderBox' {
declare module.exports: any;
}
declare module '@primer/components/src/Box' {
declare module.exports: any;
}
declare module '@primer/components/src/BranchName' {
declare module.exports: any;
}
declare module '@primer/components/src/Button' {
declare module.exports: any;
}
declare module '@primer/components/src/ButtonDanger' {
declare module.exports: any;
}
declare module '@primer/components/src/ButtonOutline' {
declare module.exports: any;
}
declare module '@primer/components/src/ButtonPrimary' {
declare module.exports: any;
}
declare module '@primer/components/src/ButtonStyles' {
declare module.exports: any;
}
declare module '@primer/components/src/Caret' {
declare module.exports: any;
}
declare module '@primer/components/src/CircleBadge' {
declare module.exports: any;
}
declare module '@primer/components/src/CircleOcticon' {
declare module.exports: any;
}
declare module '@primer/components/src/constants' {
declare module.exports: any;
}
declare module '@primer/components/src/CounterLabel' {
declare module.exports: any;
}
declare module '@primer/components/src/css' {
declare module.exports: any;
}
declare module '@primer/components/src/Details' {
declare module.exports: any;
}
declare module '@primer/components/src/Donut' {
declare module.exports: any;
}
declare module '@primer/components/src/Dropdown' {
declare module.exports: any;
}
declare module '@primer/components/src/DropdownStyles' {
declare module.exports: any;
}
declare module '@primer/components/src/FilterList' {
declare module.exports: any;
}
declare module '@primer/components/src/Flash' {
declare module.exports: any;
}
declare module '@primer/components/src/Flex' {
declare module.exports: any;
}
declare module '@primer/components/src/Heading' {
declare module.exports: any;
}
declare module '@primer/components/src/index' {
declare module.exports: any;
}
declare module '@primer/components/src/Label' {
declare module.exports: any;
}
declare module '@primer/components/src/Link' {
declare module.exports: any;
}
declare module '@primer/components/src/PointerBox' {
declare module.exports: any;
}
declare module '@primer/components/src/Position' {
declare module.exports: any;
}
declare module '@primer/components/src/PrimerComponentsAnimation' {
declare module.exports: any;
}
declare module '@primer/components/src/StateLabel' {
declare module.exports: any;
}
declare module '@primer/components/src/StyledOcticon' {
declare module.exports: any;
}
declare module '@primer/components/src/Text' {
declare module.exports: any;
}
declare module '@primer/components/src/TextInput' {
declare module.exports: any;
}
declare module '@primer/components/src/theme' {
declare module.exports: any;
}
declare module '@primer/components/src/Tooltip' {
declare module.exports: any;
}
declare module '@primer/components/src/UnderlineNav' {
declare module.exports: any;
}
// Filename aliases
declare module '@primer/components/codemods/__tests__/v1.js' {
declare module.exports: $Exports<'@primer/components/codemods/__tests__/v1'>;
}
declare module '@primer/components/codemods/__tests__/v2.js' {
declare module.exports: $Exports<'@primer/components/codemods/__tests__/v2'>;
}
declare module '@primer/components/codemods/__tests__/v3.js' {
declare module.exports: $Exports<'@primer/components/codemods/__tests__/v3'>;
}
declare module '@primer/components/codemods/__tests__/v4.js' {
declare module.exports: $Exports<'@primer/components/codemods/__tests__/v4'>;
}
declare module '@primer/components/codemods/lib/modifyProps.js' {
declare module.exports: $Exports<'@primer/components/codemods/lib/modifyProps'>;
}
declare module '@primer/components/codemods/lib/prettify.js' {
declare module.exports: $Exports<'@primer/components/codemods/lib/prettify'>;
}
declare module '@primer/components/codemods/lib/renameImports.js' {
declare module.exports: $Exports<'@primer/components/codemods/lib/renameImports'>;
}
declare module '@primer/components/codemods/lib/replaceImportSource.js' {
declare module.exports: $Exports<'@primer/components/codemods/lib/replaceImportSource'>;
}
declare module '@primer/components/codemods/v1.js' {
declare module.exports: $Exports<'@primer/components/codemods/v1'>;
}
declare module '@primer/components/codemods/v2.js' {
declare module.exports: $Exports<'@primer/components/codemods/v2'>;
}
declare module '@primer/components/codemods/v3.js' {
declare module.exports: $Exports<'@primer/components/codemods/v3'>;
}
declare module '@primer/components/codemods/v4.js' {
declare module.exports: $Exports<'@primer/components/codemods/v4'>;
}
declare module '@primer/components/css.js' {
declare module.exports: $Exports<'@primer/components/css'>;
}
declare module '@primer/components/dist/css.js' {
declare module.exports: $Exports<'@primer/components/dist/css'>;
}
declare module '@primer/components/dist/index.esm.js' {
declare module.exports: $Exports<'@primer/components/dist/index.esm'>;
}
declare module '@primer/components/dist/index.umd.js' {
declare module.exports: $Exports<'@primer/components/dist/index.umd'>;
}
declare module '@primer/components/src/Avatar.js' {
declare module.exports: $Exports<'@primer/components/src/Avatar'>;
}
declare module '@primer/components/src/AvatarPair.js' {
declare module.exports: $Exports<'@primer/components/src/AvatarPair'>;
}
declare module '@primer/components/src/BaseStyles.js' {
declare module.exports: $Exports<'@primer/components/src/BaseStyles'>;
}
declare module '@primer/components/src/BorderBox.js' {
declare module.exports: $Exports<'@primer/components/src/BorderBox'>;
}
declare module '@primer/components/src/Box.js' {
declare module.exports: $Exports<'@primer/components/src/Box'>;
}
declare module '@primer/components/src/BranchName.js' {
declare module.exports: $Exports<'@primer/components/src/BranchName'>;
}
declare module '@primer/components/src/Button.js' {
declare module.exports: $Exports<'@primer/components/src/Button'>;
}
declare module '@primer/components/src/ButtonDanger.js' {
declare module.exports: $Exports<'@primer/components/src/ButtonDanger'>;
}
declare module '@primer/components/src/ButtonOutline.js' {
declare module.exports: $Exports<'@primer/components/src/ButtonOutline'>;
}
declare module '@primer/components/src/ButtonPrimary.js' {
declare module.exports: $Exports<'@primer/components/src/ButtonPrimary'>;
}
declare module '@primer/components/src/ButtonStyles.js' {
declare module.exports: $Exports<'@primer/components/src/ButtonStyles'>;
}
declare module '@primer/components/src/Caret.js' {
declare module.exports: $Exports<'@primer/components/src/Caret'>;
}
declare module '@primer/components/src/CircleBadge.js' {
declare module.exports: $Exports<'@primer/components/src/CircleBadge'>;
}
declare module '@primer/components/src/CircleOcticon.js' {
declare module.exports: $Exports<'@primer/components/src/CircleOcticon'>;
}
declare module '@primer/components/src/constants.js' {
declare module.exports: $Exports<'@primer/components/src/constants'>;
}
declare module '@primer/components/src/CounterLabel.js' {
declare module.exports: $Exports<'@primer/components/src/CounterLabel'>;
}
declare module '@primer/components/src/css.js' {
declare module.exports: $Exports<'@primer/components/src/css'>;
}
declare module '@primer/components/src/Details.js' {
declare module.exports: $Exports<'@primer/components/src/Details'>;
}
declare module '@primer/components/src/Donut.js' {
declare module.exports: $Exports<'@primer/components/src/Donut'>;
}
declare module '@primer/components/src/Dropdown.js' {
declare module.exports: $Exports<'@primer/components/src/Dropdown'>;
}
declare module '@primer/components/src/DropdownStyles.js' {
declare module.exports: $Exports<'@primer/components/src/DropdownStyles'>;
}
declare module '@primer/components/src/FilterList.js' {
declare module.exports: $Exports<'@primer/components/src/FilterList'>;
}
declare module '@primer/components/src/Flash.js' {
declare module.exports: $Exports<'@primer/components/src/Flash'>;
}
declare module '@primer/components/src/Flex.js' {
declare module.exports: $Exports<'@primer/components/src/Flex'>;
}
declare module '@primer/components/src/Heading.js' {
declare module.exports: $Exports<'@primer/components/src/Heading'>;
}
declare module '@primer/components/src/index.js' {
declare module.exports: $Exports<'@primer/components/src/index'>;
}
declare module '@primer/components/src/Label.js' {
declare module.exports: $Exports<'@primer/components/src/Label'>;
}
declare module '@primer/components/src/Link.js' {
declare module.exports: $Exports<'@primer/components/src/Link'>;
}
declare module '@primer/components/src/PointerBox.js' {
declare module.exports: $Exports<'@primer/components/src/PointerBox'>;
}
declare module '@primer/components/src/Position.js' {
declare module.exports: $Exports<'@primer/components/src/Position'>;
}
declare module '@primer/components/src/PrimerComponentsAnimation.js' {
declare module.exports: $Exports<'@primer/components/src/PrimerComponentsAnimation'>;
}
declare module '@primer/components/src/StateLabel.js' {
declare module.exports: $Exports<'@primer/components/src/StateLabel'>;
}
declare module '@primer/components/src/StyledOcticon.js' {
declare module.exports: $Exports<'@primer/components/src/StyledOcticon'>;
}
declare module '@primer/components/src/Text.js' {
declare module.exports: $Exports<'@primer/components/src/Text'>;
}
declare module '@primer/components/src/TextInput.js' {
declare module.exports: $Exports<'@primer/components/src/TextInput'>;
}
declare module '@primer/components/src/theme.js' {
declare module.exports: $Exports<'@primer/components/src/theme'>;
}
declare module '@primer/components/src/Tooltip.js' {
declare module.exports: $Exports<'@primer/components/src/Tooltip'>;
}
declare module '@primer/components/src/UnderlineNav.js' {
declare module.exports: $Exports<'@primer/components/src/UnderlineNav'>;
}

109
flow-typed/npm/babel-eslint_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,109 @@
// flow-typed signature: 7deec821536f1597fae1f6cd21e9ef81
// flow-typed version: <<STUB>>/babel-eslint_v^10.0.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'babel-eslint'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'babel-eslint' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'babel-eslint/lib/analyze-scope' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/babylon-to-espree/attachComments' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/babylon-to-espree/convertComments' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/babylon-to-espree/index' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/babylon-to-espree/toAST' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/babylon-to-espree/toToken' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/babylon-to-espree/toTokens' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/index' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/parse-with-scope' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/parse' {
declare module.exports: any;
}
declare module 'babel-eslint/lib/visitor-keys' {
declare module.exports: any;
}
// Filename aliases
declare module 'babel-eslint/lib/analyze-scope.js' {
declare module.exports: $Exports<'babel-eslint/lib/analyze-scope'>;
}
declare module 'babel-eslint/lib/babylon-to-espree/attachComments.js' {
declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/attachComments'>;
}
declare module 'babel-eslint/lib/babylon-to-espree/convertComments.js' {
declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertComments'>;
}
declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType.js' {
declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertTemplateType'>;
}
declare module 'babel-eslint/lib/babylon-to-espree/index.js' {
declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/index'>;
}
declare module 'babel-eslint/lib/babylon-to-espree/toAST.js' {
declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toAST'>;
}
declare module 'babel-eslint/lib/babylon-to-espree/toToken.js' {
declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toToken'>;
}
declare module 'babel-eslint/lib/babylon-to-espree/toTokens.js' {
declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toTokens'>;
}
declare module 'babel-eslint/lib/index.js' {
declare module.exports: $Exports<'babel-eslint/lib/index'>;
}
declare module 'babel-eslint/lib/parse-with-scope.js' {
declare module.exports: $Exports<'babel-eslint/lib/parse-with-scope'>;
}
declare module 'babel-eslint/lib/parse.js' {
declare module.exports: $Exports<'babel-eslint/lib/parse'>;
}
declare module 'babel-eslint/lib/visitor-keys.js' {
declare module.exports: $Exports<'babel-eslint/lib/visitor-keys'>;
}

View file

@ -0,0 +1,32 @@
// flow-typed signature: 17a5025497875818cc0a0a0d5c058967
// flow-typed version: <<STUB>>/babel-plugin-transform-flow-strip-types_v^6.22.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'babel-plugin-transform-flow-strip-types'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'babel-plugin-transform-flow-strip-types' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'babel-plugin-transform-flow-strip-types/lib/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'babel-plugin-transform-flow-strip-types/lib/index.js' {
declare module.exports: $Exports<'babel-plugin-transform-flow-strip-types/lib/index'>;
}

View file

@ -0,0 +1,32 @@
// flow-typed signature: c02e7d0c77cbe856c77121e5204d4403
// flow-typed version: <<STUB>>/babel-preset-flow_v^6.23.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'babel-preset-flow'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'babel-preset-flow' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'babel-preset-flow/lib/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'babel-preset-flow/lib/index.js' {
declare module.exports: $Exports<'babel-preset-flow/lib/index'>;
}

44
flow-typed/npm/babel-register_v6.x.x.js vendored Normal file
View file

@ -0,0 +1,44 @@
// flow-typed signature: d39f8c42e21629554940dda3bcbe90e6
// flow-typed version: b80967946f/babel-register_v6.x.x/flow_>=v0.30.x
declare module 'babel-register' {
declare type Options = {|
ast?: boolean,
auxiliaryCommentAfter?: ?string,
auxiliaryCommentBefore?: ?string,
babelrc?: boolean,
code?: boolean,
comments?: boolean,
compact?: 'auto' | boolean,
env?: Object,
extends?: ?string,
filename?: string,
filenameRelative?: string,
generatorOpts?: Object,
getModuleId?: void | null | (moduleName: string) => string,
highlightCode?: boolean,
ignore?: boolean | string | RegExp | (filename: string) => boolean,
inputSourceMap?: Object,
minified?: boolean,
moduleId?: string,
moduleIds?: boolean,
moduleRoot?: string,
only?: RegExp,
parserOpts?: Object,
plugins?: Array<[string, Object] | string>,
presets?: Array<string>,
retainLines?: boolean,
resolveModuleSource?: null | (source: string, filename: string) => boolean,
shouldPrintComment?: null | (commentContents: string) => string,
sourceFileName?: string,
sourceMaps?: boolean | 'inline' | 'both',
sourceMapTarget?: string,
sourceRoot?: string,
sourceType?: 'script' | 'module' | 'unambiguous',
wrapPluginVisitorMethod?: null | (pluginAlias: string, visitorType: string, callback: Function) => boolean,
extensions?: Array<string>,
cache?: boolean,
|};
declare module.exports: (options?: Options) => void;
}

98
flow-typed/npm/chalk_v2.x.x.js vendored Normal file
View file

@ -0,0 +1,98 @@
// flow-typed signature: db5b2cdde8db39d47e27cc8ab84f89bf
// flow-typed version: d662d43161/chalk_v2.x.x/flow_>=v0.25.x
// From: https://github.com/chalk/chalk/blob/master/index.js.flow
declare module "chalk" {
declare type TemplateStringsArray = $ReadOnlyArray<string>;
declare type Level = $Values<{
None: 0,
Basic: 1,
Ansi256: 2,
TrueColor: 3
}>;
declare type ChalkOptions = {|
enabled?: boolean,
level?: Level
|};
declare type ColorSupport = {|
level: Level,
hasBasic: boolean,
has256: boolean,
has16m: boolean
|};
declare interface Chalk {
(...text: string[]): string,
(text: TemplateStringsArray, ...placeholders: string[]): string,
constructor(options?: ChalkOptions): Chalk,
enabled: boolean,
level: Level,
rgb(r: number, g: number, b: number): Chalk,
hsl(h: number, s: number, l: number): Chalk,
hsv(h: number, s: number, v: number): Chalk,
hwb(h: number, w: number, b: number): Chalk,
bgHex(color: string): Chalk,
bgKeyword(color: string): Chalk,
bgRgb(r: number, g: number, b: number): Chalk,
bgHsl(h: number, s: number, l: number): Chalk,
bgHsv(h: number, s: number, v: number): Chalk,
bgHwb(h: number, w: number, b: number): Chalk,
hex(color: string): Chalk,
keyword(color: string): Chalk,
+reset: Chalk,
+bold: Chalk,
+dim: Chalk,
+italic: Chalk,
+underline: Chalk,
+inverse: Chalk,
+hidden: Chalk,
+strikethrough: Chalk,
+visible: Chalk,
+black: Chalk,
+red: Chalk,
+green: Chalk,
+yellow: Chalk,
+blue: Chalk,
+magenta: Chalk,
+cyan: Chalk,
+white: Chalk,
+gray: Chalk,
+grey: Chalk,
+blackBright: Chalk,
+redBright: Chalk,
+greenBright: Chalk,
+yellowBright: Chalk,
+blueBright: Chalk,
+magentaBright: Chalk,
+cyanBright: Chalk,
+whiteBright: Chalk,
+bgBlack: Chalk,
+bgRed: Chalk,
+bgGreen: Chalk,
+bgYellow: Chalk,
+bgBlue: Chalk,
+bgMagenta: Chalk,
+bgCyan: Chalk,
+bgWhite: Chalk,
+bgBlackBright: Chalk,
+bgRedBright: Chalk,
+bgGreenBright: Chalk,
+bgYellowBright: Chalk,
+bgBlueBright: Chalk,
+bgMagentaBright: Chalk,
+bgCyanBright: Chalk,
+bgWhiteBrigh: Chalk,
supportsColor: ColorSupport
}
declare module.exports: Chalk;
}

45
flow-typed/npm/chokidar_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,45 @@
// flow-typed signature: c11e3c51760048030c217c7dd16a1981
// flow-typed version: <<STUB>>/chokidar_v^2.1.2/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'chokidar'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'chokidar' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'chokidar/lib/fsevents-handler' {
declare module.exports: any;
}
declare module 'chokidar/lib/nodefs-handler' {
declare module.exports: any;
}
// Filename aliases
declare module 'chokidar/index' {
declare module.exports: $Exports<'chokidar'>;
}
declare module 'chokidar/index.js' {
declare module.exports: $Exports<'chokidar'>;
}
declare module 'chokidar/lib/fsevents-handler.js' {
declare module.exports: $Exports<'chokidar/lib/fsevents-handler'>;
}
declare module 'chokidar/lib/nodefs-handler.js' {
declare module.exports: $Exports<'chokidar/lib/nodefs-handler'>;
}

1871
flow-typed/npm/discord.js_v11.3.x.js vendored Normal file

File diff suppressed because it is too large Load diff

53
flow-typed/npm/dotenv_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,53 @@
// flow-typed signature: 080d14369ffcc140d1e2aaf040046354
// flow-typed version: <<STUB>>/dotenv_v^6.2.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'dotenv'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'dotenv' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'dotenv/config' {
declare module.exports: any;
}
declare module 'dotenv/lib/cli-options' {
declare module.exports: any;
}
declare module 'dotenv/lib/env-options' {
declare module.exports: any;
}
declare module 'dotenv/lib/main' {
declare module.exports: any;
}
// Filename aliases
declare module 'dotenv/config.js' {
declare module.exports: $Exports<'dotenv/config'>;
}
declare module 'dotenv/lib/cli-options.js' {
declare module.exports: $Exports<'dotenv/lib/cli-options'>;
}
declare module 'dotenv/lib/env-options.js' {
declare module.exports: $Exports<'dotenv/lib/env-options'>;
}
declare module 'dotenv/lib/main.js' {
declare module.exports: $Exports<'dotenv/lib/main'>;
}

46
flow-typed/npm/erlpack_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,46 @@
// flow-typed signature: 261645a6d1133fb1d26bb2c9286e35b1
// flow-typed version: <<STUB>>/erlpack_vgithub:discordapp/erlpack/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'erlpack'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'erlpack' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'erlpack/js/__tests__/decoder-test' {
declare module.exports: any;
}
declare module 'erlpack/js/__tests__/encoder-test' {
declare module.exports: any;
}
declare module 'erlpack/js/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'erlpack/js/__tests__/decoder-test.js' {
declare module.exports: $Exports<'erlpack/js/__tests__/decoder-test'>;
}
declare module 'erlpack/js/__tests__/encoder-test.js' {
declare module.exports: $Exports<'erlpack/js/__tests__/encoder-test'>;
}
declare module 'erlpack/js/index.js' {
declare module.exports: $Exports<'erlpack/js/index'>;
}

View file

@ -0,0 +1,459 @@
// flow-typed signature: 9adfd5a72314d1723552f99b5c14bac4
// flow-typed version: <<STUB>>/eslint-plugin-flowtype_v^3.4.2/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'eslint-plugin-flowtype'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'eslint-plugin-flowtype' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'eslint-plugin-flowtype/dist/bin/addAssertions' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/bin/checkDocs' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/bin/checkTests' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/bin/utilities' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/index' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/index' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/isSimpleType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/needWrap' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleComplexType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleSimpleType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/booleanStyle' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/defineFlowType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/delimiterDangle' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/genericSpacing' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/newlineAfterFlowAnnotation' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noDupeKeys' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noExistentialType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noFlowFixMeComments' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noMixed' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noMutableArray' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noUnusedExpressions' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireCompoundTypeAlias' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireExactType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireParameterType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireReturnType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireTypesAtTop' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireVariableType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/semi' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/sortKeys' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateVariables' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeIdMatch' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeImportStyle' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/useFlowType' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/validSyntax' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/getParameterName' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/index' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFile' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/quoteName' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/utilities/spacingFixers' {
declare module.exports: any;
}
// Filename aliases
declare module 'eslint-plugin-flowtype/dist/bin/addAssertions.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/addAssertions'>;
}
declare module 'eslint-plugin-flowtype/dist/bin/checkDocs.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/checkDocs'>;
}
declare module 'eslint-plugin-flowtype/dist/bin/checkTests.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/checkTests'>;
}
declare module 'eslint-plugin-flowtype/dist/bin/utilities.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/utilities'>;
}
declare module 'eslint-plugin-flowtype/dist/index.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/index'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/index.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyle/index'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/isSimpleType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyle/isSimpleType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/needWrap.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyle/needWrap'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleComplexType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyleComplexType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleSimpleType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyleSimpleType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/booleanStyle.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/booleanStyle'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/defineFlowType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/defineFlowType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/delimiterDangle.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/delimiterDangle'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/genericSpacing.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/genericSpacing'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/newlineAfterFlowAnnotation.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/newlineAfterFlowAnnotation'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noDupeKeys.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noDupeKeys'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noExistentialType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noExistentialType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noFlowFixMeComments.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noFlowFixMeComments'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noMixed.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noMixed'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noMutableArray.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noMutableArray'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noUnusedExpressions.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noUnusedExpressions'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noWeakTypes'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireCompoundTypeAlias.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireCompoundTypeAlias'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireExactType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireExactType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireParameterType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireParameterType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireReturnType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireReturnType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireTypesAtTop.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireTypesAtTop'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/requireVariableType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireVariableType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/semi.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/semi'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/sortKeys.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/sortKeys'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateVariables.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateVariables'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeIdMatch.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeIdMatch'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/typeImportStyle.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeImportStyle'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/useFlowType.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/useFlowType'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/validSyntax.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/validSyntax'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/getParameterName.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getParameterName'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/index.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/index'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFile.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/isFlowFile'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/quoteName.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/quoteName'>;
}
declare module 'eslint-plugin-flowtype/dist/utilities/spacingFixers.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/spacingFixers'>;
}

123
flow-typed/npm/fast-redux_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,123 @@
// flow-typed signature: 854102978ef8374a8398d156351287ae
// flow-typed version: <<STUB>>/fast-redux_v^0.7.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'fast-redux'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'fast-redux' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'fast-redux/dist/fast-redux' {
declare module.exports: any;
}
declare module 'fast-redux/dist/fast-redux.min' {
declare module.exports: any;
}
declare module 'fast-redux/es/index' {
declare module.exports: any;
}
declare module 'fast-redux/es/namespace' {
declare module.exports: any;
}
declare module 'fast-redux/es/object' {
declare module.exports: any;
}
declare module 'fast-redux/es/rootReducer' {
declare module.exports: any;
}
declare module 'fast-redux/lib/index' {
declare module.exports: any;
}
declare module 'fast-redux/lib/namespace' {
declare module.exports: any;
}
declare module 'fast-redux/lib/object' {
declare module.exports: any;
}
declare module 'fast-redux/lib/rootReducer' {
declare module.exports: any;
}
declare module 'fast-redux/src/index' {
declare module.exports: any;
}
declare module 'fast-redux/src/namespace' {
declare module.exports: any;
}
declare module 'fast-redux/src/object' {
declare module.exports: any;
}
declare module 'fast-redux/src/rootReducer' {
declare module.exports: any;
}
// Filename aliases
declare module 'fast-redux/dist/fast-redux.js' {
declare module.exports: $Exports<'fast-redux/dist/fast-redux'>;
}
declare module 'fast-redux/dist/fast-redux.min.js' {
declare module.exports: $Exports<'fast-redux/dist/fast-redux.min'>;
}
declare module 'fast-redux/es/index.js' {
declare module.exports: $Exports<'fast-redux/es/index'>;
}
declare module 'fast-redux/es/namespace.js' {
declare module.exports: $Exports<'fast-redux/es/namespace'>;
}
declare module 'fast-redux/es/object.js' {
declare module.exports: $Exports<'fast-redux/es/object'>;
}
declare module 'fast-redux/es/rootReducer.js' {
declare module.exports: $Exports<'fast-redux/es/rootReducer'>;
}
declare module 'fast-redux/lib/index.js' {
declare module.exports: $Exports<'fast-redux/lib/index'>;
}
declare module 'fast-redux/lib/namespace.js' {
declare module.exports: $Exports<'fast-redux/lib/namespace'>;
}
declare module 'fast-redux/lib/object.js' {
declare module.exports: $Exports<'fast-redux/lib/object'>;
}
declare module 'fast-redux/lib/rootReducer.js' {
declare module.exports: $Exports<'fast-redux/lib/rootReducer'>;
}
declare module 'fast-redux/src/index.js' {
declare module.exports: $Exports<'fast-redux/src/index'>;
}
declare module 'fast-redux/src/namespace.js' {
declare module.exports: $Exports<'fast-redux/src/namespace'>;
}
declare module 'fast-redux/src/object.js' {
declare module.exports: $Exports<'fast-redux/src/object'>;
}
declare module 'fast-redux/src/rootReducer.js' {
declare module.exports: $Exports<'fast-redux/src/rootReducer'>;
}

6
flow-typed/npm/flow-bin_v0.x.x.js vendored Normal file
View file

@ -0,0 +1,6 @@
// flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583
// flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x
declare module "flow-bin" {
declare module.exports: string;
}

193
flow-typed/npm/flow-typed_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,193 @@
// flow-typed signature: 98b49b6d9f641c97d7a3bde73968d01b
// flow-typed version: <<STUB>>/flow-typed_v^2.5.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'flow-typed'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'flow-typed' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'flow-typed/dist/cli' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/create-stub' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/install' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/runTests' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/search' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/update-cache' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/update' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/validateDefs' {
declare module.exports: any;
}
declare module 'flow-typed/dist/commands/version' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/cacheRepoUtils' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/codeSign' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/fileUtils' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/flowProjectUtils' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/flowVersion' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/git' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/github' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/isInFlowTypedRepo' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/libDefs' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/node' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/npm/npmLibDefs' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/npm/npmProjectUtils' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/semver' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/stubUtils' {
declare module.exports: any;
}
declare module 'flow-typed/dist/lib/validationErrors' {
declare module.exports: any;
}
// Filename aliases
declare module 'flow-typed/dist/cli.js' {
declare module.exports: $Exports<'flow-typed/dist/cli'>;
}
declare module 'flow-typed/dist/commands/create-stub.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/create-stub'>;
}
declare module 'flow-typed/dist/commands/install.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/install'>;
}
declare module 'flow-typed/dist/commands/runTests.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/runTests'>;
}
declare module 'flow-typed/dist/commands/search.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/search'>;
}
declare module 'flow-typed/dist/commands/update-cache.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/update-cache'>;
}
declare module 'flow-typed/dist/commands/update.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/update'>;
}
declare module 'flow-typed/dist/commands/validateDefs.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/validateDefs'>;
}
declare module 'flow-typed/dist/commands/version.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/version'>;
}
declare module 'flow-typed/dist/lib/cacheRepoUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/cacheRepoUtils'>;
}
declare module 'flow-typed/dist/lib/codeSign.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/codeSign'>;
}
declare module 'flow-typed/dist/lib/fileUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/fileUtils'>;
}
declare module 'flow-typed/dist/lib/flowProjectUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/flowProjectUtils'>;
}
declare module 'flow-typed/dist/lib/flowVersion.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/flowVersion'>;
}
declare module 'flow-typed/dist/lib/git.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/git'>;
}
declare module 'flow-typed/dist/lib/github.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/github'>;
}
declare module 'flow-typed/dist/lib/isInFlowTypedRepo.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/isInFlowTypedRepo'>;
}
declare module 'flow-typed/dist/lib/libDefs.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/libDefs'>;
}
declare module 'flow-typed/dist/lib/node.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/node'>;
}
declare module 'flow-typed/dist/lib/npm/npmLibDefs.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmLibDefs'>;
}
declare module 'flow-typed/dist/lib/npm/npmProjectUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmProjectUtils'>;
}
declare module 'flow-typed/dist/lib/semver.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/semver'>;
}
declare module 'flow-typed/dist/lib/stubUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/stubUtils'>;
}
declare module 'flow-typed/dist/lib/validationErrors.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/validationErrors'>;
}

38
flow-typed/npm/fnv-plus_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,38 @@
// flow-typed signature: cc5028eedb29ff44f74094bcd6dfb92d
// flow-typed version: <<STUB>>/fnv-plus_v^1.2.12/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'fnv-plus'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'fnv-plus' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'fnv-plus/test/fnv-plus' {
declare module.exports: any;
}
// Filename aliases
declare module 'fnv-plus/index' {
declare module.exports: $Exports<'fnv-plus'>;
}
declare module 'fnv-plus/index.js' {
declare module.exports: $Exports<'fnv-plus'>;
}
declare module 'fnv-plus/test/fnv-plus.js' {
declare module.exports: $Exports<'fnv-plus/test/fnv-plus'>;
}

87
flow-typed/npm/glob_v7.1.x.js vendored Normal file
View file

@ -0,0 +1,87 @@
// flow-typed signature: 7c09aef8ac07163d6ef9e3f50c6bc35c
// flow-typed version: a12a42a747/glob_v7.1.x/flow_>=v0.42.x
declare module "glob" {
declare type MinimatchOptions = {|
debug?: boolean,
nobrace?: boolean,
noglobstar?: boolean,
dot?: boolean,
noext?: boolean,
nocase?: boolean,
nonull?: boolean,
matchBase?: boolean,
nocomment?: boolean,
nonegate?: boolean,
flipNegate?: boolean
|};
declare type Options = {|
...MinimatchOptions,
cwd?: string,
root?: string,
nomount?: boolean,
mark?: boolean,
nosort?: boolean,
stat?: boolean,
silent?: boolean,
strict?: boolean,
cache?: {
[path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray<string>
},
statCache?: {
[path: string]: boolean | { isDirectory(): boolean } | void
},
symlinks?: { [path: string]: boolean | void },
realpathCache?: { [path: string]: string },
sync?: boolean,
nounique?: boolean,
nodir?: boolean,
ignore?: string | $ReadOnlyArray<string>,
follow?: boolean,
realpath?: boolean,
absolute?: boolean
|};
/**
* Called when an error occurs, or matches are found
* err
* matches: filenames found matching the pattern
*/
declare type CallBack = (err: ?Error, matches: Array<string>) => void;
declare class Glob extends events$EventEmitter {
constructor(pattern: string): this;
constructor(pattern: string, callback: CallBack): this;
constructor(pattern: string, options: Options, callback: CallBack): this;
minimatch: {};
options: Options;
aborted: boolean;
cache: {
[path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray<string>
};
statCache: {
[path: string]: boolean | { isDirectory(): boolean } | void
};
symlinks: { [path: string]: boolean | void };
realpathCache: { [path: string]: string };
found: Array<string>;
pause(): void;
resume(): void;
abort(): void;
}
declare class GlobModule {
Glob: Class<Glob>;
(pattern: string, callback: CallBack): void;
(pattern: string, options: Options, callback: CallBack): void;
hasMagic(pattern: string, options?: Options): boolean;
sync(pattern: string, options?: Options): Array<string>;
}
declare module.exports: GlobModule;
}

6
flow-typed/npm/invariant_v2.x.x.js vendored Normal file
View file

@ -0,0 +1,6 @@
// flow-typed signature: 60de437d85342dea19dcd82c5a50f88a
// flow-typed version: da30fe6876/invariant_v2.x.x/flow_>=v0.33.x
declare module invariant {
declare module.exports: (condition: boolean, message: string) => void;
}

33
flow-typed/npm/keygrip_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,33 @@
// flow-typed signature: fd91bb1e24997121cb11f66b11d15c29
// flow-typed version: <<STUB>>/keygrip_v^1.0.3/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'keygrip'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'keygrip' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
// Filename aliases
declare module 'keygrip/index' {
declare module.exports: $Exports<'keygrip'>;
}
declare module 'keygrip/index.js' {
declare module.exports: $Exports<'keygrip'>;
}

View file

@ -0,0 +1,38 @@
// flow-typed signature: c51c9fd2c11706c23f47bc0eaccc1683
// flow-typed version: <<STUB>>/koa-better-router_v^2.1.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'koa-better-router'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'koa-better-router' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'koa-better-router/utils' {
declare module.exports: any;
}
// Filename aliases
declare module 'koa-better-router/index' {
declare module.exports: $Exports<'koa-better-router'>;
}
declare module 'koa-better-router/index.js' {
declare module.exports: $Exports<'koa-better-router'>;
}
declare module 'koa-better-router/utils.js' {
declare module.exports: $Exports<'koa-better-router/utils'>;
}

28
flow-typed/npm/koa-bodyparser_v4.x.x.js vendored Normal file
View file

@ -0,0 +1,28 @@
// flow-typed signature: db2ab32952e719c6656cef681be04c96
// flow-typed version: e969a7af52/koa-bodyparser_v4.x.x/flow_>=v0.56.x
declare module "koa-bodyparser" {
declare type Context = Object;
declare type Middleware = (
ctx: Context,
next: () => Promise<void>
) => Promise<void> | void;
declare type Options = {|
enableTypes?: Array<string>,
encode?: string,
formLimit?: string,
jsonLimit?: string,
strict?: boolean,
detectJSON?: (ctx: Context) => boolean,
extendTypes?: {
json?: Array<string>,
form?: Array<string>,
text?: Array<string>
},
onerror?: (err: Error, ctx: Context) => void
|};
declare module.exports: (opts?: Options) => Middleware;
}

33
flow-typed/npm/koa-compress_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,33 @@
// flow-typed signature: b09bad27d2a78c265c8431a6054ae16e
// flow-typed version: <<STUB>>/koa-compress_v^3.0.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'koa-compress'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'koa-compress' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
// Filename aliases
declare module 'koa-compress/index' {
declare module.exports: $Exports<'koa-compress'>;
}
declare module 'koa-compress/index.js' {
declare module.exports: $Exports<'koa-compress'>;
}

52
flow-typed/npm/koa-session_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,52 @@
// flow-typed signature: 3a22e39084d215a1078b7a5f3ef14557
// flow-typed version: <<STUB>>/koa-session_v^5.10.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'koa-session'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'koa-session' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'koa-session/lib/context' {
declare module.exports: any;
}
declare module 'koa-session/lib/session' {
declare module.exports: any;
}
declare module 'koa-session/lib/util' {
declare module.exports: any;
}
// Filename aliases
declare module 'koa-session/index' {
declare module.exports: $Exports<'koa-session'>;
}
declare module 'koa-session/index.js' {
declare module.exports: $Exports<'koa-session'>;
}
declare module 'koa-session/lib/context.js' {
declare module.exports: $Exports<'koa-session/lib/context'>;
}
declare module 'koa-session/lib/session.js' {
declare module.exports: $Exports<'koa-session/lib/session'>;
}
declare module 'koa-session/lib/util.js' {
declare module.exports: $Exports<'koa-session/lib/util'>;
}

319
flow-typed/npm/koa_v2.x.x.js vendored Normal file
View file

@ -0,0 +1,319 @@
// flow-typed signature: 32108e9dd6c40b60d7f9e87368b6f966
// flow-typed version: 5a6a98aaa2/koa_v2.x.x/flow_>=v0.93.x
/*
* Type def from from source code of koa.
* this: https://github.com/koajs/koa/commit/08eb1a20c3975230aa1fe1c693b0cd1ac7a0752b
* previous: https://github.com/koajs/koa/commit/fabf5864c6a5dca0782b867a263b1b0825a05bf9
*
* Changelog
* breaking: remove unused app.name
* breaking: ctx.throw([status], [msg], [properties]) (caused by http-errors (#957) )
**/
declare module 'koa' {
// Currently, import type doesn't work well ?
// so copy `Server` from flow/lib/node.js#L820
declare class Server extends net$Server {
listen(port?: number, hostname?: string, backlog?: number, callback?: Function): Server,
listen(path: string, callback?: Function): Server,
listen(handle: {}, callback?: Function): Server,
close(callback?: Function): Server,
maxHeadersCount: number,
setTimeout(msecs: number, callback: Function): Server,
timeout: number,
}
declare type ServerType = Server;
declare type JSON = | string | number | boolean | null | JSONObject | JSONArray;
declare type JSONObject = { [key: string]: JSON };
declare type JSONArray = Array<JSON>;
declare type SimpleHeader = {
'set-cookie'?: Array<string>,
[key: string]: string,
};
declare type RequestJSON = {
'method': string,
'url': string,
'header': SimpleHeader,
};
declare type RequestInspect = void|RequestJSON;
declare type Request = {
app: Application,
req: http$IncomingMessage<>,
res: http$ServerResponse,
ctx: Context,
response: Response,
fresh: boolean,
header: SimpleHeader,
headers: SimpleHeader, // alias as header
host: string,
hostname: string,
href: string,
idempotent: boolean,
ip: string,
ips: string[],
method: string,
origin: string,
originalUrl: string,
path: string,
protocol: string,
query: {[key: string]: string}, // always string
querystring: string,
search: string,
secure: boolean, // Shorthand for ctx.protocol == "https" to check if a request was issued via TLS.
socket: net$Socket,
stale: boolean,
subdomains: string[],
type: string,
url: string,
charset: string|void,
length: number|void,
// Those functions comes from https://github.com/jshttp/accepts/blob/master/index.js
// request.js$L445
// https://github.com/jshttp/accepts/blob/master/test/type.js
accepts: ((args: string[]) => string|false)&
// ToDo: There is an issue https://github.com/facebook/flow/issues/3009
// if you meet some error here, temporarily add an additional annotation
// like: `request.accepts((['json', 'text']:Array<string>))` to fix it.
((arg: string, ...args: string[]) => string|false) &
( () => string[] ) , // return the old value.
// https://github.com/jshttp/accepts/blob/master/index.js#L153
// https://github.com/jshttp/accepts/blob/master/test/charset.js
acceptsCharsets: ( (args: string[]) => buffer$Encoding|false)&
// ToDo: https://github.com/facebook/flow/issues/3009
// if you meet some error here, see L70.
( (arg: string, ...args: string[]) => buffer$Encoding|false ) &
( () => string[] ),
// https://github.com/jshttp/accepts/blob/master/index.js#L119
// https://github.com/jshttp/accepts/blob/master/test/encoding.js
acceptsEncodings: ( (args: string[]) => string|false)&
// ToDo: https://github.com/facebook/flow/issues/3009
// if you meet some error here, see L70.
( (arg: string, ...args: string[]) => string|false ) &
( () => string[] ),
// https://github.com/jshttp/accepts/blob/master/index.js#L185
// https://github.com/jshttp/accepts/blob/master/test/language.js
acceptsLanguages: ( (args: string[]) => string|false) &
// ToDo: https://github.com/facebook/flow/issues/3009
// if you meet some error here, see L70.
( (arg: string, ...args: string[]) => string|false ) &
( () => string[] ),
get: (field: string) => string,
/* https://github.com/jshttp/type-is/blob/master/test/test.js
* Check if the incoming request contains the "Content-Type"
* header field, and it contains any of the give mime `type`s.
* If there is no request body, `null` is returned.
* If there is no content type, `false` is returned.
* Otherwise, it returns the first `type` that matches.
*/
is: ( (args: string[]) => null|false|string)&
( (arg: string, ...args: string[]) => null|false|string ) &
( () => string ), // should return the mime type
toJSON: () => RequestJSON,
inspect: () => RequestInspect,
[key: string]: mixed, // props added by middlewares.
};
declare type ResponseJSON = {
'status': mixed,
'message': mixed,
'header': mixed,
};
declare type ResponseInspect = {
'status': mixed,
'message': mixed,
'header': mixed,
'body': mixed,
};
declare type Response = {
app: Application,
req: http$IncomingMessage<>,
res: http$ServerResponse,
ctx: Context,
request: Request,
// docs/api/response.md#L113.
body: string | Buffer | stream$Stream | JSONObject | JSONArray | null, // JSON contains null
etag: string,
header: SimpleHeader,
headers: SimpleHeader, // alias as header
headerSent: boolean,
// can be set with string|Date, but get with Date.
// set lastModified(v: string|Date), // 0.36 doesn't support this.
lastModified: Date,
message: string,
socket: net$Socket,
status: number,
type: string,
writable: boolean,
// charset: string, // doesn't find in response.js
length: number|void,
append: (field: string, val: string | string[]) => void,
attachment: (filename?: string) => void,
get: (field: string) => string,
// https://github.com/jshttp/type-is/blob/master/test/test.js
// https://github.com/koajs/koa/blob/v2.x/lib/response.js#L382
is: ( (arg: string[]) => false|string) &
( (arg: string, ...args: string[]) => false|string ) &
( () => string ), // should return the mime type
redirect: (url: string, alt?: string) => void,
remove: (field: string) => void,
// https://github.com/koajs/koa/blob/v2.x/lib/response.js#L418
set: ((field: string, val: string | string[]) => void)&
((field: {[key: string]: string | string[]}) => void),
vary: (field: string) => void,
// https://github.com/koajs/koa/blob/v2.x/lib/response.js#L519
toJSON(): ResponseJSON,
inspect(): ResponseInspect,
[key: string]: mixed, // props added by middlewares.
}
declare type ContextJSON = {
request: RequestJSON,
response: ResponseJSON,
app: ApplicationJSON,
originalUrl: string,
req: '<original node req>',
res: '<original node res>',
socket: '<original node socket>',
};
// https://github.com/pillarjs/cookies
declare type CookiesSetOptions = {
domain: string, // domain of the cookie (no default).
maxAge: number, // milliseconds from Date.now() for expiry
expires?: Date, //cookie's expiration date (expires at the end of session by default).
path?: string, // the path of the cookie (/ by default).
secure?: boolean, // false by default for HTTP, true by default for HTTPS
httpOnly?: boolean, // a boolean indicating whether the cookie is only to be sent over HTTP(S),
// and not made available to client JavaScript (true by default).
signed?: boolean, // whether the cookie is to be signed (false by default)
overwrite?: boolean, // whether to overwrite previously set cookies of the same name (false by default).
};
declare type Cookies = {
get: (name: string, options?: {signed: boolean}) => string|void,
set: ((name: string, value: string, options?: CookiesSetOptions) => Context)&
// delete cookie (an outbound header with an expired date is used.)
( (name: string) => Context),
};
// The default props of context come from two files
// `application.createContext` & `context.js`
declare type Context = {
accept: $PropertyType<Request, 'accept'>,
app: Application,
cookies: Cookies,
name?: string, // ?
originalUrl: string,
req: http$IncomingMessage<>,
request: Request,
res: http$ServerResponse,
respond?: boolean, // should not be used, allow bypassing koa application.js#L193
response: Response,
state: {},
// context.js#L55
assert: (test: mixed, status: number, message?: string, opts?: mixed) => void,
// context.js#L107
// if (!(err instanceof Error)) err = new Error(`non-error thrown: ${err}`);
onerror: (err?: mixed) => void,
// context.md#L88
throw: ( status: number, msg?: string, opts?: {} ) => void,
toJSON(): ContextJSON,
inspect(): ContextJSON,
// ToDo: add const for some props,
// while the `const props` feature of Flow is landing in future
// cherry pick from response
attachment: $PropertyType<Response, 'attachment'>,
redirect: $PropertyType<Response, 'redirect'>,
remove: $PropertyType<Response, 'remove'>,
vary: $PropertyType<Response, 'vary'>,
set: $PropertyType<Response, 'set'>,
append: $PropertyType<Response, 'append'>,
flushHeaders: $PropertyType<Response, 'flushHeaders'>,
status: $PropertyType<Response, 'status'>,
message: $PropertyType<Response, 'message'>,
body: $PropertyType<Response, 'body'>,
length: $PropertyType<Response, 'length'>,
type: $PropertyType<Response, 'type'>,
lastModified: $PropertyType<Response, 'lastModified'>,
etag: $PropertyType<Response, 'etag'>,
headerSent: $PropertyType<Response, 'headerSent'>,
writable: $PropertyType<Response, 'writable'>,
// cherry pick from request
acceptsLanguages: $PropertyType<Request, 'acceptsLanguages'>,
acceptsEncodings: $PropertyType<Request, 'acceptsEncodings'>,
acceptsCharsets: $PropertyType<Request, 'acceptsCharsets'>,
accepts: $PropertyType<Request, 'accepts'>,
get: $PropertyType<Request, 'get'>,
is: $PropertyType<Request, 'is'>,
querystring: $PropertyType<Request, 'querystring'>,
idempotent: $PropertyType<Request, 'idempotent'>,
socket: $PropertyType<Request, 'socket'>,
search: $PropertyType<Request, 'search'>,
method: $PropertyType<Request, 'method'>,
query: $PropertyType<Request, 'query'>,
path: $PropertyType<Request, 'path'>,
url: $PropertyType<Request, 'url'>,
origin: $PropertyType<Request, 'origin'>,
href: $PropertyType<Request, 'href'>,
subdomains: $PropertyType<Request, 'subdomains'>,
protocol: $PropertyType<Request, 'protocol'>,
host: $PropertyType<Request, 'host'>,
hostname: $PropertyType<Request, 'hostname'>,
header: $PropertyType<Request, 'header'>,
headers: $PropertyType<Request, 'headers'>,
secure: $PropertyType<Request, 'secure'>,
stale: $PropertyType<Request, 'stale'>,
fresh: $PropertyType<Request, 'fresh'>,
ips: $PropertyType<Request, 'ips'>,
ip: $PropertyType<Request, 'ip'>,
[key: string]: any, // props added by middlewares.
}
declare type Middleware =
(ctx: Context, next: () => Promise<void>) => Promise<void>|void;
declare type ApplicationJSON = {
'subdomainOffset': mixed,
'proxy': mixed,
'env': string,
};
declare class Application extends events$EventEmitter {
context: Context,
// request handler for node's native http server.
callback: () => (req: http$IncomingMessage<>, res: http$ServerResponse) => void,
env: string,
keys?: Array<string>|Object, // https://github.com/crypto-utils/keygrip
middleware: Array<Middleware>,
proxy: boolean, // when true proxy header fields will be trusted
request: Request,
response: Response,
server: Server,
subdomainOffset: number,
listen: $PropertyType<Server, 'listen'>,
toJSON(): ApplicationJSON,
inspect(): ApplicationJSON,
use(fn: Middleware): this,
}
declare module.exports: Class<Application>;
}

32
flow-typed/npm/kompression_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,32 @@
// flow-typed signature: f1d1f28d3404d28e0b3a544b1db1f1e5
// flow-typed version: <<STUB>>/kompression_v^1.0.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'kompression'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'kompression' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'kompression/src/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'kompression/src/index.js' {
declare module.exports: $Exports<'kompression/src/index'>;
}

38
flow-typed/npm/ksuid_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,38 @@
// flow-typed signature: fc54320c7e65ac8dd6dd59d867d850af
// flow-typed version: <<STUB>>/ksuid_v^1.1.3/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'ksuid'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'ksuid' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'ksuid/base62' {
declare module.exports: any;
}
// Filename aliases
declare module 'ksuid/base62.js' {
declare module.exports: $Exports<'ksuid/base62'>;
}
declare module 'ksuid/index' {
declare module.exports: $Exports<'ksuid'>;
}
declare module 'ksuid/index.js' {
declare module.exports: $Exports<'ksuid'>;
}

33
flow-typed/npm/lru-cache_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,33 @@
// flow-typed signature: 8f91fac6fa6347bfa49eb40780e29cac
// flow-typed version: <<STUB>>/lru-cache_v^5.1.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'lru-cache'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'lru-cache' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
// Filename aliases
declare module 'lru-cache/index' {
declare module.exports: $Exports<'lru-cache'>;
}
declare module 'lru-cache/index.js' {
declare module.exports: $Exports<'lru-cache'>;
}

View file

@ -0,0 +1,74 @@
// flow-typed signature: 2a12daa51dbc8fa4b2bea9c494c4b71e
// flow-typed version: <<STUB>>/next-redux-wrapper_v^3.0.0-alpha.2/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'next-redux-wrapper'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'next-redux-wrapper' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'next-redux-wrapper/coverage/lcov-report/block-navigation' {
declare module.exports: any;
}
declare module 'next-redux-wrapper/coverage/lcov-report/prettify' {
declare module.exports: any;
}
declare module 'next-redux-wrapper/coverage/lcov-report/sorter' {
declare module.exports: any;
}
declare module 'next-redux-wrapper/es6/index' {
declare module.exports: any;
}
declare module 'next-redux-wrapper/es6/index.spec' {
declare module.exports: any;
}
declare module 'next-redux-wrapper/lib/index' {
declare module.exports: any;
}
declare module 'next-redux-wrapper/lib/index.spec' {
declare module.exports: any;
}
// Filename aliases
declare module 'next-redux-wrapper/coverage/lcov-report/block-navigation.js' {
declare module.exports: $Exports<'next-redux-wrapper/coverage/lcov-report/block-navigation'>;
}
declare module 'next-redux-wrapper/coverage/lcov-report/prettify.js' {
declare module.exports: $Exports<'next-redux-wrapper/coverage/lcov-report/prettify'>;
}
declare module 'next-redux-wrapper/coverage/lcov-report/sorter.js' {
declare module.exports: $Exports<'next-redux-wrapper/coverage/lcov-report/sorter'>;
}
declare module 'next-redux-wrapper/es6/index.js' {
declare module.exports: $Exports<'next-redux-wrapper/es6/index'>;
}
declare module 'next-redux-wrapper/es6/index.spec.js' {
declare module.exports: $Exports<'next-redux-wrapper/es6/index.spec'>;
}
declare module 'next-redux-wrapper/lib/index.js' {
declare module.exports: $Exports<'next-redux-wrapper/lib/index'>;
}
declare module 'next-redux-wrapper/lib/index.spec.js' {
declare module.exports: $Exports<'next-redux-wrapper/lib/index.spec'>;
}

564
flow-typed/npm/next_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,564 @@
// flow-typed signature: 7f858ca4c1a1aafbaf28076e647a34fc
// flow-typed version: <<STUB>>/next_v^8.0.3/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'next'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'next' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'next/amp' {
declare module.exports: any;
}
declare module 'next/app' {
declare module.exports: any;
}
declare module 'next/babel' {
declare module.exports: any;
}
declare module 'next/client' {
declare module.exports: any;
}
declare module 'next/config' {
declare module.exports: any;
}
declare module 'next/constants' {
declare module.exports: any;
}
declare module 'next/dist/build/babel/plugins/commonjs' {
declare module.exports: any;
}
declare module 'next/dist/build/babel/plugins/next-to-next-server' {
declare module.exports: any;
}
declare module 'next/dist/build/babel/plugins/react-loadable-plugin' {
declare module.exports: any;
}
declare module 'next/dist/build/babel/preset' {
declare module.exports: any;
}
declare module 'next/dist/build/compiler' {
declare module.exports: any;
}
declare module 'next/dist/build/entries' {
declare module.exports: any;
}
declare module 'next/dist/build/generate-build-id' {
declare module.exports: any;
}
declare module 'next/dist/build/index' {
declare module.exports: any;
}
declare module 'next/dist/build/is-writeable' {
declare module.exports: any;
}
declare module 'next/dist/build/output/exit' {
declare module.exports: any;
}
declare module 'next/dist/build/output/index' {
declare module.exports: any;
}
declare module 'next/dist/build/output/store' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack-config' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/loaders/emit-file-loader' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/loaders/next-babel-loader' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/loaders/next-client-pages-loader' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/loaders/next-serverless-loader' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/loaders/noop-loader' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/build-manifest-plugin' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/chunk-names-plugin' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/nextjs-ssr-import' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/nextjs-ssr-module-cache' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/pages-manifest-plugin' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/react-loadable-plugin' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/serverless-plugin' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/cjs' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/index' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/minify' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/worker' {
declare module.exports: any;
}
declare module 'next/dist/build/webpack/plugins/unlink-file-plugin' {
declare module.exports: any;
}
declare module 'next/dist/build/write-build-id' {
declare module.exports: any;
}
declare module 'next/dist/client/dev-error-overlay/eventsource' {
declare module.exports: any;
}
declare module 'next/dist/client/dev-error-overlay/format-webpack-messages' {
declare module.exports: any;
}
declare module 'next/dist/client/dev-error-overlay/hot-dev-client' {
declare module.exports: any;
}
declare module 'next/dist/client/error-boundary' {
declare module.exports: any;
}
declare module 'next/dist/client/head-manager' {
declare module.exports: any;
}
declare module 'next/dist/client/index' {
declare module.exports: any;
}
declare module 'next/dist/client/link' {
declare module.exports: any;
}
declare module 'next/dist/client/next-dev' {
declare module.exports: any;
}
declare module 'next/dist/client/next' {
declare module.exports: any;
}
declare module 'next/dist/client/noop' {
declare module.exports: any;
}
declare module 'next/dist/client/on-demand-entries-client' {
declare module.exports: any;
}
declare module 'next/dist/client/page-loader' {
declare module.exports: any;
}
declare module 'next/dist/client/router' {
declare module.exports: any;
}
declare module 'next/dist/client/source-map-support' {
declare module.exports: any;
}
declare module 'next/dist/client/webpack-hot-middleware-client' {
declare module.exports: any;
}
declare module 'next/dist/client/with-router' {
declare module.exports: any;
}
declare module 'next/dist/export/index' {
declare module.exports: any;
}
declare module 'next/dist/export/worker' {
declare module.exports: any;
}
declare module 'next/dist/lib/constants' {
declare module.exports: any;
}
declare module 'next/dist/lib/promisify' {
declare module.exports: any;
}
declare module 'next/dist/pages/_app' {
declare module.exports: any;
}
declare module 'next/dist/pages/_document' {
declare module.exports: any;
}
declare module 'next/dist/pages/_error' {
declare module.exports: any;
}
declare module 'next/dist/server/error-debug' {
declare module.exports: any;
}
declare module 'next/dist/server/hot-reloader' {
declare module.exports: any;
}
declare module 'next/dist/server/htmlescape' {
declare module.exports: any;
}
declare module 'next/dist/server/lib/error-overlay-middleware' {
declare module.exports: any;
}
declare module 'next/dist/server/lib/start-server' {
declare module.exports: any;
}
declare module 'next/dist/server/lib/utils' {
declare module.exports: any;
}
declare module 'next/dist/server/next-dev-server' {
declare module.exports: any;
}
declare module 'next/dist/server/next' {
declare module.exports: any;
}
declare module 'next/dist/server/on-demand-entry-handler' {
declare module.exports: any;
}
declare module 'next/document' {
declare module.exports: any;
}
declare module 'next/dynamic' {
declare module.exports: any;
}
declare module 'next/error' {
declare module.exports: any;
}
declare module 'next/head' {
declare module.exports: any;
}
declare module 'next/link' {
declare module.exports: any;
}
declare module 'next/router' {
declare module.exports: any;
}
// Filename aliases
declare module 'next/amp.js' {
declare module.exports: $Exports<'next/amp'>;
}
declare module 'next/app.js' {
declare module.exports: $Exports<'next/app'>;
}
declare module 'next/babel.js' {
declare module.exports: $Exports<'next/babel'>;
}
declare module 'next/client.js' {
declare module.exports: $Exports<'next/client'>;
}
declare module 'next/config.js' {
declare module.exports: $Exports<'next/config'>;
}
declare module 'next/constants.js' {
declare module.exports: $Exports<'next/constants'>;
}
declare module 'next/dist/build/babel/plugins/commonjs.js' {
declare module.exports: $Exports<'next/dist/build/babel/plugins/commonjs'>;
}
declare module 'next/dist/build/babel/plugins/next-to-next-server.js' {
declare module.exports: $Exports<'next/dist/build/babel/plugins/next-to-next-server'>;
}
declare module 'next/dist/build/babel/plugins/react-loadable-plugin.js' {
declare module.exports: $Exports<'next/dist/build/babel/plugins/react-loadable-plugin'>;
}
declare module 'next/dist/build/babel/preset.js' {
declare module.exports: $Exports<'next/dist/build/babel/preset'>;
}
declare module 'next/dist/build/compiler.js' {
declare module.exports: $Exports<'next/dist/build/compiler'>;
}
declare module 'next/dist/build/entries.js' {
declare module.exports: $Exports<'next/dist/build/entries'>;
}
declare module 'next/dist/build/generate-build-id.js' {
declare module.exports: $Exports<'next/dist/build/generate-build-id'>;
}
declare module 'next/dist/build/index.js' {
declare module.exports: $Exports<'next/dist/build/index'>;
}
declare module 'next/dist/build/is-writeable.js' {
declare module.exports: $Exports<'next/dist/build/is-writeable'>;
}
declare module 'next/dist/build/output/exit.js' {
declare module.exports: $Exports<'next/dist/build/output/exit'>;
}
declare module 'next/dist/build/output/index.js' {
declare module.exports: $Exports<'next/dist/build/output/index'>;
}
declare module 'next/dist/build/output/store.js' {
declare module.exports: $Exports<'next/dist/build/output/store'>;
}
declare module 'next/dist/build/webpack-config.js' {
declare module.exports: $Exports<'next/dist/build/webpack-config'>;
}
declare module 'next/dist/build/webpack/loaders/emit-file-loader.js' {
declare module.exports: $Exports<'next/dist/build/webpack/loaders/emit-file-loader'>;
}
declare module 'next/dist/build/webpack/loaders/next-babel-loader.js' {
declare module.exports: $Exports<'next/dist/build/webpack/loaders/next-babel-loader'>;
}
declare module 'next/dist/build/webpack/loaders/next-client-pages-loader.js' {
declare module.exports: $Exports<'next/dist/build/webpack/loaders/next-client-pages-loader'>;
}
declare module 'next/dist/build/webpack/loaders/next-serverless-loader.js' {
declare module.exports: $Exports<'next/dist/build/webpack/loaders/next-serverless-loader'>;
}
declare module 'next/dist/build/webpack/loaders/noop-loader.js' {
declare module.exports: $Exports<'next/dist/build/webpack/loaders/noop-loader'>;
}
declare module 'next/dist/build/webpack/plugins/build-manifest-plugin.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/build-manifest-plugin'>;
}
declare module 'next/dist/build/webpack/plugins/chunk-names-plugin.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/chunk-names-plugin'>;
}
declare module 'next/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader'>;
}
declare module 'next/dist/build/webpack/plugins/nextjs-ssr-import.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/nextjs-ssr-import'>;
}
declare module 'next/dist/build/webpack/plugins/nextjs-ssr-module-cache.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/nextjs-ssr-module-cache'>;
}
declare module 'next/dist/build/webpack/plugins/pages-manifest-plugin.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/pages-manifest-plugin'>;
}
declare module 'next/dist/build/webpack/plugins/react-loadable-plugin.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/react-loadable-plugin'>;
}
declare module 'next/dist/build/webpack/plugins/serverless-plugin.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/serverless-plugin'>;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/cjs.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/terser-webpack-plugin/src/cjs'>;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/index.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/terser-webpack-plugin/src/index'>;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/minify.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/terser-webpack-plugin/src/minify'>;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner'>;
}
declare module 'next/dist/build/webpack/plugins/terser-webpack-plugin/src/worker.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/terser-webpack-plugin/src/worker'>;
}
declare module 'next/dist/build/webpack/plugins/unlink-file-plugin.js' {
declare module.exports: $Exports<'next/dist/build/webpack/plugins/unlink-file-plugin'>;
}
declare module 'next/dist/build/write-build-id.js' {
declare module.exports: $Exports<'next/dist/build/write-build-id'>;
}
declare module 'next/dist/client/dev-error-overlay/eventsource.js' {
declare module.exports: $Exports<'next/dist/client/dev-error-overlay/eventsource'>;
}
declare module 'next/dist/client/dev-error-overlay/format-webpack-messages.js' {
declare module.exports: $Exports<'next/dist/client/dev-error-overlay/format-webpack-messages'>;
}
declare module 'next/dist/client/dev-error-overlay/hot-dev-client.js' {
declare module.exports: $Exports<'next/dist/client/dev-error-overlay/hot-dev-client'>;
}
declare module 'next/dist/client/error-boundary.js' {
declare module.exports: $Exports<'next/dist/client/error-boundary'>;
}
declare module 'next/dist/client/head-manager.js' {
declare module.exports: $Exports<'next/dist/client/head-manager'>;
}
declare module 'next/dist/client/index.js' {
declare module.exports: $Exports<'next/dist/client/index'>;
}
declare module 'next/dist/client/link.js' {
declare module.exports: $Exports<'next/dist/client/link'>;
}
declare module 'next/dist/client/next-dev.js' {
declare module.exports: $Exports<'next/dist/client/next-dev'>;
}
declare module 'next/dist/client/next.js' {
declare module.exports: $Exports<'next/dist/client/next'>;
}
declare module 'next/dist/client/noop.js' {
declare module.exports: $Exports<'next/dist/client/noop'>;
}
declare module 'next/dist/client/on-demand-entries-client.js' {
declare module.exports: $Exports<'next/dist/client/on-demand-entries-client'>;
}
declare module 'next/dist/client/page-loader.js' {
declare module.exports: $Exports<'next/dist/client/page-loader'>;
}
declare module 'next/dist/client/router.js' {
declare module.exports: $Exports<'next/dist/client/router'>;
}
declare module 'next/dist/client/source-map-support.js' {
declare module.exports: $Exports<'next/dist/client/source-map-support'>;
}
declare module 'next/dist/client/webpack-hot-middleware-client.js' {
declare module.exports: $Exports<'next/dist/client/webpack-hot-middleware-client'>;
}
declare module 'next/dist/client/with-router.js' {
declare module.exports: $Exports<'next/dist/client/with-router'>;
}
declare module 'next/dist/export/index.js' {
declare module.exports: $Exports<'next/dist/export/index'>;
}
declare module 'next/dist/export/worker.js' {
declare module.exports: $Exports<'next/dist/export/worker'>;
}
declare module 'next/dist/lib/constants.js' {
declare module.exports: $Exports<'next/dist/lib/constants'>;
}
declare module 'next/dist/lib/promisify.js' {
declare module.exports: $Exports<'next/dist/lib/promisify'>;
}
declare module 'next/dist/pages/_app.js' {
declare module.exports: $Exports<'next/dist/pages/_app'>;
}
declare module 'next/dist/pages/_document.js' {
declare module.exports: $Exports<'next/dist/pages/_document'>;
}
declare module 'next/dist/pages/_error.js' {
declare module.exports: $Exports<'next/dist/pages/_error'>;
}
declare module 'next/dist/server/error-debug.js' {
declare module.exports: $Exports<'next/dist/server/error-debug'>;
}
declare module 'next/dist/server/hot-reloader.js' {
declare module.exports: $Exports<'next/dist/server/hot-reloader'>;
}
declare module 'next/dist/server/htmlescape.js' {
declare module.exports: $Exports<'next/dist/server/htmlescape'>;
}
declare module 'next/dist/server/lib/error-overlay-middleware.js' {
declare module.exports: $Exports<'next/dist/server/lib/error-overlay-middleware'>;
}
declare module 'next/dist/server/lib/start-server.js' {
declare module.exports: $Exports<'next/dist/server/lib/start-server'>;
}
declare module 'next/dist/server/lib/utils.js' {
declare module.exports: $Exports<'next/dist/server/lib/utils'>;
}
declare module 'next/dist/server/next-dev-server.js' {
declare module.exports: $Exports<'next/dist/server/next-dev-server'>;
}
declare module 'next/dist/server/next.js' {
declare module.exports: $Exports<'next/dist/server/next'>;
}
declare module 'next/dist/server/on-demand-entry-handler.js' {
declare module.exports: $Exports<'next/dist/server/on-demand-entry-handler'>;
}
declare module 'next/document.js' {
declare module.exports: $Exports<'next/document'>;
}
declare module 'next/dynamic.js' {
declare module.exports: $Exports<'next/dynamic'>;
}
declare module 'next/error.js' {
declare module.exports: $Exports<'next/error'>;
}
declare module 'next/head.js' {
declare module.exports: $Exports<'next/head'>;
}
declare module 'next/link.js' {
declare module.exports: $Exports<'next/link'>;
}
declare module 'next/router.js' {
declare module.exports: $Exports<'next/router'>;
}

53
flow-typed/npm/pg-hstore_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,53 @@
// flow-typed signature: 5ad68cda6c796291dc6a2a7d41b6016a
// flow-typed version: <<STUB>>/pg-hstore_v^2.3.2/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'pg-hstore'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'pg-hstore' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'pg-hstore/lib/index' {
declare module.exports: any;
}
declare module 'pg-hstore/test/index' {
declare module.exports: any;
}
declare module 'pg-hstore/test/parse' {
declare module.exports: any;
}
declare module 'pg-hstore/test/stringify' {
declare module.exports: any;
}
// Filename aliases
declare module 'pg-hstore/lib/index.js' {
declare module.exports: $Exports<'pg-hstore/lib/index'>;
}
declare module 'pg-hstore/test/index.js' {
declare module.exports: $Exports<'pg-hstore/test/index'>;
}
declare module 'pg-hstore/test/parse.js' {
declare module.exports: $Exports<'pg-hstore/test/parse'>;
}
declare module 'pg-hstore/test/stringify.js' {
declare module.exports: $Exports<'pg-hstore/test/stringify'>;
}

309
flow-typed/npm/pg_v7.x.x.js vendored Normal file
View file

@ -0,0 +1,309 @@
// flow-typed signature: 19ef65e9d513ad03294860e751b933fc
// flow-typed version: 2493e23acc/pg_v7.x.x/flow_>=v0.28.x
declare module pg {
// Note: Currently There are some issues in Function overloading.
// https://github.com/facebook/flow/issues/2423
// So i temporarily remove the
// `((event: string, listener: Function) => EventEmitter );`
// from all overloading for EventEmitter.on().
// `any` types exised in this file, cause of currently `mixed` did not work well
// in Function Overloading.
// `Function` types exised in this file, cause of they come from another
// untyped npm lib.
/* Cause of <flow 0.36 did not support export type very well,
// so copy the types from pg-pool
// https://github.com/flowtype/flow-typed/issues/16
// https://github.com/facebook/flow/commit/843389f89c69516506213e298096a14867a45061
const Pool = require('pg-pool');
import type {
PgPoolConfig,
PoolConnectCallback,
DoneCallback,
PoolClient
} from 'pg-pool';
*/
// ------------- copy from 'pg-pool' ------------>>
/*
* PgPoolConfig's properties are passed unchanged to both
* the node-postgres Client constructor and the node-pool constructor
* allowing you to fully configure the behavior of both
* node-pool (https://github.com/coopernurse/node-pool)
*/
declare type PgPoolConfig = {
// node-pool ----------------
name: string,
create: Function,
destroy: Function,
max: number,
min: number,
refreshIdle: boolean,
idleTimeoutMillis: number,
connectionTimeoutMillis: number,
reapIntervalMillis: number,
returnToHead: boolean,
priorityRange: number,
validate: Function,
validateAsync: Function,
log: Function,
// node-postgres Client ------
//database connection string to define some other config parameters
connectionString: string,
//database user's name
user: string,
//name of database to connect
database: string,
//database user's password
password: string,
//database port
port: number,
// database host. defaults to localhost
host?: string,
// whether to try SSL/TLS to connect to server. default value: false
ssl?: boolean,
// name displayed in the pg_stat_activity view and included in CSV log entries
// default value: process.env.PGAPPNAME
application_name?: string,
// fallback value for the application_name configuration parameter
// default value: false
fallback_application_name?: string,
// max milliseconds any query using this connection will execute for before timing out in error. false=unlimited
// default value: false
statement_timeout?: boolean | number,
// pg-pool
Client: mixed,
Promise: mixed,
onCreate: Function,
};
/*
* Not extends from Client, cause some of Client's functions(ex: connect and end)
* should not be used by PoolClient (which returned from Pool.connect).
*/
declare type PoolClient = {
release(error?: mixed): void,
query:
( <T: QuerySubmittableConfig>(query: T, callback?: QueryCallback) => T ) &
( (query: QueryConfig|string, callback?: QueryCallback) => Query ) &
( (text: string, values: Array<any>, callback?: QueryCallback) => Query ),
on:
((event: 'drain', listener: () => void) => events$EventEmitter )&
((event: 'error', listener: (err: PG_ERROR) => void) => events$EventEmitter )&
((event: 'notification', listener: (message: any) => void) => events$EventEmitter )&
((event: 'notice', listener: (message: any) => void) => events$EventEmitter )&
((event: 'end', listener: () => void) => events$EventEmitter ),
}
declare type PoolConnectCallback = (error: PG_ERROR|null,
client: PoolClient|null, done: DoneCallback) => void;
declare type DoneCallback = (error?: mixed) => void;
// https://github.com/facebook/flow/blob/master/lib/node.js#L581
// on() returns a events$EventEmitter
declare class Pool extends events$EventEmitter {
constructor(options: $Shape<PgPoolConfig>, Client?: Class<Client>): void;
connect(cb?: PoolConnectCallback): Promise<PoolClient>;
take(cb?: PoolConnectCallback): Promise<PoolClient>;
end(cb?: DoneCallback): Promise<void>;
// Note: not like the pg's Client, the Pool.query return a Promise,
// not a Thenable Query which Client returned.
// And there is a flow(<0.34) issue here, when Array<mixed>,
// the overloading will not work
query:
( (query: QueryConfig|string, callback?: QueryCallback) => Promise<ResultSet> ) &
( (text: string, values: Array<any>, callback?: QueryCallback) => Promise<ResultSet>);
/* flow issue: https://github.com/facebook/flow/issues/2423
* When this fixed, this overloading can be used.
*/
/*
on:
((event: 'connect', listener: (client: PoolClient) => void) => events$EventEmitter )&
((event: 'acquire', listener: (client: PoolClient) => void) => events$EventEmitter )&
((event: "error", listener: (err: PG_ERROR) => void) => events$EventEmitter )&
((event: string, listener: Function) => events$EventEmitter);
*/
}
// <<------------- copy from 'pg-pool' ------------------------------
// error
declare type PG_ERROR = {
name: string,
length: number,
severity: string,
code: string,
detail: string|void,
hint: string|void,
position: string|void,
internalPosition: string|void,
internalQuery: string|void,
where: string|void,
schema: string|void,
table: string|void,
column: string|void,
dataType: string|void,
constraint: string|void,
file: string|void,
line: string|void,
routine: string|void
};
declare type ClientConfig = {
//database user's name
user?: string,
//name of database to connect
database?: string,
//database user's password
password?: string,
//database port
port?: number,
// database host. defaults to localhost
host?: string,
// whether to try SSL/TLS to connect to server. default value: false
ssl?: boolean,
// name displayed in the pg_stat_activity view and included in CSV log entries
// default value: process.env.PGAPPNAME
application_name?: string,
// fallback value for the application_name configuration parameter
// default value: false
fallback_application_name?: string,
}
declare type Row = {
[key: string]: mixed,
};
declare type ResultSet = {
command: string,
rowCount: number,
oid: number,
rows: Array<Row>,
};
declare type ResultBuilder = {
command: string,
rowCount: number,
oid: number,
rows: Array<Row>,
addRow: (row: Row) => void,
};
declare type QueryConfig = {
name?: string,
text: string,
values?: any[],
};
declare type QuerySubmittableConfig = QueryConfig & {
submit: (connection: mixed) => void,
};
declare type QueryCallback = (err: PG_ERROR|null, result: ResultSet|void) => void;
declare type ClientConnectCallback = (err: PG_ERROR|null, client: Client|void) => void;
/*
* lib/query.js
* Query extends from EventEmitter in source code.
* but in Flow there is no multiple extends.
* And in Flow await is a `declare function $await<T>(p: Promise<T> | T): T;`
* seems can not resolve a Thenable's value type directly
* so `Query extends Promise` to make thing temporarily work.
* like this:
* const q = client.query('select * from some');
* q.on('row',cb); // Event
* const result = await q; // or await
*
* ToDo: should find a better way.
*/
declare class Query extends Promise<ResultSet> {
then<U>(
onFulfill?: ?((value: ResultSet) => Promise<U> | U),
onReject?: ?((error: PG_ERROR) => Promise<U> | U)
): Promise<U>;
// Because then and catch return a Promise,
// .then.catch will lose catch's type information PG_ERROR.
catch<U>(
onReject?: ?((error: PG_ERROR) => Promise<U> | U)
): Promise<U>;
on :
((event: 'row', listener: (row: Row, result: ResultBuilder) => void) => events$EventEmitter )&
((event: 'end', listener: (result: ResultBuilder) => void) => events$EventEmitter )&
((event: 'error', listener: (err: PG_ERROR) => void) => events$EventEmitter );
}
/*
* lib/client.js
* Note: not extends from EventEmitter, for This Type returned by on().
* Flow's EventEmitter force return a EventEmitter in on().
* ToDo: Not sure in on() if return events$EventEmitter or this will be more suitable
* return this will restrict event to given literial when chain on().on().on().
* return a events$EventEmitter will fallback to raw EventEmitter, when chains
*/
declare class Client {
constructor(config?: string | ClientConfig): void;
connect(callback?: ClientConnectCallback):void;
end(): void;
escapeLiteral(str: string): string;
escapeIdentifier(str: string): string;
query:
( <T: QuerySubmittableConfig>(query: T, callback?: QueryCallback) => T ) &
( (query: QueryConfig|string, callback?: QueryCallback) => Query ) &
( (text: string, values: Array<any>, callback?: QueryCallback) => Query );
on:
((event: 'drain', listener: () => void) => this )&
((event: 'error', listener: (err: PG_ERROR) => void) => this )&
((event: 'notification', listener: (message: any) => void) => this )&
((event: 'notice', listener: (message: any) => void) => this )&
((event: 'end', listener: () => void) => this );
}
/*
* require('pg-types')
*/
declare type TypeParserText = (value: string) => any;
declare type TypeParserBinary = (value: Buffer) => any;
declare type Types = {
getTypeParser:
((oid: number, format?: 'text') => TypeParserText )&
((oid: number, format: 'binary') => TypeParserBinary );
setTypeParser:
((oid: number, format?: 'text', parseFn: TypeParserText) => void )&
((oid: number, format: 'binary', parseFn: TypeParserBinary) => void)&
((oid: number, parseFn: TypeParserText) => void),
}
/*
* lib/index.js ( class PG)
*/
declare class PG extends events$EventEmitter {
types: Types;
Client: Class<Client>;
Pool: Class<Pool>;
Connection: mixed; //Connection is used internally by the Client.
constructor(client: Client): void;
native: { // native binding, have the same capability like PG
types: Types;
Client: Class<Client>;
Pool: Class<Pool>;
Connection: mixed;
};
// The end(),connect(),cancel() in PG is abandoned ?
}
// These class are not exposed by pg.
declare type PoolType = Pool;
declare type PGType = PG;
declare type QueryType = Query;
// module export, keep same structure with index.js
declare module.exports: PG;
}

472
flow-typed/npm/pm2_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,472 @@
// flow-typed signature: 41176daaece69384f78eaf010c9437d4
// flow-typed version: <<STUB>>/pm2_v^3.3.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'pm2'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'pm2' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'pm2/constants' {
declare module.exports: any;
}
declare module 'pm2/lib/API' {
declare module.exports: any;
}
declare module 'pm2/lib/API/CliUx' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Configuration' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Containerizer' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Dashboard' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Deploy' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Extra' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Log' {
declare module.exports: any;
}
declare module 'pm2/lib/API/LogManagement' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/flagExt' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/flagWatch' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/HTTP' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/index' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/LOCAL' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/Modularizer' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/NPM' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Modules/TAR' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Monit' {
declare module.exports: any;
}
declare module 'pm2/lib/API/pm2-plus/auth-strategies/CliAuth' {
declare module.exports: any;
}
declare module 'pm2/lib/API/pm2-plus/auth-strategies/WebAuth' {
declare module.exports: any;
}
declare module 'pm2/lib/API/pm2-plus/helpers' {
declare module.exports: any;
}
declare module 'pm2/lib/API/pm2-plus/link' {
declare module.exports: any;
}
declare module 'pm2/lib/API/pm2-plus/PM2IO' {
declare module.exports: any;
}
declare module 'pm2/lib/API/pm2-plus/process-selector' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Serve' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Spinner' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Startup' {
declare module.exports: any;
}
declare module 'pm2/lib/API/Version' {
declare module.exports: any;
}
declare module 'pm2/lib/binaries/DevCLI' {
declare module.exports: any;
}
declare module 'pm2/lib/binaries/Runtime' {
declare module.exports: any;
}
declare module 'pm2/lib/binaries/Runtime4Docker' {
declare module.exports: any;
}
declare module 'pm2/lib/Client' {
declare module.exports: any;
}
declare module 'pm2/lib/Common' {
declare module.exports: any;
}
declare module 'pm2/lib/completion' {
declare module.exports: any;
}
declare module 'pm2/lib/Configuration' {
declare module.exports: any;
}
declare module 'pm2/lib/Daemon' {
declare module.exports: any;
}
declare module 'pm2/lib/Event' {
declare module.exports: any;
}
declare module 'pm2/lib/God' {
declare module.exports: any;
}
declare module 'pm2/lib/God/ActionMethods' {
declare module.exports: any;
}
declare module 'pm2/lib/God/ClusterMode' {
declare module.exports: any;
}
declare module 'pm2/lib/God/ForkMode' {
declare module.exports: any;
}
declare module 'pm2/lib/God/Methods' {
declare module.exports: any;
}
declare module 'pm2/lib/God/Reload' {
declare module.exports: any;
}
declare module 'pm2/lib/HttpInterface' {
declare module.exports: any;
}
declare module 'pm2/lib/ProcessContainer' {
declare module.exports: any;
}
declare module 'pm2/lib/ProcessContainerFork' {
declare module.exports: any;
}
declare module 'pm2/lib/ProcessUtils' {
declare module.exports: any;
}
declare module 'pm2/lib/Satan' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/Config' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/find-package-json' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/fmt' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/IsAbsolute' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/isbinaryfile' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/json5' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/open' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/passwd' {
declare module.exports: any;
}
declare module 'pm2/lib/tools/promise.min' {
declare module.exports: any;
}
declare module 'pm2/lib/TreeKill' {
declare module.exports: any;
}
declare module 'pm2/lib/Utility' {
declare module.exports: any;
}
declare module 'pm2/lib/Watcher' {
declare module.exports: any;
}
declare module 'pm2/lib/Worker' {
declare module.exports: any;
}
declare module 'pm2/paths' {
declare module.exports: any;
}
// Filename aliases
declare module 'pm2/constants.js' {
declare module.exports: $Exports<'pm2/constants'>;
}
declare module 'pm2/index' {
declare module.exports: $Exports<'pm2'>;
}
declare module 'pm2/index.js' {
declare module.exports: $Exports<'pm2'>;
}
declare module 'pm2/lib/API.js' {
declare module.exports: $Exports<'pm2/lib/API'>;
}
declare module 'pm2/lib/API/CliUx.js' {
declare module.exports: $Exports<'pm2/lib/API/CliUx'>;
}
declare module 'pm2/lib/API/Configuration.js' {
declare module.exports: $Exports<'pm2/lib/API/Configuration'>;
}
declare module 'pm2/lib/API/Containerizer.js' {
declare module.exports: $Exports<'pm2/lib/API/Containerizer'>;
}
declare module 'pm2/lib/API/Dashboard.js' {
declare module.exports: $Exports<'pm2/lib/API/Dashboard'>;
}
declare module 'pm2/lib/API/Deploy.js' {
declare module.exports: $Exports<'pm2/lib/API/Deploy'>;
}
declare module 'pm2/lib/API/Extra.js' {
declare module.exports: $Exports<'pm2/lib/API/Extra'>;
}
declare module 'pm2/lib/API/Log.js' {
declare module.exports: $Exports<'pm2/lib/API/Log'>;
}
declare module 'pm2/lib/API/LogManagement.js' {
declare module.exports: $Exports<'pm2/lib/API/LogManagement'>;
}
declare module 'pm2/lib/API/Modules/flagExt.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/flagExt'>;
}
declare module 'pm2/lib/API/Modules/flagWatch.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/flagWatch'>;
}
declare module 'pm2/lib/API/Modules/HTTP.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/HTTP'>;
}
declare module 'pm2/lib/API/Modules/index.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/index'>;
}
declare module 'pm2/lib/API/Modules/LOCAL.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/LOCAL'>;
}
declare module 'pm2/lib/API/Modules/Modularizer.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/Modularizer'>;
}
declare module 'pm2/lib/API/Modules/NPM.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/NPM'>;
}
declare module 'pm2/lib/API/Modules/TAR.js' {
declare module.exports: $Exports<'pm2/lib/API/Modules/TAR'>;
}
declare module 'pm2/lib/API/Monit.js' {
declare module.exports: $Exports<'pm2/lib/API/Monit'>;
}
declare module 'pm2/lib/API/pm2-plus/auth-strategies/CliAuth.js' {
declare module.exports: $Exports<'pm2/lib/API/pm2-plus/auth-strategies/CliAuth'>;
}
declare module 'pm2/lib/API/pm2-plus/auth-strategies/WebAuth.js' {
declare module.exports: $Exports<'pm2/lib/API/pm2-plus/auth-strategies/WebAuth'>;
}
declare module 'pm2/lib/API/pm2-plus/helpers.js' {
declare module.exports: $Exports<'pm2/lib/API/pm2-plus/helpers'>;
}
declare module 'pm2/lib/API/pm2-plus/link.js' {
declare module.exports: $Exports<'pm2/lib/API/pm2-plus/link'>;
}
declare module 'pm2/lib/API/pm2-plus/PM2IO.js' {
declare module.exports: $Exports<'pm2/lib/API/pm2-plus/PM2IO'>;
}
declare module 'pm2/lib/API/pm2-plus/process-selector.js' {
declare module.exports: $Exports<'pm2/lib/API/pm2-plus/process-selector'>;
}
declare module 'pm2/lib/API/Serve.js' {
declare module.exports: $Exports<'pm2/lib/API/Serve'>;
}
declare module 'pm2/lib/API/Spinner.js' {
declare module.exports: $Exports<'pm2/lib/API/Spinner'>;
}
declare module 'pm2/lib/API/Startup.js' {
declare module.exports: $Exports<'pm2/lib/API/Startup'>;
}
declare module 'pm2/lib/API/Version.js' {
declare module.exports: $Exports<'pm2/lib/API/Version'>;
}
declare module 'pm2/lib/binaries/DevCLI.js' {
declare module.exports: $Exports<'pm2/lib/binaries/DevCLI'>;
}
declare module 'pm2/lib/binaries/Runtime.js' {
declare module.exports: $Exports<'pm2/lib/binaries/Runtime'>;
}
declare module 'pm2/lib/binaries/Runtime4Docker.js' {
declare module.exports: $Exports<'pm2/lib/binaries/Runtime4Docker'>;
}
declare module 'pm2/lib/Client.js' {
declare module.exports: $Exports<'pm2/lib/Client'>;
}
declare module 'pm2/lib/Common.js' {
declare module.exports: $Exports<'pm2/lib/Common'>;
}
declare module 'pm2/lib/completion.js' {
declare module.exports: $Exports<'pm2/lib/completion'>;
}
declare module 'pm2/lib/Configuration.js' {
declare module.exports: $Exports<'pm2/lib/Configuration'>;
}
declare module 'pm2/lib/Daemon.js' {
declare module.exports: $Exports<'pm2/lib/Daemon'>;
}
declare module 'pm2/lib/Event.js' {
declare module.exports: $Exports<'pm2/lib/Event'>;
}
declare module 'pm2/lib/God.js' {
declare module.exports: $Exports<'pm2/lib/God'>;
}
declare module 'pm2/lib/God/ActionMethods.js' {
declare module.exports: $Exports<'pm2/lib/God/ActionMethods'>;
}
declare module 'pm2/lib/God/ClusterMode.js' {
declare module.exports: $Exports<'pm2/lib/God/ClusterMode'>;
}
declare module 'pm2/lib/God/ForkMode.js' {
declare module.exports: $Exports<'pm2/lib/God/ForkMode'>;
}
declare module 'pm2/lib/God/Methods.js' {
declare module.exports: $Exports<'pm2/lib/God/Methods'>;
}
declare module 'pm2/lib/God/Reload.js' {
declare module.exports: $Exports<'pm2/lib/God/Reload'>;
}
declare module 'pm2/lib/HttpInterface.js' {
declare module.exports: $Exports<'pm2/lib/HttpInterface'>;
}
declare module 'pm2/lib/ProcessContainer.js' {
declare module.exports: $Exports<'pm2/lib/ProcessContainer'>;
}
declare module 'pm2/lib/ProcessContainerFork.js' {
declare module.exports: $Exports<'pm2/lib/ProcessContainerFork'>;
}
declare module 'pm2/lib/ProcessUtils.js' {
declare module.exports: $Exports<'pm2/lib/ProcessUtils'>;
}
declare module 'pm2/lib/Satan.js' {
declare module.exports: $Exports<'pm2/lib/Satan'>;
}
declare module 'pm2/lib/tools/Config.js' {
declare module.exports: $Exports<'pm2/lib/tools/Config'>;
}
declare module 'pm2/lib/tools/find-package-json.js' {
declare module.exports: $Exports<'pm2/lib/tools/find-package-json'>;
}
declare module 'pm2/lib/tools/fmt.js' {
declare module.exports: $Exports<'pm2/lib/tools/fmt'>;
}
declare module 'pm2/lib/tools/IsAbsolute.js' {
declare module.exports: $Exports<'pm2/lib/tools/IsAbsolute'>;
}
declare module 'pm2/lib/tools/isbinaryfile.js' {
declare module.exports: $Exports<'pm2/lib/tools/isbinaryfile'>;
}
declare module 'pm2/lib/tools/json5.js' {
declare module.exports: $Exports<'pm2/lib/tools/json5'>;
}
declare module 'pm2/lib/tools/open.js' {
declare module.exports: $Exports<'pm2/lib/tools/open'>;
}
declare module 'pm2/lib/tools/passwd.js' {
declare module.exports: $Exports<'pm2/lib/tools/passwd'>;
}
declare module 'pm2/lib/tools/promise.min.js' {
declare module.exports: $Exports<'pm2/lib/tools/promise.min'>;
}
declare module 'pm2/lib/TreeKill.js' {
declare module.exports: $Exports<'pm2/lib/TreeKill'>;
}
declare module 'pm2/lib/Utility.js' {
declare module.exports: $Exports<'pm2/lib/Utility'>;
}
declare module 'pm2/lib/Watcher.js' {
declare module.exports: $Exports<'pm2/lib/Watcher'>;
}
declare module 'pm2/lib/Worker.js' {
declare module.exports: $Exports<'pm2/lib/Worker'>;
}
declare module 'pm2/paths.js' {
declare module.exports: $Exports<'pm2/paths'>;
}

32
flow-typed/npm/primer_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,32 @@
// flow-typed signature: 0eb53968e05fc802b36efa8668c646ca
// flow-typed version: <<STUB>>/primer_v^11.0.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'primer'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'primer' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'primer/build/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'primer/build/index.js' {
declare module.exports: $Exports<'primer/build/index'>;
}

375
flow-typed/npm/react-redux_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,375 @@
// flow-typed signature: f56226faeb83be5df973c399b21495d5
// flow-typed version: <<STUB>>/react-redux_v^6.0.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-redux'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-redux' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-redux/dist/react-redux' {
declare module.exports: any;
}
declare module 'react-redux/dist/react-redux.min' {
declare module.exports: any;
}
declare module 'react-redux/es/components/connectAdvanced' {
declare module.exports: any;
}
declare module 'react-redux/es/components/Context' {
declare module.exports: any;
}
declare module 'react-redux/es/components/Provider' {
declare module.exports: any;
}
declare module 'react-redux/es/connect/connect' {
declare module.exports: any;
}
declare module 'react-redux/es/connect/mapDispatchToProps' {
declare module.exports: any;
}
declare module 'react-redux/es/connect/mapStateToProps' {
declare module.exports: any;
}
declare module 'react-redux/es/connect/mergeProps' {
declare module.exports: any;
}
declare module 'react-redux/es/connect/selectorFactory' {
declare module.exports: any;
}
declare module 'react-redux/es/connect/verifySubselectors' {
declare module.exports: any;
}
declare module 'react-redux/es/connect/wrapMapToProps' {
declare module.exports: any;
}
declare module 'react-redux/es/index' {
declare module.exports: any;
}
declare module 'react-redux/es/utils/isPlainObject' {
declare module.exports: any;
}
declare module 'react-redux/es/utils/shallowEqual' {
declare module.exports: any;
}
declare module 'react-redux/es/utils/verifyPlainObject' {
declare module.exports: any;
}
declare module 'react-redux/es/utils/warning' {
declare module.exports: any;
}
declare module 'react-redux/es/utils/wrapActionCreators' {
declare module.exports: any;
}
declare module 'react-redux/lib/components/connectAdvanced' {
declare module.exports: any;
}
declare module 'react-redux/lib/components/Context' {
declare module.exports: any;
}
declare module 'react-redux/lib/components/Provider' {
declare module.exports: any;
}
declare module 'react-redux/lib/connect/connect' {
declare module.exports: any;
}
declare module 'react-redux/lib/connect/mapDispatchToProps' {
declare module.exports: any;
}
declare module 'react-redux/lib/connect/mapStateToProps' {
declare module.exports: any;
}
declare module 'react-redux/lib/connect/mergeProps' {
declare module.exports: any;
}
declare module 'react-redux/lib/connect/selectorFactory' {
declare module.exports: any;
}
declare module 'react-redux/lib/connect/verifySubselectors' {
declare module.exports: any;
}
declare module 'react-redux/lib/connect/wrapMapToProps' {
declare module.exports: any;
}
declare module 'react-redux/lib/index' {
declare module.exports: any;
}
declare module 'react-redux/lib/utils/isPlainObject' {
declare module.exports: any;
}
declare module 'react-redux/lib/utils/shallowEqual' {
declare module.exports: any;
}
declare module 'react-redux/lib/utils/verifyPlainObject' {
declare module.exports: any;
}
declare module 'react-redux/lib/utils/warning' {
declare module.exports: any;
}
declare module 'react-redux/lib/utils/wrapActionCreators' {
declare module.exports: any;
}
declare module 'react-redux/src/components/connectAdvanced' {
declare module.exports: any;
}
declare module 'react-redux/src/components/Context' {
declare module.exports: any;
}
declare module 'react-redux/src/components/Provider' {
declare module.exports: any;
}
declare module 'react-redux/src/connect/connect' {
declare module.exports: any;
}
declare module 'react-redux/src/connect/mapDispatchToProps' {
declare module.exports: any;
}
declare module 'react-redux/src/connect/mapStateToProps' {
declare module.exports: any;
}
declare module 'react-redux/src/connect/mergeProps' {
declare module.exports: any;
}
declare module 'react-redux/src/connect/selectorFactory' {
declare module.exports: any;
}
declare module 'react-redux/src/connect/verifySubselectors' {
declare module.exports: any;
}
declare module 'react-redux/src/connect/wrapMapToProps' {
declare module.exports: any;
}
declare module 'react-redux/src/index' {
declare module.exports: any;
}
declare module 'react-redux/src/utils/isPlainObject' {
declare module.exports: any;
}
declare module 'react-redux/src/utils/shallowEqual' {
declare module.exports: any;
}
declare module 'react-redux/src/utils/verifyPlainObject' {
declare module.exports: any;
}
declare module 'react-redux/src/utils/warning' {
declare module.exports: any;
}
declare module 'react-redux/src/utils/wrapActionCreators' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-redux/dist/react-redux.js' {
declare module.exports: $Exports<'react-redux/dist/react-redux'>;
}
declare module 'react-redux/dist/react-redux.min.js' {
declare module.exports: $Exports<'react-redux/dist/react-redux.min'>;
}
declare module 'react-redux/es/components/connectAdvanced.js' {
declare module.exports: $Exports<'react-redux/es/components/connectAdvanced'>;
}
declare module 'react-redux/es/components/Context.js' {
declare module.exports: $Exports<'react-redux/es/components/Context'>;
}
declare module 'react-redux/es/components/Provider.js' {
declare module.exports: $Exports<'react-redux/es/components/Provider'>;
}
declare module 'react-redux/es/connect/connect.js' {
declare module.exports: $Exports<'react-redux/es/connect/connect'>;
}
declare module 'react-redux/es/connect/mapDispatchToProps.js' {
declare module.exports: $Exports<'react-redux/es/connect/mapDispatchToProps'>;
}
declare module 'react-redux/es/connect/mapStateToProps.js' {
declare module.exports: $Exports<'react-redux/es/connect/mapStateToProps'>;
}
declare module 'react-redux/es/connect/mergeProps.js' {
declare module.exports: $Exports<'react-redux/es/connect/mergeProps'>;
}
declare module 'react-redux/es/connect/selectorFactory.js' {
declare module.exports: $Exports<'react-redux/es/connect/selectorFactory'>;
}
declare module 'react-redux/es/connect/verifySubselectors.js' {
declare module.exports: $Exports<'react-redux/es/connect/verifySubselectors'>;
}
declare module 'react-redux/es/connect/wrapMapToProps.js' {
declare module.exports: $Exports<'react-redux/es/connect/wrapMapToProps'>;
}
declare module 'react-redux/es/index.js' {
declare module.exports: $Exports<'react-redux/es/index'>;
}
declare module 'react-redux/es/utils/isPlainObject.js' {
declare module.exports: $Exports<'react-redux/es/utils/isPlainObject'>;
}
declare module 'react-redux/es/utils/shallowEqual.js' {
declare module.exports: $Exports<'react-redux/es/utils/shallowEqual'>;
}
declare module 'react-redux/es/utils/verifyPlainObject.js' {
declare module.exports: $Exports<'react-redux/es/utils/verifyPlainObject'>;
}
declare module 'react-redux/es/utils/warning.js' {
declare module.exports: $Exports<'react-redux/es/utils/warning'>;
}
declare module 'react-redux/es/utils/wrapActionCreators.js' {
declare module.exports: $Exports<'react-redux/es/utils/wrapActionCreators'>;
}
declare module 'react-redux/lib/components/connectAdvanced.js' {
declare module.exports: $Exports<'react-redux/lib/components/connectAdvanced'>;
}
declare module 'react-redux/lib/components/Context.js' {
declare module.exports: $Exports<'react-redux/lib/components/Context'>;
}
declare module 'react-redux/lib/components/Provider.js' {
declare module.exports: $Exports<'react-redux/lib/components/Provider'>;
}
declare module 'react-redux/lib/connect/connect.js' {
declare module.exports: $Exports<'react-redux/lib/connect/connect'>;
}
declare module 'react-redux/lib/connect/mapDispatchToProps.js' {
declare module.exports: $Exports<'react-redux/lib/connect/mapDispatchToProps'>;
}
declare module 'react-redux/lib/connect/mapStateToProps.js' {
declare module.exports: $Exports<'react-redux/lib/connect/mapStateToProps'>;
}
declare module 'react-redux/lib/connect/mergeProps.js' {
declare module.exports: $Exports<'react-redux/lib/connect/mergeProps'>;
}
declare module 'react-redux/lib/connect/selectorFactory.js' {
declare module.exports: $Exports<'react-redux/lib/connect/selectorFactory'>;
}
declare module 'react-redux/lib/connect/verifySubselectors.js' {
declare module.exports: $Exports<'react-redux/lib/connect/verifySubselectors'>;
}
declare module 'react-redux/lib/connect/wrapMapToProps.js' {
declare module.exports: $Exports<'react-redux/lib/connect/wrapMapToProps'>;
}
declare module 'react-redux/lib/index.js' {
declare module.exports: $Exports<'react-redux/lib/index'>;
}
declare module 'react-redux/lib/utils/isPlainObject.js' {
declare module.exports: $Exports<'react-redux/lib/utils/isPlainObject'>;
}
declare module 'react-redux/lib/utils/shallowEqual.js' {
declare module.exports: $Exports<'react-redux/lib/utils/shallowEqual'>;
}
declare module 'react-redux/lib/utils/verifyPlainObject.js' {
declare module.exports: $Exports<'react-redux/lib/utils/verifyPlainObject'>;
}
declare module 'react-redux/lib/utils/warning.js' {
declare module.exports: $Exports<'react-redux/lib/utils/warning'>;
}
declare module 'react-redux/lib/utils/wrapActionCreators.js' {
declare module.exports: $Exports<'react-redux/lib/utils/wrapActionCreators'>;
}
declare module 'react-redux/src/components/connectAdvanced.js' {
declare module.exports: $Exports<'react-redux/src/components/connectAdvanced'>;
}
declare module 'react-redux/src/components/Context.js' {
declare module.exports: $Exports<'react-redux/src/components/Context'>;
}
declare module 'react-redux/src/components/Provider.js' {
declare module.exports: $Exports<'react-redux/src/components/Provider'>;
}
declare module 'react-redux/src/connect/connect.js' {
declare module.exports: $Exports<'react-redux/src/connect/connect'>;
}
declare module 'react-redux/src/connect/mapDispatchToProps.js' {
declare module.exports: $Exports<'react-redux/src/connect/mapDispatchToProps'>;
}
declare module 'react-redux/src/connect/mapStateToProps.js' {
declare module.exports: $Exports<'react-redux/src/connect/mapStateToProps'>;
}
declare module 'react-redux/src/connect/mergeProps.js' {
declare module.exports: $Exports<'react-redux/src/connect/mergeProps'>;
}
declare module 'react-redux/src/connect/selectorFactory.js' {
declare module.exports: $Exports<'react-redux/src/connect/selectorFactory'>;
}
declare module 'react-redux/src/connect/verifySubselectors.js' {
declare module.exports: $Exports<'react-redux/src/connect/verifySubselectors'>;
}
declare module 'react-redux/src/connect/wrapMapToProps.js' {
declare module.exports: $Exports<'react-redux/src/connect/wrapMapToProps'>;
}
declare module 'react-redux/src/index.js' {
declare module.exports: $Exports<'react-redux/src/index'>;
}
declare module 'react-redux/src/utils/isPlainObject.js' {
declare module.exports: $Exports<'react-redux/src/utils/isPlainObject'>;
}
declare module 'react-redux/src/utils/shallowEqual.js' {
declare module.exports: $Exports<'react-redux/src/utils/shallowEqual'>;
}
declare module 'react-redux/src/utils/verifyPlainObject.js' {
declare module.exports: $Exports<'react-redux/src/utils/verifyPlainObject'>;
}
declare module 'react-redux/src/utils/warning.js' {
declare module.exports: $Exports<'react-redux/src/utils/warning'>;
}
declare module 'react-redux/src/utils/wrapActionCreators.js' {
declare module.exports: $Exports<'react-redux/src/utils/wrapActionCreators'>;
}

View file

@ -0,0 +1,127 @@
// flow-typed signature: 263123e4b3d2cb666a60f721c2da5354
// flow-typed version: e1af06321a/redux-devtools-extension_v2.x.x/flow_>=v0.47.x
import type { ActionCreator, StoreEnhancer } from 'redux';
import typeof { compose } from 'redux';
declare type $npm$ReduxDevtoolsExtension$DevToolsOptions = {
name?: string,
actionCreators?: Array<ActionCreator<any>> | { [string]: ActionCreator<any> },
latency?: number,
maxAge?: number,
serialize?: boolean | {
date?: boolean;
regex?: boolean;
undefined?: boolean;
error?: boolean;
symbol?: boolean;
map?: boolean;
set?: boolean;
function?: boolean | Function;
},
actionSanitizer?: <A: { type: $Subtype<string> }>(action: A, id: number) => A,
stateSanitizer?: <S>(state: S, index: number) => S,
actionsBlacklist?: string | string[],
actionsWhitelist?: string | string[],
predicate?: <S, A: { type: $Subtype<string> }>(state: S, action: A) => boolean,
shouldRecordChanges?: boolean,
pauseActionType?: string,
autoPause?: boolean,
shouldStartLocked?: boolean,
shouldHotReload?: boolean,
shouldCatchErrors?: boolean,
features?: {
pause?: boolean,
lock?: boolean,
persist?: boolean,
export?: boolean | "custom",
import?: boolean | "custom",
jump?: boolean,
skip?: boolean,
reorder?: boolean,
dispatch?: boolean,
test?: boolean
}
};
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B>(ab: A => B): A => B;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools(options: $npm$ReduxDevtoolsExtension$DevToolsOptions): compose;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B, C>(
bc: B => C,
ab: A => B
): A => C;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B, C, D>(
cd: C => D,
bc: B => C,
ab: A => B
): A => D;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B, C, D, E>(
de: D => E,
cd: C => D,
bc: B => C,
ab: A => B
): A => E;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B, C, D, E, F>(
ef: E => F,
de: D => E,
cd: C => D,
bc: B => C,
ab: A => B
): A => F;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B, C, D, E, F, G>(
fg: F => G,
ef: E => F,
de: D => E,
cd: C => D,
bc: B => C,
ab: A => B
): A => G;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B, C, D, E, F, G, H>(
gh: G => H,
fg: F => G,
ef: E => F,
de: D => E,
cd: C => D,
bc: B => C,
ab: A => B
): A => H;
declare function $npm$ReduxDevtoolsExtension$composeWithDevTools<A, B, C, D, E, F, G, H, I>(
hi: H => I,
gh: G => H,
fg: F => G,
ef: E => F,
de: D => E,
cd: C => D,
bc: B => C,
ab: A => B
): A => H;
declare function $npm$ReduxDevtoolsExtension$devToolsEnhancer<S, A>(options?: $npm$ReduxDevtoolsExtension$DevToolsOptions): StoreEnhancer<S, A>;
declare module 'redux-devtools-extension' {
declare export type DevToolsOptions = $npm$ReduxDevtoolsExtension$DevToolsOptions;
declare export var composeWithDevTools: typeof $npm$ReduxDevtoolsExtension$composeWithDevTools;
declare export var devToolsEnhancer: typeof $npm$ReduxDevtoolsExtension$devToolsEnhancer;
}
declare module 'redux-devtools-extension/developmentOnly' {
declare export type DevToolsOptions = $npm$ReduxDevtoolsExtension$DevToolsOptions;
declare export var composeWithDevTools: typeof $npm$ReduxDevtoolsExtension$composeWithDevTools;
declare export var devToolsEnhancer: typeof $npm$ReduxDevtoolsExtension$devToolsEnhancer;
}
declare module 'redux-devtools-extension/logOnly' {
declare export type DevToolsOptions = $npm$ReduxDevtoolsExtension$DevToolsOptions;
declare export var composeWithDevTools: typeof $npm$ReduxDevtoolsExtension$composeWithDevTools;
declare export var devToolsEnhancer: typeof $npm$ReduxDevtoolsExtension$devToolsEnhancer;
}
declare module 'redux-devtools-extension/logOnlyInProduction' {
declare export type DevToolsOptions = $npm$ReduxDevtoolsExtension$DevToolsOptions;
declare export var composeWithDevTools: typeof $npm$ReduxDevtoolsExtension$composeWithDevTools;
declare export var devToolsEnhancer: typeof $npm$ReduxDevtoolsExtension$devToolsEnhancer;
}

60
flow-typed/npm/redux-thunk_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,60 @@
// flow-typed signature: c8aae9e3e6a516e869da686c525f7c85
// flow-typed version: <<STUB>>/redux-thunk_v^2.3.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'redux-thunk'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'redux-thunk' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'redux-thunk/dist/redux-thunk' {
declare module.exports: any;
}
declare module 'redux-thunk/dist/redux-thunk.min' {
declare module.exports: any;
}
declare module 'redux-thunk/es/index' {
declare module.exports: any;
}
declare module 'redux-thunk/lib/index' {
declare module.exports: any;
}
declare module 'redux-thunk/src/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'redux-thunk/dist/redux-thunk.js' {
declare module.exports: $Exports<'redux-thunk/dist/redux-thunk'>;
}
declare module 'redux-thunk/dist/redux-thunk.min.js' {
declare module.exports: $Exports<'redux-thunk/dist/redux-thunk.min'>;
}
declare module 'redux-thunk/es/index.js' {
declare module.exports: $Exports<'redux-thunk/es/index'>;
}
declare module 'redux-thunk/lib/index.js' {
declare module.exports: $Exports<'redux-thunk/lib/index'>;
}
declare module 'redux-thunk/src/index.js' {
declare module.exports: $Exports<'redux-thunk/src/index'>;
}

59
flow-typed/npm/redux_v4.x.x.js vendored Normal file
View file

@ -0,0 +1,59 @@
// flow-typed signature: df80bdd535bfed9cf3223e077f3b4543
// flow-typed version: c4c8963c9c/redux_v4.x.x/flow_>=v0.55.x
declare module 'redux' {
/*
S = State
A = Action
D = Dispatch
*/
declare export type DispatchAPI<A> = (action: A) => A;
declare export type Dispatch<A: { type: $Subtype<string> }> = DispatchAPI<A>;
declare export type MiddlewareAPI<S, A, D = Dispatch<A>> = {
dispatch: D;
getState(): S;
};
declare export type Store<S, A, D = Dispatch<A>> = {
// rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages)
dispatch: D;
getState(): S;
subscribe(listener: () => void): () => void;
replaceReducer(nextReducer: Reducer<S, A>): void
};
declare export type Reducer<S, A> = (state: S | void, action: A) => S;
declare export type CombinedReducer<S, A> = (state: $Shape<S> & {} | void, action: A) => S;
declare export type Middleware<S, A, D = Dispatch<A>> =
(api: MiddlewareAPI<S, A, D>) =>
(next: D) => D;
declare export type StoreCreator<S, A, D = Dispatch<A>> = {
(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
(reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
};
declare export type StoreEnhancer<S, A, D = Dispatch<A>> = (next: StoreCreator<S, A, D>) => StoreCreator<S, A, D>;
declare export function createStore<S, A, D>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
declare export function createStore<S, A, D>(reducer: Reducer<S, A>, preloadedState?: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
declare export function applyMiddleware<S, A, D>(...middlewares: Array<Middleware<S, A, D>>): StoreEnhancer<S, A, D>;
declare export type ActionCreator<A, B> = (...args: Array<B>) => A;
declare export type ActionCreators<K, A> = { [key: K]: ActionCreator<A, any> };
declare export function bindActionCreators<A, C: ActionCreator<A, any>, D: DispatchAPI<A>>(actionCreator: C, dispatch: D): C;
declare export function bindActionCreators<A, K, C: ActionCreators<K, A>, D: DispatchAPI<A>>(actionCreators: C, dispatch: D): C;
declare export function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
declare export var compose: $Compose;
}

7454
flow-typed/npm/sequelize_v4.x.x.js vendored Normal file

File diff suppressed because it is too large Load diff

60
flow-typed/npm/socket.io_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,60 @@
// flow-typed signature: 67f12b1fba5a017c337c2a23790bbaab
// flow-typed version: <<STUB>>/socket.io_v^2.2.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'socket.io'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'socket.io' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'socket.io/lib/client' {
declare module.exports: any;
}
declare module 'socket.io/lib/index' {
declare module.exports: any;
}
declare module 'socket.io/lib/namespace' {
declare module.exports: any;
}
declare module 'socket.io/lib/parent-namespace' {
declare module.exports: any;
}
declare module 'socket.io/lib/socket' {
declare module.exports: any;
}
// Filename aliases
declare module 'socket.io/lib/client.js' {
declare module.exports: $Exports<'socket.io/lib/client'>;
}
declare module 'socket.io/lib/index.js' {
declare module.exports: $Exports<'socket.io/lib/index'>;
}
declare module 'socket.io/lib/namespace.js' {
declare module.exports: $Exports<'socket.io/lib/namespace'>;
}
declare module 'socket.io/lib/parent-namespace.js' {
declare module.exports: $Exports<'socket.io/lib/parent-namespace'>;
}
declare module 'socket.io/lib/socket.js' {
declare module.exports: $Exports<'socket.io/lib/socket'>;
}

59
flow-typed/npm/standard-flow_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,59 @@
// flow-typed signature: b804fe18497c555d6089d6462e8467e0
// flow-typed version: <<STUB>>/standard-flow_v^1.0.0/flow_v0.93.0
/**
* This is an autogenerated libdef stub for:
*
* 'standard-flow'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'standard-flow' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'standard-flow/bin/cmd' {
declare module.exports: any;
}
declare module 'standard-flow/options' {
declare module.exports: any;
}
declare module 'standard-flow/test/api' {
declare module.exports: any;
}
declare module 'standard-flow/test/cmd' {
declare module.exports: any;
}
// Filename aliases
declare module 'standard-flow/bin/cmd.js' {
declare module.exports: $Exports<'standard-flow/bin/cmd'>;
}
declare module 'standard-flow/index' {
declare module.exports: $Exports<'standard-flow'>;
}
declare module 'standard-flow/index.js' {
declare module.exports: $Exports<'standard-flow'>;
}
declare module 'standard-flow/options.js' {
declare module.exports: $Exports<'standard-flow/options'>;
}
declare module 'standard-flow/test/api.js' {
declare module.exports: $Exports<'standard-flow/test/api'>;
}
declare module 'standard-flow/test/cmd.js' {
declare module.exports: $Exports<'standard-flow/test/cmd'>;
}

45
flow-typed/npm/standard_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,45 @@
// flow-typed signature: e5c44e7949f78cf367a18eea2ea18e57
// flow-typed version: <<STUB>>/standard_v12.0.1/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'standard'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'standard' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'standard/bin/cmd' {
declare module.exports: any;
}
declare module 'standard/options' {
declare module.exports: any;
}
// Filename aliases
declare module 'standard/bin/cmd.js' {
declare module.exports: $Exports<'standard/bin/cmd'>;
}
declare module 'standard/index' {
declare module.exports: $Exports<'standard'>;
}
declare module 'standard/index.js' {
declare module.exports: $Exports<'standard'>;
}
declare module 'standard/options.js' {
declare module.exports: $Exports<'standard/options'>;
}

158
flow-typed/npm/superagent_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,158 @@
// flow-typed signature: e2616da49ccf8c31a50238ae5ca9658e
// flow-typed version: <<STUB>>/superagent_v^4.1.0/flow_v0.94.0
/**
* This is an autogenerated libdef stub for:
*
* 'superagent'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'superagent' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'superagent/dump' {
declare module.exports: any;
}
declare module 'superagent/lib/agent-base' {
declare module.exports: any;
}
declare module 'superagent/lib/client' {
declare module.exports: any;
}
declare module 'superagent/lib/is-object' {
declare module.exports: any;
}
declare module 'superagent/lib/node/agent' {
declare module.exports: any;
}
declare module 'superagent/lib/node/http2wrapper' {
declare module.exports: any;
}
declare module 'superagent/lib/node/index' {
declare module.exports: any;
}
declare module 'superagent/lib/node/parsers/image' {
declare module.exports: any;
}
declare module 'superagent/lib/node/parsers/index' {
declare module.exports: any;
}
declare module 'superagent/lib/node/parsers/json' {
declare module.exports: any;
}
declare module 'superagent/lib/node/parsers/text' {
declare module.exports: any;
}
declare module 'superagent/lib/node/parsers/urlencoded' {
declare module.exports: any;
}
declare module 'superagent/lib/node/response' {
declare module.exports: any;
}
declare module 'superagent/lib/node/unzip' {
declare module.exports: any;
}
declare module 'superagent/lib/request-base' {
declare module.exports: any;
}
declare module 'superagent/lib/response-base' {
declare module.exports: any;
}
declare module 'superagent/lib/utils' {
declare module.exports: any;
}
declare module 'superagent/superagent' {
declare module.exports: any;
}
declare module 'superagent/test' {
declare module.exports: any;
}
// Filename aliases
declare module 'superagent/dump.js' {
declare module.exports: $Exports<'superagent/dump'>;
}
declare module 'superagent/lib/agent-base.js' {
declare module.exports: $Exports<'superagent/lib/agent-base'>;
}
declare module 'superagent/lib/client.js' {
declare module.exports: $Exports<'superagent/lib/client'>;
}
declare module 'superagent/lib/is-object.js' {
declare module.exports: $Exports<'superagent/lib/is-object'>;
}
declare module 'superagent/lib/node/agent.js' {
declare module.exports: $Exports<'superagent/lib/node/agent'>;
}
declare module 'superagent/lib/node/http2wrapper.js' {
declare module.exports: $Exports<'superagent/lib/node/http2wrapper'>;
}
declare module 'superagent/lib/node/index.js' {
declare module.exports: $Exports<'superagent/lib/node/index'>;
}
declare module 'superagent/lib/node/parsers/image.js' {
declare module.exports: $Exports<'superagent/lib/node/parsers/image'>;
}
declare module 'superagent/lib/node/parsers/index.js' {
declare module.exports: $Exports<'superagent/lib/node/parsers/index'>;
}
declare module 'superagent/lib/node/parsers/json.js' {
declare module.exports: $Exports<'superagent/lib/node/parsers/json'>;
}
declare module 'superagent/lib/node/parsers/text.js' {
declare module.exports: $Exports<'superagent/lib/node/parsers/text'>;
}
declare module 'superagent/lib/node/parsers/urlencoded.js' {
declare module.exports: $Exports<'superagent/lib/node/parsers/urlencoded'>;
}
declare module 'superagent/lib/node/response.js' {
declare module.exports: $Exports<'superagent/lib/node/response'>;
}
declare module 'superagent/lib/node/unzip.js' {
declare module.exports: $Exports<'superagent/lib/node/unzip'>;
}
declare module 'superagent/lib/request-base.js' {
declare module.exports: $Exports<'superagent/lib/request-base'>;
}
declare module 'superagent/lib/response-base.js' {
declare module.exports: $Exports<'superagent/lib/response-base'>;
}
declare module 'superagent/lib/utils.js' {
declare module.exports: $Exports<'superagent/lib/utils'>;
}
declare module 'superagent/superagent.js' {
declare module.exports: $Exports<'superagent/superagent'>;
}
declare module 'superagent/test.js' {
declare module.exports: $Exports<'superagent/test'>;
}

102
flow-typed/npm/uuid_v3.x.x.js vendored Normal file
View file

@ -0,0 +1,102 @@
// flow-typed signature: 3cf668e64747095cab0bb360cf2fb34f
// flow-typed version: d659bd0cb8/uuid_v3.x.x/flow_>=v0.32.x
declare module "uuid" {
declare class uuid {
static (
options?: {|
random?: number[],
rng?: () => number[] | Buffer
|},
buffer?: number[] | Buffer,
offset?: number
): string,
static v1(
options?: {|
node?: number[],
clockseq?: number,
msecs?: number | Date,
nsecs?: number
|},
buffer?: number[] | Buffer,
offset?: number
): string,
static v4(
options?: {|
random?: number[],
rng?: () => number[] | Buffer
|},
buffer?: number[] | Buffer,
offset?: number
): string
}
declare module.exports: Class<uuid>;
}
declare module "uuid/v1" {
declare class v1 {
static (
options?: {|
node?: number[],
clockseq?: number,
msecs?: number | Date,
nsecs?: number
|},
buffer?: number[] | Buffer,
offset?: number
): string
}
declare module.exports: Class<v1>;
}
declare module "uuid/v3" {
declare class v3 {
static (
name?: string | number[],
namespace?: string | number[],
buffer?: number[] | Buffer,
offset?: number
): string,
static name: string,
static DNS: string,
static URL: string
}
declare module.exports: Class<v3>;
}
declare module "uuid/v4" {
declare class v4 {
static (
options?: {|
random?: number[],
rng?: () => number[] | Buffer
|},
buffer?: number[] | Buffer,
offset?: number
): string
}
declare module.exports: Class<v4>;
}
declare module "uuid/v5" {
declare class v5 {
static (
name?: string | number[],
namespace?: string | number[],
buffer?: number[] | Buffer,
offset?: number
): string,
static name: string,
static DNS: string,
static URL: string
}
declare module.exports: Class<v5>;
}

View file

@ -1,33 +1,33 @@
require('dotenv').config({ silent: true }) // @flow
const log = new (require('./logger'))('index') import 'dotenv/config'
import logger from './logger'
import http from 'http'
import Koa from 'koa'
import SocketIO from 'socket.io'
import Roleypoly from './Roleypoly'
import ksuid from 'ksuid'
import bodyParser from 'koa-bodyparser'
import compress from 'kompression'
import session from 'koa-session'
import invariant from 'invariant'
import Keygrip from 'keygrip'
const http = require('http') const log = logger(__filename)
const Koa = require('koa')
const app = new Koa() const app = new Koa()
const _io = require('socket.io')
const Roleypoly = require('./Roleypoly')
const ksuid = require('ksuid')
// monkey patch async-reduce because F U T U R E // monkey patch async-reduce because F U T U R E
Array.prototype.areduce = async function (predicate, acc = []) { // eslint-disable-line
for (let i of this) {
acc = await predicate(acc, i)
}
return acc
}
Array.prototype.filterNot = Array.prototype.filterNot || function (predicate) { // eslint-disable-line
return this.filter(v => !predicate(v))
}
// Create the server and socket.io server // Create the server and socket.io server
const server = http.createServer(app.callback()) const server = http.createServer(app.callback())
const io = _io(server, { transports: ['websocket'], path: '/api/socket.io' }) const io = SocketIO(server, { transports: ['websocket'], path: '/api/socket.io' })
const M = new Roleypoly(io, app) // eslint-disable-line no-unused-vars const M = new Roleypoly(io, app) // eslint-disable-line no-unused-vars
app.keys = [ process.env.APP_KEY ] const appKey = process.env.APP_KEY
if (appKey == null) {
throw invariant(false, '')
}
app.keys = new Keygrip([ appKey ])
const DEVEL = process.env.NODE_ENV === 'development' const DEVEL = process.env.NODE_ENV === 'development'
@ -35,11 +35,9 @@ async function start () {
await M.awaitServices() await M.awaitServices()
// body parser // body parser
const bodyParser = require('koa-bodyparser') app.use(bodyParser())
app.use(bodyParser({ types: ['json'] }))
// Compress // Compress
const compress = require('koa-compress')
app.use(compress()) app.use(compress())
// Request logger // Request logger
@ -64,7 +62,6 @@ async function start () {
// return null // return null
}) })
const session = require('koa-session')
app.use(session({ app.use(session({
key: 'roleypoly:sess', key: 'roleypoly:sess',
maxAge: 'session', maxAge: 'session',

View file

@ -1,16 +1,16 @@
const chalk = require('chalk') // @flow
// const { debug } = require('yargs').argv import chalk from 'chalk'
// process.env.DEBUG = process.env.DEBUG || debug
// logger template//
// const log = new (require('../logger'))('server/thing')
class Logger { export class Logger {
constructor (name, debugOverride = false) { debugOn: boolean
name: string
constructor (name: string, debugOverride: boolean = false) {
this.name = name this.name = name
this.debugOn = (process.env.DEBUG === 'true' || process.env.DEBUG === '*') || debugOverride this.debugOn = (process.env.DEBUG === 'true' || process.env.DEBUG === '*') || debugOverride
} }
fatal (text, ...data) { fatal (text: string, ...data: any) {
this.error(text, data) this.error(text, data)
if (typeof data[data.length - 1] === 'number') { if (typeof data[data.length - 1] === 'number') {
@ -18,41 +18,47 @@ class Logger {
} else { } else {
process.exit(1) process.exit(1)
} }
throw text
} }
error (text, ...data) { error (text: string, ...data: any) {
console.error(chalk.red.bold(`ERR ${this.name}:`) + `\n ${text}`, data) console.error(chalk.red.bold(`ERR ${this.name}:`) + `\n ${text}`, data)
} }
warn (text, ...data) { warn (text: string, ...data: any) {
console.warn(chalk.yellow.bold(`WARN ${this.name}:`) + `\n ${text}`, data) console.warn(chalk.yellow.bold(`WARN ${this.name}:`) + `\n ${text}`, data)
} }
notice (text, ...data) { notice (text: string, ...data: any) {
console.log(chalk.cyan.bold(`NOTICE ${this.name}:`) + `\n ${text}`, data) console.log(chalk.cyan.bold(`NOTICE ${this.name}:`) + `\n ${text}`, data)
} }
info (text, ...data) { info (text: string, ...data: any) {
console.info(chalk.blue.bold(`INFO ${this.name}:`) + `\n ${text}`, data) console.info(chalk.blue.bold(`INFO ${this.name}:`) + `\n ${text}`, data)
} }
request (text, ...data) { deprecated (text: string, ...data: any) {
console.warn(chalk.yellowBright(`DEPRECATED ${this.name}:`) + `\n ${text}`, data)
console.trace()
}
request (text: string, ...data: any) {
console.info(chalk.green.bold(`HTTP ${this.name}:`) + `\n ${text}`) console.info(chalk.green.bold(`HTTP ${this.name}:`) + `\n ${text}`)
} }
debug (text, ...data) { debug (text: string, ...data: any) {
if (this.debugOn) { if (this.debugOn) {
console.log(chalk.gray.bold(`DEBUG ${this.name}:`) + `\n ${text}`, data) console.log(chalk.gray.bold(`DEBUG ${this.name}:`) + `\n ${text}`, data)
} }
} }
sql (logger, ...data) { sql (logger: Logger, ...data: any) {
if (logger.debugOn) { if (logger.debugOn) {
console.log(chalk.bold('DEBUG SQL:\n '), data) console.log(chalk.bold('DEBUG SQL:\n '), data)
} }
} }
} }
module.exports = Logger export default (pathname: string) => {
const name = pathname.replace(__dirname, '').replace('.js', '')
return new Logger(name)
}

View file

@ -1,4 +1,22 @@
module.exports = (sql, DataTypes) => { // @flow
import type Sequelize, { DataTypes as DT } from 'sequelize'
export type Category = {
hidden: boolean,
name: string,
roles: string[],
type: 'single' | 'multi' | string
}
export type ServerModel = {
id: string,
categories: {
[uuid: string]: Category
},
message: string
}
export default (sql: Sequelize, DataTypes: DT) => {
return sql.define('server', { return sql.define('server', {
id: { // discord snowflake id: { // discord snowflake
type: DataTypes.TEXT, type: DataTypes.TEXT,

View file

@ -1,10 +1,20 @@
const log = new (require('../logger'))('models/index') // @flow
const glob = require('glob') import logger from '../logger'
const path = require('path') import glob from 'glob'
// const util = require('../util/model-methods') import path from 'path'
import type Sequelize, { Model } from 'sequelize'
module.exports = (sql) => { const log = logger(__filename)
const models = {}
export type Models = {
[modelName: string]: Model<any> & {
__associations: (models: Models) => void,
__instanceMethods: (model: Model<any>) => void,
}
}
export default (sql: Sequelize): Models => {
const models: Models = {}
const modelFiles = glob.sync('./models/**/!(index).js') const modelFiles = glob.sync('./models/**/!(index).js')
log.debug('found models', modelFiles) log.debug('found models', modelFiles)

View file

@ -3,42 +3,74 @@
"version": "2.0.0", "version": "2.0.0",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "node index.js", "start": "NODE_ENV=production node dist/index.js",
"dev": "node index.js", "dev": "babel-node index.js",
"build": "next build ui" "build": "npm-run-all build:*",
"build:ui": "NODE_ENV=production next build ui",
"build:server": "NODE_ENV=production babel --delete-dir-on-start -d dist .",
"build:move": "mkdir dist/ui; cp -R ui/.next dist/ui/.next"
}, },
"dependencies": { "dependencies": {
"@discordjs/uws": "^11.149.1", "@discordjs/uws": "^11.149.1",
"@primer/components": "^10.0.1", "@primer/components": "^11.0.0",
"chalk": "^2.4.2", "chalk": "^2.4.2",
"discord.js": "^11.4.2", "discord.js": "^11.4.2",
"dotenv": "^6.2.0", "dotenv": "^6.2.0",
"erlpack": "github:discordapp/erlpack", "erlpack": "github:discordapp/erlpack",
"fast-redux": "^0.7.1",
"fnv-plus": "^1.2.12",
"glob": "^7.1.3", "glob": "^7.1.3",
"immutable": "^3.8.2", "immutable": "^4.0.0-rc.12",
"invariant": "^2.2.4",
"keygrip": "^1.0.3",
"koa": "^2.7.0", "koa": "^2.7.0",
"koa-better-router": "^2.1.1", "koa-better-router": "^2.1.1",
"koa-bodyparser": "^4.2.1", "koa-bodyparser": "^4.2.1",
"koa-compress": "^3.0.0",
"koa-session": "^5.10.1", "koa-session": "^5.10.1",
"kompression": "^1.0.0",
"ksuid": "^1.1.3", "ksuid": "^1.1.3",
"lru-cache": "^5.1.1", "lru-cache": "^5.1.1",
"next": "^8.0.3", "next": "^8.0.3",
"pg": "^7.8.1", "next-redux-wrapper": "^3.0.0-alpha.2",
"pg": "^7.8.2",
"pg-hstore": "^2.3.2", "pg-hstore": "^2.3.2",
"pm2": "^3.3.1", "pm2": "^3.3.1",
"react": "^16.8.3", "primer": "^11.0.0",
"react-dom": "^16.8.3", "react": "^16.8.4",
"sequelize": "^4.42.0", "react-dom": "^16.8.4",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0",
"sequelize": "^4.43.0",
"socket.io": "^2.2.0", "socket.io": "^2.2.0",
"superagent": "^4.1.0", "superagent": "^4.1.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/node": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/preset-flow": "^7.0.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"babel-plugin-transform-flow-strip-types": "^6.22.0", "babel-plugin-transform-flow-strip-types": "^6.22.0",
"chokidar": "^2.1.2", "chokidar": "^2.1.2",
"flow-type": "^1.0.1", "eslint-plugin-flowtype": "^3.4.2",
"standard": "^12.0.1" "flow-bin": "^0.94.0",
"flow-typed": "^2.5.1",
"npm-run-all": "^4.1.5",
"standard": "12.0.1"
},
"standard": {
"parser": "babel-eslint",
"plugins": [
"flowtype"
],
"globals": [
"$Shape"
]
} }
} }

60
rpc/_autoloader.js Normal file
View file

@ -0,0 +1,60 @@
// @flow
import logger from '../logger'
import glob from 'glob'
import path from 'path'
import { type AppContext } from '../Roleypoly'
const log = logger(__filename)
const PROD: boolean = process.env.NODE_ENV === 'production'
export default (ctx: AppContext, forceClear: ?boolean = false): {
[rpc: string]: Function
} => {
let map = {}
const apis = glob.sync(`./rpc/**/!(index).js`)
log.debug('found rpcs', apis)
for (let a of apis) {
const filename = path.basename(a)
const dirname = path.dirname(a)
// internal stuff
if (filename.startsWith('_')) {
log.debug(`skipping ${a}`)
continue
}
if (dirname === 'client') {
log.debug(`skipping ${a}`)
continue
}
// testing only
if (filename.endsWith('_test.js') && PROD) {
log.debug(`skipping ${a}`)
continue
}
log.debug(`mounting ${a}`)
try {
const pathname = a.replace('rpc/', '')
delete require.cache[require.resolve(pathname)]
const r = require(pathname)
let o = r
if (o.default) {
o = r.default
}
map = {
...map,
...o(ctx)
}
} catch (e) {
log.error(`couldn't mount ${a}`, e)
}
}
return map
}

15
rpc/_error.js Normal file
View file

@ -0,0 +1,15 @@
class RPCError extends Error {
constructor (msg, code, ...extra) {
super(msg)
this.code = code
this.extra = extra
}
static fromResponse (body, status) {
const e = new RPCError(body.msg, status)
e.remoteStack = body.trace
return e
}
}
module.exports = RPCError

111
rpc/index.js Normal file
View file

@ -0,0 +1,111 @@
// @flow
import logger from '../logger'
import fnv from 'fnv-plus'
import autoloader from './_autoloader'
import RPCError from './_error'
import type Roleypoly from '../Roleypoly'
import type betterRouter from 'koa-better-router'
import { type Context } from 'koa'
const log = logger(__filename)
export default class RPCServer {
ctx: Roleypoly
rpcMap: {
[rpc: string]: Function
}
mapHash: string
rpcCalls: { name: string, args: number }[]
constructor (ctx: Roleypoly) {
this.ctx = ctx
this.reload()
}
reload () {
// actual function map
this.rpcMap = autoloader(this.ctx.ctx)
// hash of the map
// used for known-reloads in the client.
this.mapHash = fnv.hash(Object.keys(this.rpcMap)).str()
// call map for the client.
this.rpcCalls = Object.keys(this.rpcMap).map(fn => ({ name: this.rpcMap[fn].name, args: this.rpcMap[fn].length - 1 }))
}
hookRoutes (router: betterRouter) {
// RPC call reporter.
// this is NEVER called in prod.
// it is used to generate errors if RPC calls don't exist or are malformed in dev.
router.get('/api/_rpc', async (ctx) => {
ctx.body = {
hash: this.mapHash,
available: this.rpcCalls
}
ctx.status = 200
return true
})
router.post('/api/_rpc', this.handleRPC.bind(this))
}
async handleRPC (ctx: Context) {
// handle an impossible situation
if (!(ctx.request.body instanceof Object)) {
return this.rpcError(ctx, null, new RPCError('RPC format was very incorrect.', 400))
}
// check if RPC exists
const { fn, args } = ctx.request.body
if (!(fn in this.rpcMap)) {
return this.rpcError(ctx, null, new RPCError(`RPC call ${fn}(...) not found.`, 404))
}
const call = this.rpcMap[fn]
// if call.length (which is the solid args list)
// is longer than args, we have too little to call the function.
if (args.length < call.length) {
return this.rpcError(ctx, null, new RPCError(`RPC call ${fn}() with ${args.length} arguments does not exist.`, 400))
}
try {
const response = await call(ctx, ...args)
ctx.body = {
hash: this.mapHash,
response
}
ctx.status = 200
} catch (err) {
return this.rpcError(ctx, 'RPC call errored', err, 500)
}
}
rpcError (ctx: Context & {body: any}, msg: ?string, err: ?Error = null, code: ?number = null) {
log.error('rpc error', { msg, err })
ctx.body = {
msg,
error: true
}
if (err instanceof RPCError) {
// this is one of our own errors, so we have a lot of data on this.
ctx.status = err.code || code || 500
ctx.body.msg = `${msg || 'RPC Error'}: ${err.message}`
} else {
if (msg == null && err != null) {
ctx.body.msg = msg = err.message
}
// if not, just play cloudflare, say something was really weird, and move on.
ctx.status = code || 520
ctx.message = 'Unknown Error'
}
}
}

14
rpc/rpc_test.js Normal file
View file

@ -0,0 +1,14 @@
// @flow
import { type AppContext } from '../Roleypoly'
import { type Context } from 'koa'
export default ($: AppContext) => ({
// i want RPC to be *dead* simple.
// probably too simple.
hello (_: Context, hello: string) {
return `hello, ${hello}!`
},
testJSON (_: Context, inobj: {}) {
return inobj
}
})

15
rpc/servers.js Normal file
View file

@ -0,0 +1,15 @@
// @flow
import { type AppContext } from '../Roleypoly'
import { type Context } from 'koa'
import { type Guild } from 'discord.js'
export default ($: AppContext) => ({
listRelevantServers (ctx: Context) {
return $.discord.client.guilds.map<{
url: string,
name: string,
members: number,
roles: number
}>((g: Guild) => ({ url: `${$.config.appUrl}/s/${g.id}`, name: g.name, members: g.members.array().length, roles: g.roles.array().length }))
}
})

View file

@ -1,10 +1,12 @@
const Logger = require('../logger') // @flow
import { Logger } from '../logger'
import { type AppContext } from '../Roleypoly'
class Service { export default class Service {
constructor (ctx) { ctx: AppContext
log: Logger
constructor (ctx: AppContext) {
this.ctx = ctx this.ctx = ctx
this.log = new Logger(this.constructor.name) this.log = new Logger(this.constructor.name)
} }
} }
module.exports = Service

View file

@ -1,37 +1,71 @@
const Service = require('./Service') // @flow
const discord = require('discord.js') import Service from './Service'
const superagent = require('superagent') import superagent from 'superagent'
// import invariant from 'invariant'
import { type AppContext } from '../Roleypoly'
import {
type Message,
type Guild,
type Role,
type GuildMember,
type Collection,
Client
} from 'discord.js'
export type UserPartial = {
id: string,
username: string,
discriminator: string,
avatar: string
}
export type Permissions = {
isAdmin: boolean,
canManageRoles: boolean
}
type ChatCommandHandler = (message: Message, matches: string[], reply: (text: string) => Promise<Message>) => Promise<void>|void
type ChatCommand = {
regex: RegExp,
handler: ChatCommandHandler
}
class DiscordService extends Service { class DiscordService extends Service {
constructor (ctx) { botToken: string = process.env.DISCORD_BOT_TOKEN || ''
super(ctx) clientId: string = process.env.DISCORD_CLIENT_ID || ''
clientSecret: string = process.env.DISCORD_CLIENT_SECRET || ''
oauthCallback: string = process.env.OAUTH_AUTH_CALLBACK || ''
isBot: boolean = process.env.IS_BOT === 'true'
this.botToken = process.env.DISCORD_BOT_TOKEN appUrl: string
this.clientId = process.env.DISCORD_CLIENT_ID botCallback: string
this.clientSecret = process.env.DISCORD_CLIENT_SECRET rootUsers: Set<string>
this.oauthCallback = process.env.OAUTH_AUTH_CALLBACK client: Client
this.botCallback = `${ctx.config.appUrl}/api/oauth/bot/callback` cmds: ChatCommand[]
this.appUrl = process.env.APP_URL constructor (ctx: AppContext) {
this.isBot = process.env.IS_BOT === 'true' || false super(ctx)
this.appUrl = ctx.config.appUrl
this.botCallback = `${this.appUrl}/api/oauth/bot/callback`
this.rootUsers = new Set((process.env.ROOT_USERS || '').split(',')) this.rootUsers = new Set((process.env.ROOT_USERS || '').split(','))
this.client = new discord.Client() this.client = new Client()
this.client.options.disableEveryone = true this.client.options.disableEveryone = true
this.cmds = this._cmds() this._cmds()
this.startBot() this.startBot()
} }
ownGm (server) { ownGm (server: string) {
return this.gm(server, this.client.user.id) return this.gm(server, this.client.user.id)
} }
fakeGm ({ id = 0, nickname = '[none]', displayHexColor = '#ffffff' }) { fakeGm ({ id = '0', nickname = '[none]', displayHexColor = '#ffffff' }: $Shape<{ id: string, nickname: string, displayHexColor: string }>) { // eslint-disable-line no-undef
return { id, nickname, displayHexColor, __faked: true, roles: { has () { return false } } } return { id, nickname, displayHexColor, __faked: true, roles: { has () { return false } } }
} }
isRoot (id) { isRoot (id: string): boolean {
return this.rootUsers.has(id) return this.rootUsers.has(id)
} }
@ -50,19 +84,27 @@ class DiscordService extends Service {
} }
} }
getRelevantServers (userId) { getRelevantServers (userId: string): Collection<string, Guild> {
return this.client.guilds.filter((g) => g.members.has(userId)) return this.client.guilds.filter((g) => g.members.has(userId))
} }
gm (serverId, userId) { gm (serverId: string, userId: string): ?GuildMember {
return this.client.guilds.get(serverId).members.get(userId) const s = this.client.guilds.get(serverId)
if (s == null) {
return null
}
return s.members.get(userId)
} }
getRoles (server) { getRoles (server: string) {
return this.client.guilds.get(server).roles const s = this.client.guilds.get(server)
if (s == null) {
return null
}
return s.roles
} }
getPermissions (gm) { getPermissions (gm: GuildMember): Permissions {
if (this.isRoot(gm.id)) { if (this.isRoot(gm.id)) {
return { return {
isAdmin: true, isAdmin: true,
@ -71,18 +113,26 @@ class DiscordService extends Service {
} }
return { return {
isAdmin: gm.permissions.hasPermission('ADMINISTRATOR'), isAdmin: gm.permissions.has('ADMINISTRATOR'),
canManageRoles: gm.permissions.hasPermission('MANAGE_ROLES', false, true) canManageRoles: gm.permissions.has('MANAGE_ROLES', true)
} }
} }
safeRole (server, role) { safeRole (server: string, role: string) {
const r = this.getRoles(server).get(role) const rl = this.getRoles(server)
if (rl == null) {
throw new Error(`safeRole can't see ${server}`)
}
const r: ?Role = rl.get(role)
if (r == null) {
throw new Error(`safeRole can't find ${role} in ${server}`)
}
return r.editable && !r.hasPermission('MANAGE_ROLES', false, true) return r.editable && !r.hasPermission('MANAGE_ROLES', false, true)
} }
// oauth step 2 flow, grab the auth token via code // oauth step 2 flow, grab the auth token via code
async getAuthToken (code) { async getAuthToken (code: string) {
const url = 'https://discordapp.com/api/oauth2/token' const url = 'https://discordapp.com/api/oauth2/token'
try { try {
const rsp = const rsp =
@ -104,7 +154,7 @@ class DiscordService extends Service {
} }
} }
async getUser (authToken) { async getUser (authToken?: string): Promise<UserPartial> {
const url = 'https://discordapp.com/api/v6/users/@me' const url = 'https://discordapp.com/api/v6/users/@me'
try { try {
if (authToken == null || authToken === '') { if (authToken == null || authToken === '') {
@ -146,17 +196,17 @@ class DiscordService extends Service {
// returns oauth authorize url with IDENTIFY permission // returns oauth authorize url with IDENTIFY permission
// we only need IDENTIFY because we only use it for matching IDs from the bot // we only need IDENTIFY because we only use it for matching IDs from the bot
getAuthUrl (state) { getAuthUrl (state: string): string {
return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&redirect_uri=${this.oauthCallback}&response_type=code&scope=identify&state=${state}` return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&redirect_uri=${this.oauthCallback}&response_type=code&scope=identify&state=${state}`
} }
// returns the bot join url with MANAGE_ROLES permission // returns the bot join url with MANAGE_ROLES permission
// MANAGE_ROLES is the only permission we really need. // MANAGE_ROLES is the only permission we really need.
getBotJoinUrl () { getBotJoinUrl (): string {
return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=268435456` return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=268435456`
} }
mentionResponse (message) { mentionResponse (message: Message) {
message.channel.send(`🔰 Assign your roles here! <${this.appUrl}/s/${message.guild.id}>`, { disableEveryone: true }) message.channel.send(`🔰 Assign your roles here! <${this.appUrl}/s/${message.guild.id}>`, { disableEveryone: true })
} }
@ -193,10 +243,11 @@ class DiscordService extends Service {
// prefix regex with ^ for ease of code // prefix regex with ^ for ease of code
.map(({ regex, ...rest }) => ({ regex: new RegExp(`^${regex.source}`, regex.flags), ...rest })) .map(({ regex, ...rest }) => ({ regex: new RegExp(`^${regex.source}`, regex.flags), ...rest }))
this.cmds = cmds
return cmds return cmds
} }
async handleCommand (message) { async handleCommand (message: Message) {
const cmd = message.content.replace(`<@${this.client.user.id}> `, '') const cmd = message.content.replace(`<@${this.client.user.id}> `, '')
this.log.debug(`got command from ${message.author.username}`, cmd) this.log.debug(`got command from ${message.author.username}`, cmd)
for (let { regex, handler } of this.cmds) { for (let { regex, handler } of this.cmds) {
@ -218,8 +269,8 @@ class DiscordService extends Service {
this.mentionResponse(message) this.mentionResponse(message)
} }
handleMessage (message) { handleMessage (message: Message) {
if (message.author.bot && message.channel.type !== 'text') { // drop bot messages and dms if (message.author.bot || message.channel.type !== 'text') { // drop bot messages and dms
return return
} }
@ -232,7 +283,7 @@ class DiscordService extends Service {
} }
} }
async handleJoin (guild) { async handleJoin (guild: Guild) {
await this.ctx.server.ensure(guild) await this.ctx.server.ensure(guild)
} }
} }

View file

@ -1,8 +1,49 @@
const Service = require('./Service') // @flow
const LRU = require('lru-cache') import Service from './Service'
import LRU from 'lru-cache'
import { type AppContext } from '../Roleypoly'
import { type Models } from '../models'
import { type ServerModel } from '../models/Server'
import type DiscordService, { Permissions } from './discord'
import {
type Guild,
type GuildMember,
type Collection
} from 'discord.js'
import areduce from '../util/areduce'
export type ServerSlug = {
id: string,
name: string,
ownerID: string,
icon: string
}
export type PresentableRole = {
id: string,
color: number,
name: string,
position: number,
safe: boolean
}
export type PresentableServer = ServerModel & {
id: string,
gm: {
nickname: string,
color: string
},
server: ServerSlug,
roles: ?PresentableRole[],
perms: Permissions
}
class PresentationService extends Service { class PresentationService extends Service {
constructor (ctx) { cache: LRU
M: Models
discord: DiscordService
constructor (ctx: AppContext) {
super(ctx) super(ctx)
this.M = ctx.M this.M = ctx.M
this.discord = ctx.discord this.discord = ctx.discord
@ -10,7 +51,7 @@ class PresentationService extends Service {
this.cache = new LRU({ max: 500, maxAge: 100 * 60 * 5 }) this.cache = new LRU({ max: 500, maxAge: 100 * 60 * 5 })
} }
serverSlug (server) { serverSlug (server: Guild): ServerSlug {
return { return {
id: server.id, id: server.id,
name: server.name, name: server.name,
@ -19,27 +60,34 @@ class PresentationService extends Service {
} }
} }
async oldPresentableServers (collection, userId) { async oldPresentableServers (collection: Collection<string, Guild>, userId: string) {
this.log.deprecated('use presentableServers instead of oldPresentableServers')
let servers = [] let servers = []
for (let server of collection.array()) { for (let server of collection.array()) {
const gm = server.members.get(userId) const gm = server.members.get(userId)
// $FlowFixMe this is deprecated, forget adding more check code.
servers.push(await this.presentableServer(server, gm)) servers.push(await this.presentableServer(server, gm))
} }
return servers return servers
} }
async presentableServers (collection, userId) { presentableServers (collection: Collection<string, Guild>, userId: string) {
return collection.array().areduce(async (acc, server) => { return areduce(collection.array(), async (acc, server) => {
const gm = server.members.get(userId) const gm = server.members.get(userId)
if (gm == null) {
throw new Error(`somehow this guildmember ${userId} of ${server.id} didn't exist.`)
}
acc.push(await this.presentableServer(server, gm, { incRoles: false })) acc.push(await this.presentableServer(server, gm, { incRoles: false }))
return acc return acc
}) }, [])
} }
async presentableServer (server, gm, { incRoles = true } = {}) { async presentableServer (server: Guild, gm: GuildMember, { incRoles = true }: { incRoles: boolean } = {}): Promise<PresentableServer> {
const sd = await this.ctx.server.get(server.id) const sd = await this.ctx.server.get(server.id)
return { return {
@ -56,7 +104,7 @@ class PresentationService extends Service {
} }
} }
async rolesByServer (server) { async rolesByServer (server: Guild, sd: ServerModel): Promise<PresentableRole[]> {
return server.roles return server.roles
.filter(r => r.id !== server.id) // get rid of @everyone .filter(r => r.id !== server.id) // get rid of @everyone
.map(r => ({ .map(r => ({

View file

@ -1,13 +1,22 @@
const Service = require('./Service') // @flow
import Service from './Service'
import { type AppContext } from '../Roleypoly'
import type PresentationService from './presentation'
import {
type Guild
} from 'discord.js'
import { type ServerModel, type Category } from '../models/Server'
class ServerService extends Service { export default class ServerService extends Service {
constructor (ctx) { Server: any // Model<ServerModel> but flowtype is bugged
P: PresentationService
constructor (ctx: AppContext) {
super(ctx) super(ctx)
this.Server = ctx.M.Server this.Server = ctx.M.Server
this.P = ctx.P this.P = ctx.P
} }
async ensure (server) { async ensure (server: Guild) {
let srv let srv
try { try {
srv = await this.get(server.id) srv = await this.get(server.id)
@ -24,19 +33,19 @@ class ServerService extends Service {
} }
} }
create ({ id, message, categories }) { create ({ id, message, categories }: ServerModel) {
const srv = this.Server.build({ id, message, categories }) const srv = this.Server.build({ id, message, categories })
return srv.save() return srv.save()
} }
async update (id, newData) { async update (id: string, newData: $Shape<ServerModel>) { // eslint-disable-line no-undef
const srv = await this.get(id, false) const srv = await this.get(id, false)
return srv.update(newData) return srv.update(newData)
} }
async get (id, plain = true) { async get (id: string, plain: boolean = true) {
const s = await this.Server.findOne({ const s = await this.Server.findOne({
where: { where: {
id id
@ -50,17 +59,17 @@ class ServerService extends Service {
return s.get({ plain: true }) return s.get({ plain: true })
} }
async getAllowedRoles (id) { async getAllowedRoles (id: string) {
const server = await this.get(id) const server: ServerModel = await this.get(id)
const categories: Category[] = (Object.values(server.categories): any)
const allowed: string[] = []
return Object.values(server.categories).reduce((acc, c) => { for (const c of categories) {
if (c.hidden !== true) { if (c.hidden !== true) {
return acc.concat(c.roles) allowed.concat(c.roles)
} }
}
return acc return allowed
}, [])
} }
} }
module.exports = ServerService

View file

@ -1,12 +1,21 @@
const Service = require('./Service') // @flow
import Service from './Service'
import { type AppContext } from '../Roleypoly'
class SessionsService extends Service { type SessionData = {
constructor (ctx) { rolling: boolean,
maxAge: number,
changed: boolean
}
export default class SessionsService extends Service {
Session: any
constructor (ctx: AppContext) {
super(ctx) super(ctx)
this.Session = ctx.M.Session this.Session = ctx.M.Session
} }
async get (id, { rolling }) { async get (id: string, { rolling }: SessionData) {
const user = await this.Session.findOne({ where: { id } }) const user = await this.Session.findOne({ where: { id } })
if (user === null) { if (user === null) {
@ -16,7 +25,7 @@ class SessionsService extends Service {
return user.data return user.data
} }
async set (id, data, { maxAge, rolling, changed }) { async set (id: string, data: any, { maxAge, rolling, changed }: SessionData) {
let session = await this.Session.findOne({ where: { id } }) let session = await this.Session.findOne({ where: { id } })
if (session === null) { if (session === null) {
session = this.Session.build({ id }) session = this.Session.build({ id })
@ -30,7 +39,7 @@ class SessionsService extends Service {
return session.save() return session.save()
} }
async destroy (id) { async destroy (id: string) {
const sess = await this.Session.findOne({ where: { id } }) const sess = await this.Session.findOne({ where: { id } })
if (sess != null) { if (sess != null) {
@ -38,5 +47,3 @@ class SessionsService extends Service {
} }
} }
} }
module.exports = SessionsService

8
util/areduce.js Normal file
View file

@ -0,0 +1,8 @@
// @flow
export default async function<T, V> (array: Array<T>, predicate: (Array<V>, T) => Promise<Array<V>>, acc: Array<V>): Promise<Array<V>> {
for (let i of array) {
acc = await predicate(acc, i)
}
return acc
}

2944
yarn.lock

File diff suppressed because it is too large Load diff