├── README.md ├── public ├── favicon.ico ├── manifest.json └── index.html ├── .vscode └── settings.json ├── .prettierrc ├── src ├── console │ ├── login.less │ ├── App.test.js │ ├── App.less │ ├── LoginPage.js │ ├── logo.svg │ └── index.js └── index.js ├── flow-typed └── npm │ ├── flow-bin_v0.x.x.js │ ├── js-cookie_v2.x.x.js │ ├── autobind-decorator_vx.x.x.js │ ├── react-app-rewire-less_vx.x.x.js │ ├── babel-plugin-import_vx.x.x.js │ ├── photon-ant_vx.x.x.js │ ├── redux-thunk_vx.x.x.js │ ├── redux-logger_vx.x.x.js │ ├── react-copy-to-clipboard_vx.x.x.js │ ├── localforage_v1.5.x.js │ ├── redux_v3.x.x.js │ ├── react-app-rewired_vx.x.x.js │ ├── react-router_v4.x.x.js │ ├── react-redux_v5.x.x.js │ ├── react-router-dom_v4.x.x.js │ ├── prettier_v1.x.x.js │ ├── react-scripts_vx.x.x.js │ └── underscore_v1.x.x.js ├── FlowStubModule.js ├── .flowconfig ├── .gitignore ├── config-overrides.js ├── .stylelintrc ├── package.json └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # delivery-console 2 | One admin to rule them all 3 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peterbe/delivery-console/master/public/favicon.ico -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.hover": false, 3 | "files.insertFinalNewline": true 4 | } 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "flow", 3 | "loglevel": "warn", 4 | "singleQuote": true, 5 | "trailingComma": "all", 6 | } 7 | -------------------------------------------------------------------------------- /src/console/login.less: -------------------------------------------------------------------------------- 1 | #login-page { 2 | .login-form { 3 | margin: 1em auto; 4 | max-width: 300px; 5 | } 6 | 7 | .login-form-button { 8 | width: 100%; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import DevConsoleApp from "./console"; 4 | 5 | ReactDOM.render(, document.getElementById("root")); 6 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 2 | // flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x 3 | 4 | declare module 'flow-bin' { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /FlowStubModule.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a stub file used by the Flow checker for filetypes we wish to ignore. 3 | * Essentially, this tells Flow that the module does not export anything, so 4 | * there is nothing for it to type check. 5 | */ 6 | module.exports = {}; 7 | -------------------------------------------------------------------------------- /src/console/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [include] 2 | /**/*.js 3 | 4 | [ignore] 5 | .*/node_modules/ 6 | .*/.git/ 7 | .*/.less$ 8 | 9 | [libs] 10 | 11 | [options] 12 | module.name_mapper.extension='less' -> '/FlowStubModule.js' 13 | module.name_mapper='^console\/\(.*\)$' -> '/console/\1' 14 | emoji=true 15 | 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Delivery Console", 3 | "name": "Delivery Console", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /src/console/App.less: -------------------------------------------------------------------------------- 1 | @import '~photon-ant'; 2 | 3 | .app { 4 | &.ant-layout { 5 | min-height: 100vh; 6 | } 7 | } 8 | 9 | .app-content { 10 | padding: 2em; 11 | } 12 | 13 | .app-header { 14 | align-items: center; 15 | display: flex; 16 | 17 | h1 { 18 | margin: 0 1em 0 0; 19 | } 20 | 21 | a { 22 | padding: 0 2em; 23 | 24 | &, 25 | &:focus, 26 | &:active { 27 | border-radius: 0; 28 | } 29 | 30 | &.active { 31 | background: @blue-60; 32 | color: @white; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /config-overrides.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const { injectBabelPlugin } = require("react-app-rewired"); 3 | const rewireLess = require("react-app-rewire-less"); 4 | 5 | module.exports = function(config, env) { 6 | config.resolve = { 7 | ...config.resolve, 8 | alias: { 9 | ...config.resolve.alias, 10 | console: path.resolve(__dirname, "./src/console/"), 11 | } 12 | }; 13 | 14 | // LESS support 15 | config = rewireLess(config, env); 16 | // Use Ant LESS imports 17 | config = injectBabelPlugin( 18 | ["import", { libraryName: "antd", style: true }], 19 | config 20 | ); 21 | 22 | return config; 23 | }; 24 | -------------------------------------------------------------------------------- /.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-standard", 3 | "plugins": [ 4 | "stylelint-order", 5 | ], 6 | "rules": { 7 | "color-hex-case": "upper", 8 | "max-empty-lines": 2, 9 | "order/order": [ 10 | { 11 | "type": "at-rule", 12 | "name": "import", 13 | }, { 14 | "type": "at-rule", 15 | "name": "include", 16 | }, { 17 | "type": "at-rule", 18 | "name": "extend", 19 | }, 20 | "custom-properties", 21 | "dollar-variables", 22 | "declarations", 23 | "rules", 24 | "at-rules", 25 | ], 26 | "order/properties-alphabetical-order": true, 27 | "unit-no-unknown": [true, { 28 | "ignoreUnits": ["/fr/"], 29 | }], 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /flow-typed/npm/js-cookie_v2.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 3ec9bf9b258f375a8abeff95acd8b2ad 2 | // flow-typed version: cd78efc61a/js-cookie_v2.x.x/flow_>=v0.38.x 3 | 4 | declare module 'js-cookie' { 5 | declare type CookieOptions = { 6 | expires?: number | Date, 7 | path?: string, 8 | domain?: string, 9 | secure?: boolean, 10 | }; 11 | declare type ConverterFunc = (value: string, name: string) => string; 12 | declare type ConverterObj = { 13 | read: ConverterFunc, 14 | write: ConverterFunc, 15 | }; 16 | declare class Cookie { 17 | defaults: CookieOptions; 18 | set(name: string, value: mixed, options?: CookieOptions): void; 19 | get(...args: Array): { [key: string]: string }; 20 | get(name: string, ...args: Array): string | void; 21 | remove(name: string, options?: CookieOptions): void; 22 | getJSON(name: string): mixed; 23 | withConverter(converter: ConverterFunc | ConverterObj): this; 24 | noConflict(): this; 25 | } 26 | 27 | declare module.exports: Cookie; 28 | } 29 | -------------------------------------------------------------------------------- /flow-typed/npm/autobind-decorator_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 97450e714cf503f678b9db6a6b45e98e 2 | // flow-typed version: <>/autobind-decorator_v^2.1.0/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'autobind-decorator' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'autobind-decorator' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'autobind-decorator/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'autobind-decorator/lib/index.js' { 31 | declare module.exports: $Exports<'autobind-decorator/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/react-app-rewire-less_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: e3ec5b610565c823759063c63e2eebd8 2 | // flow-typed version: <>/react-app-rewire-less_v^2.1.0/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-app-rewire-less' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-app-rewire-less' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | // Filename aliases 27 | declare module 'react-app-rewire-less/index' { 28 | declare module.exports: $Exports<'react-app-rewire-less'>; 29 | } 30 | declare module 'react-app-rewire-less/index.js' { 31 | declare module.exports: $Exports<'react-app-rewire-less'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-plugin-import_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ce66f1bf5948941ba33266d15e55703a 2 | // flow-typed version: <>/babel-plugin-import_v^1.6.5/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-plugin-import' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-plugin-import' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-plugin-import/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-plugin-import/lib/Plugin' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'babel-plugin-import/lib/index.js' { 35 | declare module.exports: $Exports<'babel-plugin-import/lib/index'>; 36 | } 37 | declare module 'babel-plugin-import/lib/Plugin.js' { 38 | declare module.exports: $Exports<'babel-plugin-import/lib/Plugin'>; 39 | } 40 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dev-console", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "antd": "^3.2.1", 7 | "autobind-decorator": "^2.1.0", 8 | "immutable": "^3.8.2", 9 | "js-cookie": "^2.2.0", 10 | "localforage": "^1.5.6", 11 | "photon-ant": "^0.1.4", 12 | "react": "^16.2.0", 13 | "react-copy-to-clipboard": "^5.0.1", 14 | "react-dom": "^16.2.0", 15 | "react-redux": "^5.0.7", 16 | "react-router": "^4.2.0", 17 | "react-router-dom": "^4.2.2", 18 | "react-scripts": "1.1.1", 19 | "redux": "^3.7.2", 20 | "redux-little-router": "^15.0.0", 21 | "redux-logger": "^3.0.6", 22 | "redux-thunk": "^2.2.0", 23 | "underscore": "^1.8.3" 24 | }, 25 | "scripts": { 26 | "start": "react-app-rewired start", 27 | "build": "react-app-rewired build", 28 | "test": "react-app-rewired test --env=jsdom", 29 | "eject": "react-scripts eject", 30 | "lint:flow": "flow", 31 | "lint:less": "stylelint 'src/**/*.less' --config .stylelintrc", 32 | "lint:prettier": "prettier src/**/*.js --write", 33 | "lint": "yarn run lint:flow && yarn run lint:prettier && yarn run lint:less" 34 | }, 35 | "devDependencies": { 36 | "babel-plugin-import": "^1.6.5", 37 | "flow-bin": "^0.66.0", 38 | "prettier": "^1.10.2", 39 | "react-app-rewire-less": "^2.1.0", 40 | "react-app-rewired": "^1.4.1", 41 | "stylelint": "^9.1.1", 42 | "stylelint-config-standard": "^18.1.0", 43 | "stylelint-order": "^0.8.1" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /flow-typed/npm/photon-ant_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 2331a4fea409c6ef8aa92c059de59ce8 2 | // flow-typed version: <>/photon-ant_v^0.1.4/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'photon-ant' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'photon-ant' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'photon-ant/icons/build-ant-overrides' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'photon-ant/icons/build-demo' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'photon-ant/icons/build-icons' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'photon-ant/icons/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'photon-ant/icons/build-ant-overrides.js' { 43 | declare module.exports: $Exports<'photon-ant/icons/build-ant-overrides'>; 44 | } 45 | declare module 'photon-ant/icons/build-demo.js' { 46 | declare module.exports: $Exports<'photon-ant/icons/build-demo'>; 47 | } 48 | declare module 'photon-ant/icons/build-icons.js' { 49 | declare module.exports: $Exports<'photon-ant/icons/build-icons'>; 50 | } 51 | declare module 'photon-ant/icons/index.js' { 52 | declare module.exports: $Exports<'photon-ant/icons/index'>; 53 | } 54 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | Delivery Console 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /flow-typed/npm/redux-thunk_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6d66322fcd005cac32bee606dc6ac879 2 | // flow-typed version: <>/redux-thunk_v^2.2.0/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'redux-thunk' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'redux-thunk' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'redux-thunk/dist/redux-thunk' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'redux-thunk/dist/redux-thunk.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'redux-thunk/es/index' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'redux-thunk/lib/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'redux-thunk/src/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'redux-thunk/dist/redux-thunk.js' { 47 | declare module.exports: $Exports<'redux-thunk/dist/redux-thunk'>; 48 | } 49 | declare module 'redux-thunk/dist/redux-thunk.min.js' { 50 | declare module.exports: $Exports<'redux-thunk/dist/redux-thunk.min'>; 51 | } 52 | declare module 'redux-thunk/es/index.js' { 53 | declare module.exports: $Exports<'redux-thunk/es/index'>; 54 | } 55 | declare module 'redux-thunk/lib/index.js' { 56 | declare module.exports: $Exports<'redux-thunk/lib/index'>; 57 | } 58 | declare module 'redux-thunk/src/index.js' { 59 | declare module.exports: $Exports<'redux-thunk/src/index'>; 60 | } 61 | -------------------------------------------------------------------------------- /flow-typed/npm/redux-logger_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 96611a138f08cfc70f7fd1e4d774d13e 2 | // flow-typed version: <>/redux-logger_v^3.0.6/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'redux-logger' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'redux-logger' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'redux-logger/dist/redux-logger' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'redux-logger/src/core' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'redux-logger/src/defaults' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'redux-logger/src/diff' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'redux-logger/src/helpers' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'redux-logger/src/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'redux-logger/dist/redux-logger.js' { 51 | declare module.exports: $Exports<'redux-logger/dist/redux-logger'>; 52 | } 53 | declare module 'redux-logger/src/core.js' { 54 | declare module.exports: $Exports<'redux-logger/src/core'>; 55 | } 56 | declare module 'redux-logger/src/defaults.js' { 57 | declare module.exports: $Exports<'redux-logger/src/defaults'>; 58 | } 59 | declare module 'redux-logger/src/diff.js' { 60 | declare module.exports: $Exports<'redux-logger/src/diff'>; 61 | } 62 | declare module 'redux-logger/src/helpers.js' { 63 | declare module.exports: $Exports<'redux-logger/src/helpers'>; 64 | } 65 | declare module 'redux-logger/src/index.js' { 66 | declare module.exports: $Exports<'redux-logger/src/index'>; 67 | } 68 | -------------------------------------------------------------------------------- /src/console/LoginPage.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | import React, { Component } from 'react'; 3 | import { withRouter } from 'react-router-dom'; 4 | import type { RouterHistory, Location } from 'react-router-dom'; 5 | 6 | import { Button, Form, Input, Icon } from 'antd'; 7 | import 'console/login.less'; 8 | 9 | const FormItem = Form.Item; 10 | 11 | type Props = { 12 | onAuth: Function, 13 | history: RouterHistory, 14 | location: Location, 15 | }; 16 | type State = {}; 17 | 18 | class LoginPage extends Component { 19 | state = {}; 20 | 21 | onSubmit = evt => { 22 | evt.preventDefault(); 23 | const form = evt.target; 24 | 25 | let data = {}; 26 | let i = form.length - 1; 27 | let input; 28 | while (i >= 0) { 29 | input = form[i]; 30 | if (input.name) { 31 | data[input.name] = input.value; 32 | } 33 | i -= 1; 34 | } 35 | 36 | this.props.onAuth( 37 | data.user, 38 | Math.random() 39 | .toString(36) 40 | .slice(2), 41 | ); 42 | 43 | // Route may have a `next` query param. If so, redirect to that page. 44 | let query = this.props.location.search || '/'; 45 | query = query.replace('?next=', ''); 46 | 47 | this.props.history.push(query); 48 | }; 49 | 50 | render() { 51 | return ( 52 |
53 |
54 | 55 |

Log In

56 |
57 | 58 | } 60 | placeholder="Username" 61 | name="user" 62 | /> 63 | 64 | 65 | 66 | } 68 | type="password" 69 | placeholder="Password" 70 | name="password" 71 | /> 72 | 73 | 74 | 75 | 82 | 83 |
84 |
85 | ); 86 | } 87 | } 88 | 89 | export default withRouter(LoginPage); 90 | -------------------------------------------------------------------------------- /flow-typed/npm/react-copy-to-clipboard_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6bfa180f7cbce9d81b8c67b74ff49403 2 | // flow-typed version: <>/react-copy-to-clipboard_v^5.0.1/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-copy-to-clipboard' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-copy-to-clipboard' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'react-copy-to-clipboard/build/react-copy-to-clipboard' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'react-copy-to-clipboard/build/react-copy-to-clipboard.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'react-copy-to-clipboard/lib/Component' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'react-copy-to-clipboard/lib/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'react-copy-to-clipboard/src/Component' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'react-copy-to-clipboard/src/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'react-copy-to-clipboard/build/react-copy-to-clipboard.js' { 51 | declare module.exports: $Exports< 52 | 'react-copy-to-clipboard/build/react-copy-to-clipboard', 53 | >; 54 | } 55 | declare module 'react-copy-to-clipboard/build/react-copy-to-clipboard.min.js' { 56 | declare module.exports: $Exports< 57 | 'react-copy-to-clipboard/build/react-copy-to-clipboard.min', 58 | >; 59 | } 60 | declare module 'react-copy-to-clipboard/lib/Component.js' { 61 | declare module.exports: $Exports<'react-copy-to-clipboard/lib/Component'>; 62 | } 63 | declare module 'react-copy-to-clipboard/lib/index.js' { 64 | declare module.exports: $Exports<'react-copy-to-clipboard/lib/index'>; 65 | } 66 | declare module 'react-copy-to-clipboard/src/Component.js' { 67 | declare module.exports: $Exports<'react-copy-to-clipboard/src/Component'>; 68 | } 69 | declare module 'react-copy-to-clipboard/src/index.js' { 70 | declare module.exports: $Exports<'react-copy-to-clipboard/src/index'>; 71 | } 72 | -------------------------------------------------------------------------------- /src/console/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flow-typed/npm/localforage_v1.5.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 37b164ad4c10b3c89887d1fd5b7ca096 2 | // flow-typed version: 9c854fa980/localforage_v1.5.x/flow_>=v0.25.x 3 | 4 | type PartialConfig = { 5 | driver?: string | Array, 6 | name?: string, 7 | size?: number, 8 | storeName?: string, 9 | version?: string, 10 | description?: string, 11 | }; 12 | 13 | type Driver = { 14 | _driver: string, 15 | _initStorage(config: PartialConfig): void, 16 | 17 | getItem( 18 | key: string, 19 | successCallback?: (err?: Error, value?: T) => mixed, 20 | ): ?Promise, 21 | setItem( 22 | key: string, 23 | value: T, 24 | successCallback?: (err?: Error, value?: T) => mixed, 25 | ): ?Promise, 26 | removeItem( 27 | key: string, 28 | successCallback?: (err?: Error) => mixed, 29 | ): ?Promise, 30 | clear(successCallback?: ?(numberOfKeys: number) => mixed): ?Promise, 31 | length(successCallback?: (numberOfKeys: number) => mixed): ?Promise, 32 | key( 33 | keyIndex: number, 34 | successCallback?: (keyName: string) => mixed, 35 | ): ?Promise, 36 | keys( 37 | successCallback?: (keyNames: Array) => mixed, 38 | ): ?Promise>, 39 | }; 40 | 41 | type localforageInstance = { 42 | INDEXEDDB: 'asyncStorage', 43 | WEBSQL: 'webSQLStorage', 44 | LOCALSTORAGE: 'localStorageWrapper', 45 | 46 | getItem( 47 | key: string, 48 | successCallback?: (err?: Error, value?: T) => mixed, 49 | ): Promise, 50 | setItem( 51 | key: string, 52 | value: T, 53 | successCallback?: (err?: Error, value?: T) => mixed, 54 | ): Promise, 55 | removeItem( 56 | key: string, 57 | successCallback?: (err?: Error) => mixed, 58 | ): Promise, 59 | clear(successCallback?: ?(numberOfKeys: number) => mixed): Promise, 60 | length(successCallback?: (numberOfKeys: number) => mixed): Promise, 61 | key( 62 | keyIndex: number, 63 | successCallback?: (keyName: string) => mixed, 64 | ): Promise, 65 | keys( 66 | successCallback?: (keyNames: Array) => mixed, 67 | ): Promise>, 68 | iterate( 69 | iteratorCallback: (value: T, key: string, iterationNumber: number) => mixed, 70 | successCallback?: (result: void | [string, T]) => mixed, 71 | ): Promise, 72 | setDriver(driverNames: string | Array): void, 73 | config(config?: PartialConfig): boolean | PartialConfig, 74 | defineDriver(driver: Driver): void, 75 | driver(): string, 76 | ready(): Promise, 77 | supports(driverName: string): boolean, 78 | createInstance(config?: PartialConfig): localforageInstance, 79 | dropInstance(config?: PartialConfig): Promise, 80 | }; 81 | 82 | declare module 'localforage' { 83 | declare module.exports: localforageInstance; 84 | } 85 | -------------------------------------------------------------------------------- /flow-typed/npm/redux_v3.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ec7daead5cb4fec5ab25fedbedef29e8 2 | // flow-typed version: 2c04631d20/redux_v3.x.x/flow_>=v0.55.x 3 | 4 | declare module 'redux' { 5 | /* 6 | 7 | S = State 8 | A = Action 9 | D = Dispatch 10 | 11 | */ 12 | 13 | declare export type DispatchAPI = (action: A) => A; 14 | declare export type Dispatch }> = DispatchAPI; 15 | 16 | declare export type MiddlewareAPI> = { 17 | dispatch: D, 18 | getState(): S, 19 | }; 20 | 21 | declare export type Store> = { 22 | // rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages) 23 | dispatch: D, 24 | getState(): S, 25 | subscribe(listener: () => void): () => void, 26 | replaceReducer(nextReducer: Reducer): void, 27 | }; 28 | 29 | declare export type Reducer = (state: S, action: A) => S; 30 | 31 | declare export type CombinedReducer = ( 32 | state: ($Shape & {}) | void, 33 | action: A, 34 | ) => S; 35 | 36 | declare export type Middleware> = ( 37 | api: MiddlewareAPI, 38 | ) => (next: D) => D; 39 | 40 | declare export type StoreCreator> = { 41 | (reducer: Reducer, enhancer?: StoreEnhancer): Store, 42 | ( 43 | reducer: Reducer, 44 | preloadedState: S, 45 | enhancer?: StoreEnhancer, 46 | ): Store, 47 | }; 48 | 49 | declare export type StoreEnhancer> = ( 50 | next: StoreCreator, 51 | ) => StoreCreator; 52 | 53 | declare export function createStore( 54 | reducer: Reducer, 55 | enhancer?: StoreEnhancer, 56 | ): Store; 57 | declare export function createStore( 58 | reducer: Reducer, 59 | preloadedState: S, 60 | enhancer?: StoreEnhancer, 61 | ): Store; 62 | 63 | declare export function applyMiddleware( 64 | ...middlewares: Array> 65 | ): StoreEnhancer; 66 | 67 | declare export type ActionCreator = (...args: Array) => A; 68 | declare export type ActionCreators = { 69 | [key: K]: ActionCreator, 70 | }; 71 | 72 | declare export function bindActionCreators< 73 | A, 74 | C: ActionCreator, 75 | D: DispatchAPI, 76 | >( 77 | actionCreator: C, 78 | dispatch: D, 79 | ): C; 80 | declare export function bindActionCreators< 81 | A, 82 | K, 83 | C: ActionCreators, 84 | D: DispatchAPI, 85 | >( 86 | actionCreators: C, 87 | dispatch: D, 88 | ): C; 89 | 90 | declare export function combineReducers( 91 | reducers: O, 92 | ): CombinedReducer<$ObjMap(r: Reducer) => S>, A>; 93 | 94 | declare export var compose: $Compose; 95 | } 96 | -------------------------------------------------------------------------------- /flow-typed/npm/react-app-rewired_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 9f7d25fd88d1032159d2b541b8f95d6c 2 | // flow-typed version: <>/react-app-rewired_v^1.4.1/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-app-rewired' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-app-rewired' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'react-app-rewired/bin/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'react-app-rewired/bin/jest' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'react-app-rewired/config-overrides' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'react-app-rewired/scripts/build' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'react-app-rewired/scripts/start' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'react-app-rewired/scripts/test' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'react-app-rewired/scripts/utils/babelTransform' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'react-app-rewired/scripts/utils/paths' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'react-app-rewired/scripts/utils/rewireJestConfig' { 58 | declare module.exports: any; 59 | } 60 | 61 | // Filename aliases 62 | declare module 'react-app-rewired/bin/index.js' { 63 | declare module.exports: $Exports<'react-app-rewired/bin/index'>; 64 | } 65 | declare module 'react-app-rewired/bin/jest.js' { 66 | declare module.exports: $Exports<'react-app-rewired/bin/jest'>; 67 | } 68 | declare module 'react-app-rewired/config-overrides.js' { 69 | declare module.exports: $Exports<'react-app-rewired/config-overrides'>; 70 | } 71 | declare module 'react-app-rewired/index' { 72 | declare module.exports: $Exports<'react-app-rewired'>; 73 | } 74 | declare module 'react-app-rewired/index.js' { 75 | declare module.exports: $Exports<'react-app-rewired'>; 76 | } 77 | declare module 'react-app-rewired/scripts/build.js' { 78 | declare module.exports: $Exports<'react-app-rewired/scripts/build'>; 79 | } 80 | declare module 'react-app-rewired/scripts/start.js' { 81 | declare module.exports: $Exports<'react-app-rewired/scripts/start'>; 82 | } 83 | declare module 'react-app-rewired/scripts/test.js' { 84 | declare module.exports: $Exports<'react-app-rewired/scripts/test'>; 85 | } 86 | declare module 'react-app-rewired/scripts/utils/babelTransform.js' { 87 | declare module.exports: $Exports< 88 | 'react-app-rewired/scripts/utils/babelTransform', 89 | >; 90 | } 91 | declare module 'react-app-rewired/scripts/utils/paths.js' { 92 | declare module.exports: $Exports<'react-app-rewired/scripts/utils/paths'>; 93 | } 94 | declare module 'react-app-rewired/scripts/utils/rewireJestConfig.js' { 95 | declare module.exports: $Exports< 96 | 'react-app-rewired/scripts/utils/rewireJestConfig', 97 | >; 98 | } 99 | -------------------------------------------------------------------------------- /src/console/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import React, { Component } from 'react'; 4 | 5 | import 'console/App.less'; 6 | 7 | import LoginPage from './LoginPage'; 8 | import { BrowserRouter, NavLink, Link, withRouter } from 'react-router-dom'; 9 | import { Route, Redirect } from 'react-router'; 10 | 11 | import { Alert, Button, Layout, Menu } from 'antd'; 12 | const { Header, Footer, Content } = Layout; 13 | 14 | const Homepage = props => ( 15 |
16 |

Welcome {props.authToken ? 'back' : 'home'}!

17 | {props.authToken ? ( 18 |

19 | Go to the Normandy page. 20 |

21 | ) : ( 22 |

23 | You are not logged in! Go to the login page. 24 |

25 | )} 26 |
27 | ); 28 | 29 | const MockNormandy = props => ( 30 |
Normandy with auth token {props.authToken}
31 | ); 32 | 33 | type AppProps = {}; 34 | type AppState = { 35 | authToken: ?string, 36 | username: ?string, 37 | }; 38 | 39 | class App extends Component { 40 | state = { 41 | authToken: null, 42 | username: null, 43 | }; 44 | 45 | onUserLogin = (username: string, authToken: string) => { 46 | this.setState({ 47 | username, 48 | authToken, 49 | }); 50 | }; 51 | 52 | render() { 53 | return ( 54 | 55 | 56 |
57 |

Delivery Console

58 | 59 | 60 | Home 61 | 62 | Login 63 | 64 | Normandy 65 | 66 | 67 | {this.state.username && ( 68 | 74 | )} 75 |
76 | 77 | {/* Homepage */} 78 | } 82 | /> 83 | 84 | {/* Login */} 85 | 89 | this.state.username ? ( 90 | 91 | ) : ( 92 | 93 | ) 94 | } 95 | /> 96 | 97 | {/* Normandy App */} 98 | 102 | this.state.username ? ( 103 | 104 | ) : ( 105 | 106 | ) 107 | } 108 | /> 109 | 110 |
111 |
112 | ); 113 | } 114 | } 115 | 116 | export default App; 117 | -------------------------------------------------------------------------------- /flow-typed/npm/react-router_v4.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1e6728f0a649edac3689d6e2db7487a7 2 | // flow-typed version: 01716df816/react-router_v4.x.x/flow_>=v0.53.x 3 | 4 | declare module 'react-router' { 5 | // NOTE: many of these are re-exported by react-router-dom and 6 | // react-router-native, so when making changes, please be sure to update those 7 | // as well. 8 | declare export type Location = { 9 | pathname: string, 10 | search: string, 11 | hash: string, 12 | state?: any, 13 | key?: string, 14 | }; 15 | 16 | declare export type LocationShape = { 17 | pathname?: string, 18 | search?: string, 19 | hash?: string, 20 | state?: any, 21 | }; 22 | 23 | declare export type HistoryAction = 'PUSH' | 'REPLACE' | 'POP'; 24 | 25 | declare export type RouterHistory = { 26 | length: number, 27 | location: Location, 28 | action: HistoryAction, 29 | listen( 30 | callback: (location: Location, action: HistoryAction) => void, 31 | ): () => void, 32 | push(path: string | LocationShape, state?: any): void, 33 | replace(path: string | LocationShape, state?: any): void, 34 | go(n: number): void, 35 | goBack(): void, 36 | goForward(): void, 37 | canGo?: (n: number) => boolean, 38 | block( 39 | callback: (location: Location, action: HistoryAction) => boolean, 40 | ): void, 41 | // createMemoryHistory 42 | index?: number, 43 | entries?: Array, 44 | }; 45 | 46 | declare export type Match = { 47 | params: { [key: string]: ?string }, 48 | isExact: boolean, 49 | path: string, 50 | url: string, 51 | }; 52 | 53 | declare export type ContextRouter = {| 54 | history: RouterHistory, 55 | location: Location, 56 | match: Match, 57 | |}; 58 | 59 | declare export type GetUserConfirmation = ( 60 | message: string, 61 | callback: (confirmed: boolean) => void, 62 | ) => void; 63 | 64 | declare type StaticRouterContext = { 65 | url?: string, 66 | }; 67 | 68 | declare export class StaticRouter extends React$Component<{ 69 | basename?: string, 70 | location?: string | Location, 71 | context: StaticRouterContext, 72 | children?: React$Node, 73 | }> {} 74 | 75 | declare export class MemoryRouter extends React$Component<{ 76 | initialEntries?: Array, 77 | initialIndex?: number, 78 | getUserConfirmation?: GetUserConfirmation, 79 | keyLength?: number, 80 | children?: React$Node, 81 | }> {} 82 | 83 | declare export class Router extends React$Component<{ 84 | history: RouterHistory, 85 | children?: React$Node, 86 | }> {} 87 | 88 | declare export class Prompt extends React$Component<{ 89 | message: string | ((location: Location) => string | true), 90 | when?: boolean, 91 | }> {} 92 | 93 | declare export class Redirect extends React$Component<{ 94 | to: string | LocationShape, 95 | push?: boolean, 96 | }> {} 97 | 98 | declare export class Route extends React$Component<{ 99 | component?: React$ComponentType<*>, 100 | render?: (router: ContextRouter) => React$Node, 101 | children?: React$ComponentType | React$Node, 102 | path?: string, 103 | exact?: boolean, 104 | strict?: boolean, 105 | }> {} 106 | 107 | declare export class Switch extends React$Component<{ 108 | children?: React$Node, 109 | }> {} 110 | 111 | declare export function withRouter

( 112 | Component: React$ComponentType<{| ...ContextRouter, ...P |}>, 113 | ): React$ComponentType

; 114 | 115 | declare type MatchPathOptions = { 116 | path?: string, 117 | exact?: boolean, 118 | strict?: boolean, 119 | sensitive?: boolean, 120 | }; 121 | declare export function matchPath( 122 | pathname: string, 123 | options?: MatchPathOptions | string, 124 | ): null | Match; 125 | } 126 | -------------------------------------------------------------------------------- /flow-typed/npm/react-redux_v5.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 59b0c4be0e1408f21e2446be96c79804 2 | // flow-typed version: 9092387fd2/react-redux_v5.x.x/flow_>=v0.54.x 3 | 4 | import type { Dispatch, Store } from 'redux'; 5 | 6 | declare module 'react-redux' { 7 | /* 8 | 9 | S = State 10 | A = Action 11 | OP = OwnProps 12 | SP = StateProps 13 | DP = DispatchProps 14 | 15 | */ 16 | 17 | declare type MapStateToProps = ( 18 | state: S, 19 | ownProps: OP, 20 | ) => ((state: S, ownProps: OP) => SP) | SP; 21 | 22 | declare type MapDispatchToProps = 23 | | ((dispatch: Dispatch, ownProps: OP) => DP) 24 | | DP; 25 | 26 | declare type MergeProps = ( 27 | stateProps: SP, 28 | dispatchProps: DP, 29 | ownProps: OP, 30 | ) => P; 31 | 32 | declare type Context = { store: Store<*, *> }; 33 | 34 | declare type ComponentWithDefaultProps = Class< 35 | React$Component, 36 | > & { defaultProps: DP }; 37 | 38 | declare class ConnectedComponentWithDefaultProps< 39 | OP, 40 | DP, 41 | CP, 42 | > extends React$Component { 43 | static defaultProps: DP; // <= workaround for https://github.com/facebook/flow/issues/4644 44 | static WrappedComponent: Class>; 45 | getWrappedInstance(): React$Component; 46 | props: OP; 47 | state: void; 48 | } 49 | 50 | declare class ConnectedComponent extends React$Component { 51 | static WrappedComponent: Class>; 52 | getWrappedInstance(): React$Component

; 53 | props: OP; 54 | state: void; 55 | } 56 | 57 | declare type ConnectedComponentWithDefaultPropsClass = Class< 58 | ConnectedComponentWithDefaultProps, 59 | >; 60 | 61 | declare type ConnectedComponentClass = Class< 62 | ConnectedComponent, 63 | >; 64 | 65 | declare type Connector = (( 66 | component: ComponentWithDefaultProps, 67 | ) => ConnectedComponentWithDefaultPropsClass) & 68 | ((component: React$ComponentType

) => ConnectedComponentClass); 69 | 70 | declare class Provider extends React$Component<{ 71 | store: Store, 72 | children?: any, 73 | }> {} 74 | 75 | declare function createProvider( 76 | storeKey?: string, 77 | subKey?: string, 78 | ): Provider<*, *>; 79 | 80 | declare type ConnectOptions = { 81 | pure?: boolean, 82 | withRef?: boolean, 83 | }; 84 | 85 | declare type Null = null | void; 86 | 87 | declare function connect( 88 | ...rest: Array // <= workaround for https://github.com/facebook/flow/issues/2360 89 | ): Connector } & OP>>; 90 | 91 | declare function connect( 92 | mapStateToProps: Null, 93 | mapDispatchToProps: Null, 94 | mergeProps: Null, 95 | options: ConnectOptions, 96 | ): Connector } & OP>>; 97 | 98 | declare function connect( 99 | mapStateToProps: MapStateToProps, 100 | mapDispatchToProps: Null, 101 | mergeProps: Null, 102 | options?: ConnectOptions, 103 | ): Connector } & OP>>; 104 | 105 | declare function connect( 106 | mapStateToProps: Null, 107 | mapDispatchToProps: MapDispatchToProps, 108 | mergeProps: Null, 109 | options?: ConnectOptions, 110 | ): Connector>; 111 | 112 | declare function connect( 113 | mapStateToProps: MapStateToProps, 114 | mapDispatchToProps: MapDispatchToProps, 115 | mergeProps: Null, 116 | options?: ConnectOptions, 117 | ): Connector>; 118 | 119 | declare function connect( 120 | mapStateToProps: MapStateToProps, 121 | mapDispatchToProps: Null, 122 | mergeProps: MergeProps, 123 | options?: ConnectOptions, 124 | ): Connector; 125 | 126 | declare function connect( 127 | mapStateToProps: MapStateToProps, 128 | mapDispatchToProps: MapDispatchToProps, 129 | mergeProps: MergeProps, 130 | options?: ConnectOptions, 131 | ): Connector; 132 | } 133 | -------------------------------------------------------------------------------- /flow-typed/npm/react-router-dom_v4.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 7ef7e99bfa7953a438470755d51dc345 2 | // flow-typed version: 107feb8c45/react-router-dom_v4.x.x/flow_>=v0.53.x 3 | 4 | declare module 'react-router-dom' { 5 | declare export class BrowserRouter extends React$Component<{ 6 | basename?: string, 7 | forceRefresh?: boolean, 8 | getUserConfirmation?: GetUserConfirmation, 9 | keyLength?: number, 10 | children?: React$Node, 11 | }> {} 12 | 13 | declare export class HashRouter extends React$Component<{ 14 | basename?: string, 15 | getUserConfirmation?: GetUserConfirmation, 16 | hashType?: 'slash' | 'noslash' | 'hashbang', 17 | children?: React$Node, 18 | }> {} 19 | 20 | declare export class Link extends React$Component<{ 21 | to: string | LocationShape, 22 | replace?: boolean, 23 | children?: React$Node, 24 | }> {} 25 | 26 | declare export class NavLink extends React$Component<{ 27 | to: string | LocationShape, 28 | activeClassName?: string, 29 | className?: string, 30 | activeStyle?: Object, 31 | style?: Object, 32 | isActive?: (match: Match, location: Location) => boolean, 33 | children?: React$Node, 34 | exact?: boolean, 35 | strict?: boolean, 36 | }> {} 37 | 38 | // NOTE: Below are duplicated from react-router. If updating these, please 39 | // update the react-router and react-router-native types as well. 40 | declare export type Location = { 41 | pathname: string, 42 | search: string, 43 | hash: string, 44 | state?: any, 45 | key?: string, 46 | }; 47 | 48 | declare export type LocationShape = { 49 | pathname?: string, 50 | search?: string, 51 | hash?: string, 52 | state?: any, 53 | }; 54 | 55 | declare export type HistoryAction = 'PUSH' | 'REPLACE' | 'POP'; 56 | 57 | declare export type RouterHistory = { 58 | length: number, 59 | location: Location, 60 | action: HistoryAction, 61 | listen( 62 | callback: (location: Location, action: HistoryAction) => void, 63 | ): () => void, 64 | push(path: string | LocationShape, state?: any): void, 65 | replace(path: string | LocationShape, state?: any): void, 66 | go(n: number): void, 67 | goBack(): void, 68 | goForward(): void, 69 | canGo?: (n: number) => boolean, 70 | block( 71 | callback: (location: Location, action: HistoryAction) => boolean, 72 | ): void, 73 | // createMemoryHistory 74 | index?: number, 75 | entries?: Array, 76 | }; 77 | 78 | declare export type Match = { 79 | params: { [key: string]: ?string }, 80 | isExact: boolean, 81 | path: string, 82 | url: string, 83 | }; 84 | 85 | declare export type ContextRouter = {| 86 | history: RouterHistory, 87 | location: Location, 88 | match: Match, 89 | |}; 90 | 91 | declare export type GetUserConfirmation = ( 92 | message: string, 93 | callback: (confirmed: boolean) => void, 94 | ) => void; 95 | 96 | declare type StaticRouterContext = { 97 | url?: string, 98 | }; 99 | 100 | declare export class StaticRouter extends React$Component<{ 101 | basename?: string, 102 | location?: string | Location, 103 | context: StaticRouterContext, 104 | children?: React$Node, 105 | }> {} 106 | 107 | declare export class MemoryRouter extends React$Component<{ 108 | initialEntries?: Array, 109 | initialIndex?: number, 110 | getUserConfirmation?: GetUserConfirmation, 111 | keyLength?: number, 112 | children?: React$Node, 113 | }> {} 114 | 115 | declare export class Router extends React$Component<{ 116 | history: RouterHistory, 117 | children?: React$Node, 118 | }> {} 119 | 120 | declare export class Prompt extends React$Component<{ 121 | message: string | ((location: Location) => string | boolean), 122 | when?: boolean, 123 | }> {} 124 | 125 | declare export class Redirect extends React$Component<{ 126 | to: string | LocationShape, 127 | push?: boolean, 128 | }> {} 129 | 130 | declare export class Route extends React$Component<{ 131 | component?: React$ComponentType<*>, 132 | render?: (router: ContextRouter) => React$Node, 133 | children?: React$ComponentType | React$Node, 134 | path?: string, 135 | exact?: boolean, 136 | strict?: boolean, 137 | }> {} 138 | 139 | declare export class Switch extends React$Component<{ 140 | children?: React$Node, 141 | }> {} 142 | 143 | declare export function withRouter

( 144 | Component: React$ComponentType<{| ...ContextRouter, ...P |}>, 145 | ): React$ComponentType

; 146 | 147 | declare type MatchPathOptions = { 148 | path?: string, 149 | exact?: boolean, 150 | sensitive?: boolean, 151 | strict?: boolean, 152 | }; 153 | 154 | declare export function matchPath( 155 | pathname: string, 156 | options?: MatchPathOptions | string, 157 | ): null | Match; 158 | } 159 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 4eed8da2dc730dc33e7710b465eaa44b 2 | // flow-typed version: cc7a557b34/prettier_v1.x.x/flow_>=v0.56.x 3 | 4 | declare module 'prettier' { 5 | declare type AST = Object; 6 | declare type Doc = Object; 7 | declare type FastPath = Object; 8 | 9 | declare type PrettierParserName = 10 | | 'babylon' 11 | | 'flow' 12 | | 'typescript' 13 | | 'postcss' 14 | | 'css' 15 | | 'less' 16 | | 'scss' 17 | | 'json' 18 | | 'graphql' 19 | | 'markdown' 20 | | 'vue'; 21 | 22 | declare type PrettierParser = { 23 | [name: PrettierParserName]: (text: string, options?: Object) => AST, 24 | }; 25 | 26 | declare type CustomParser = ( 27 | text: string, 28 | parsers: PrettierParser, 29 | options: Options, 30 | ) => AST; 31 | 32 | declare type Options = {| 33 | printWidth?: number, 34 | tabWidth?: number, 35 | useTabs?: boolean, 36 | semi?: boolean, 37 | singleQuote?: boolean, 38 | trailingComma?: 'none' | 'es5' | 'all', 39 | bracketSpacing?: boolean, 40 | jsxBracketSameLine?: boolean, 41 | arrowParens?: 'avoid' | 'always', 42 | rangeStart?: number, 43 | rangeEnd?: number, 44 | parser?: PrettierParserName | CustomParser, 45 | filepath?: string, 46 | requirePragma?: boolean, 47 | insertPragma?: boolean, 48 | proseWrap?: 'always' | 'never' | 'preserve', 49 | plugins?: Array, 50 | |}; 51 | 52 | declare type Plugin = { 53 | languages: SupportLanguage, 54 | parsers: { [parserName: string]: Parser }, 55 | printers: { [astFormat: string]: Printer }, 56 | }; 57 | 58 | declare type Parser = { 59 | parse: ( 60 | text: string, 61 | parsers: { [parserName: string]: Parser }, 62 | options: Object, 63 | ) => AST, 64 | astFormat: string, 65 | }; 66 | 67 | declare type Printer = { 68 | print: ( 69 | path: FastPath, 70 | options: Object, 71 | print: (path: FastPath) => Doc, 72 | ) => Doc, 73 | embed: ( 74 | path: FastPath, 75 | print: (path: FastPath) => Doc, 76 | textToDoc: (text: string, options: Object) => Doc, 77 | options: Object, 78 | ) => ?Doc, 79 | }; 80 | 81 | declare type CursorOptions = {| 82 | cursorOffset: number, 83 | printWidth?: $PropertyType, 84 | tabWidth?: $PropertyType, 85 | useTabs?: $PropertyType, 86 | semi?: $PropertyType, 87 | singleQuote?: $PropertyType, 88 | trailingComma?: $PropertyType, 89 | bracketSpacing?: $PropertyType, 90 | jsxBracketSameLine?: $PropertyType, 91 | arrowParens?: $PropertyType, 92 | parser?: $PropertyType, 93 | filepath?: $PropertyType, 94 | requirePragma?: $PropertyType, 95 | insertPragma?: $PropertyType, 96 | proseWrap?: $PropertyType, 97 | plugins?: $PropertyType, 98 | |}; 99 | 100 | declare type CursorResult = {| 101 | formatted: string, 102 | cursorOffset: number, 103 | |}; 104 | 105 | declare type ResolveConfigOptions = {| 106 | useCache?: boolean, 107 | config?: string, 108 | editorconfig?: boolean, 109 | |}; 110 | 111 | declare type SupportLanguage = { 112 | name: string, 113 | since: string, 114 | parsers: Array, 115 | group?: string, 116 | tmScope: string, 117 | aceMode: string, 118 | codemirrorMode: string, 119 | codemirrorMimeType: string, 120 | aliases?: Array, 121 | extensions: Array, 122 | filenames?: Array, 123 | linguistLanguageId: number, 124 | vscodeLanguageIds: Array, 125 | }; 126 | 127 | declare type SupportOption = {| 128 | since: string, 129 | type: 'int' | 'boolean' | 'choice' | 'path', 130 | deprecated?: string, 131 | redirect?: SupportOptionRedirect, 132 | description: string, 133 | oppositeDescription?: string, 134 | default: SupportOptionValue, 135 | range?: SupportOptionRange, 136 | choices?: SupportOptionChoice, 137 | |}; 138 | 139 | declare type SupportOptionRedirect = {| 140 | options: string, 141 | value: SupportOptionValue, 142 | |}; 143 | 144 | declare type SupportOptionRange = {| 145 | start: number, 146 | end: number, 147 | step: number, 148 | |}; 149 | 150 | declare type SupportOptionChoice = {| 151 | value: boolean | string, 152 | description?: string, 153 | since?: string, 154 | deprecated?: string, 155 | redirect?: SupportOptionValue, 156 | |}; 157 | 158 | declare type SupportOptionValue = number | boolean | string; 159 | 160 | declare type SupportInfo = {| 161 | languages: Array, 162 | options: Array, 163 | |}; 164 | 165 | declare type Prettier = {| 166 | format: (source: string, options?: Options) => string, 167 | check: (source: string, options?: Options) => boolean, 168 | formatWithCursor: (source: string, options: CursorOptions) => CursorResult, 169 | resolveConfig: { 170 | (filePath: string, options?: ResolveConfigOptions): Promise, 171 | sync(filePath: string, options?: ResolveConfigOptions): Promise, 172 | }, 173 | clearConfigCache: () => void, 174 | getSupportInfo: (version?: string) => SupportInfo, 175 | |}; 176 | 177 | declare export default Prettier 178 | } 179 | -------------------------------------------------------------------------------- /flow-typed/npm/react-scripts_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 4caa3e4bb940adde271db654dde62cd6 2 | // flow-typed version: <>/react-scripts_v1.1.1/flow_v0.66.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-scripts' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-scripts' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'react-scripts/bin/react-scripts' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'react-scripts/config/env' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'react-scripts/config/jest/babelTransform' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'react-scripts/config/jest/cssTransform' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'react-scripts/config/jest/fileTransform' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'react-scripts/config/paths' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'react-scripts/config/polyfills' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'react-scripts/config/webpack.config.dev' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'react-scripts/config/webpack.config.prod' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'react-scripts/config/webpackDevServer.config' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'react-scripts/scripts/build' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'react-scripts/scripts/eject' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'react-scripts/scripts/init' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'react-scripts/scripts/start' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'react-scripts/scripts/test' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'react-scripts/scripts/utils/createJestConfig' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'react-scripts/template/src/App' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'react-scripts/template/src/App.test' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'react-scripts/template/src/index' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'react-scripts/template/src/registerServiceWorker' { 102 | declare module.exports: any; 103 | } 104 | 105 | // Filename aliases 106 | declare module 'react-scripts/bin/react-scripts.js' { 107 | declare module.exports: $Exports<'react-scripts/bin/react-scripts'>; 108 | } 109 | declare module 'react-scripts/config/env.js' { 110 | declare module.exports: $Exports<'react-scripts/config/env'>; 111 | } 112 | declare module 'react-scripts/config/jest/babelTransform.js' { 113 | declare module.exports: $Exports<'react-scripts/config/jest/babelTransform'>; 114 | } 115 | declare module 'react-scripts/config/jest/cssTransform.js' { 116 | declare module.exports: $Exports<'react-scripts/config/jest/cssTransform'>; 117 | } 118 | declare module 'react-scripts/config/jest/fileTransform.js' { 119 | declare module.exports: $Exports<'react-scripts/config/jest/fileTransform'>; 120 | } 121 | declare module 'react-scripts/config/paths.js' { 122 | declare module.exports: $Exports<'react-scripts/config/paths'>; 123 | } 124 | declare module 'react-scripts/config/polyfills.js' { 125 | declare module.exports: $Exports<'react-scripts/config/polyfills'>; 126 | } 127 | declare module 'react-scripts/config/webpack.config.dev.js' { 128 | declare module.exports: $Exports<'react-scripts/config/webpack.config.dev'>; 129 | } 130 | declare module 'react-scripts/config/webpack.config.prod.js' { 131 | declare module.exports: $Exports<'react-scripts/config/webpack.config.prod'>; 132 | } 133 | declare module 'react-scripts/config/webpackDevServer.config.js' { 134 | declare module.exports: $Exports< 135 | 'react-scripts/config/webpackDevServer.config', 136 | >; 137 | } 138 | declare module 'react-scripts/scripts/build.js' { 139 | declare module.exports: $Exports<'react-scripts/scripts/build'>; 140 | } 141 | declare module 'react-scripts/scripts/eject.js' { 142 | declare module.exports: $Exports<'react-scripts/scripts/eject'>; 143 | } 144 | declare module 'react-scripts/scripts/init.js' { 145 | declare module.exports: $Exports<'react-scripts/scripts/init'>; 146 | } 147 | declare module 'react-scripts/scripts/start.js' { 148 | declare module.exports: $Exports<'react-scripts/scripts/start'>; 149 | } 150 | declare module 'react-scripts/scripts/test.js' { 151 | declare module.exports: $Exports<'react-scripts/scripts/test'>; 152 | } 153 | declare module 'react-scripts/scripts/utils/createJestConfig.js' { 154 | declare module.exports: $Exports< 155 | 'react-scripts/scripts/utils/createJestConfig', 156 | >; 157 | } 158 | declare module 'react-scripts/template/src/App.js' { 159 | declare module.exports: $Exports<'react-scripts/template/src/App'>; 160 | } 161 | declare module 'react-scripts/template/src/App.test.js' { 162 | declare module.exports: $Exports<'react-scripts/template/src/App.test'>; 163 | } 164 | declare module 'react-scripts/template/src/index.js' { 165 | declare module.exports: $Exports<'react-scripts/template/src/index'>; 166 | } 167 | declare module 'react-scripts/template/src/registerServiceWorker.js' { 168 | declare module.exports: $Exports< 169 | 'react-scripts/template/src/registerServiceWorker', 170 | >; 171 | } 172 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /flow-typed/npm/underscore_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d79d7a391b2d6131fadd6c8aea82781a 2 | // flow-typed version: d6519a5bfc/underscore_v1.x.x/flow_>=v0.50.x 3 | 4 | // @flow 5 | /* eslint-disable */ 6 | 7 | // type definitions for (some of) underscore 8 | 9 | type FnIteratee = (t: T, index: number, array: Array) => boolean; 10 | 11 | declare module 'underscore' { 12 | declare type UnaryFn = (a: A) => R; 13 | declare type Compose = (( 14 | fg: UnaryFn, 15 | ef: UnaryFn, 16 | de: UnaryFn, 17 | cd: UnaryFn, 18 | bc: UnaryFn, 19 | ab: UnaryFn, 20 | ...rest: Array 21 | ) => UnaryFn) & 22 | (( 23 | ef: UnaryFn, 24 | de: UnaryFn, 25 | cd: UnaryFn, 26 | bc: UnaryFn, 27 | ab: UnaryFn, 28 | ...rest: Array 29 | ) => UnaryFn) & 30 | (( 31 | de: UnaryFn, 32 | cd: UnaryFn, 33 | bc: UnaryFn, 34 | ab: UnaryFn, 35 | ...rest: Array 36 | ) => UnaryFn) & 37 | (( 38 | cd: UnaryFn, 39 | bc: UnaryFn, 40 | ab: UnaryFn, 41 | ...rest: Array 42 | ) => UnaryFn) & 43 | (( 44 | bc: UnaryFn, 45 | ab: UnaryFn, 46 | ...rest: Array 47 | ) => UnaryFn) & 48 | ((ab: UnaryFn, ...rest: Array) => UnaryFn); 49 | 50 | declare function $underscore$Extend(a: A, ...rest: Array): A; 51 | declare function $underscore$Extend( 52 | a: A, 53 | b: B, 54 | ...rest: Array 55 | ): A & B; 56 | declare function $underscore$Extend( 57 | a: A, 58 | b: B, 59 | c: C, 60 | ...rest: Array 61 | ): A & B & C; 62 | declare function $underscore$Extend( 63 | a: A, 64 | b: B, 65 | c: C, 66 | d: D, 67 | ...rest: Array 68 | ): A & B & C & D; 69 | declare function $underscore$Extend( 70 | a: A, 71 | b: B, 72 | c: C, 73 | d: D, 74 | e: E, 75 | ...rest: Array 76 | ): A & B & C & D & E; 77 | 78 | declare function $underscore$ExtendParameterized( 79 | ...rest: Array 80 | ): A; 81 | declare function $underscore$ExtendParameterized( 82 | b: B, 83 | ...rest: Array 84 | ): A & B; 85 | declare function $underscore$ExtendParameterized( 86 | b: B, 87 | c: C, 88 | ...rest: Array 89 | ): A & B & C; 90 | declare function $underscore$ExtendParameterized( 91 | b: B, 92 | c: C, 93 | d: D, 94 | ...rest: Array 95 | ): A & B & C & D; 96 | declare function $underscore$ExtendParameterized< 97 | A: {}, 98 | B: {}, 99 | C: {}, 100 | D: {}, 101 | E: {}, 102 | >( 103 | b: B, 104 | c: C, 105 | d: D, 106 | e: E, 107 | ...rest: Array 108 | ): A & B & C & D & E; 109 | 110 | declare var compose: Compose; 111 | 112 | // Handle underscore chainables things. 113 | declare class UnderscoreWrappedList { 114 | // Chain 115 | chain(): UnderscoreChainedList; 116 | 117 | // Handle Collections functions 118 | each(iteratee: (element: T, index?: number, list?: Array) => void): void; 119 | each(iteratee: (val: mixed, key: mixed, list?: Object) => void): void; 120 | map(iteratee: (value: T, index: number, list: Array) => U): Array; 121 | reduce( 122 | iteratee: (memo: Object, value: T, index: number) => U, 123 | init: Object, 124 | ): Object; 125 | reduce( 126 | iteratee: (memo: Array, value: T, index: number) => U, 127 | init: Array, 128 | ): Array; 129 | reduce(iteratee: (memo: U, value: T, index: number) => U, init: U): U; 130 | reduceRight( 131 | iteratee: (memo: Object, value: T, index: number) => U, 132 | init: Object, 133 | ): Object; 134 | reduceRight( 135 | iteratee: (memo: Array, value: T, index: number) => U, 136 | init: Array, 137 | ): Array; 138 | reduceRight( 139 | iteratee: (memo: U, value: T, index: number) => U, 140 | init: U, 141 | ): U; 142 | find(predicate: (value: T) => boolean): T; 143 | filter(predicate: (value: ?T) => boolean): Array; 144 | where(properties: Object): Array; 145 | findWhere(properties: $Shape): ?T; 146 | reject(predicate: (value: T) => boolean, context?: mixed): Array; 147 | every(predicate: (value: T) => boolean, context?: mixed): boolean; 148 | some(predicate: (value: T) => boolean, context?: mixed): boolean; 149 | contains(value: T, fromIndex?: number): boolean; 150 | invoke(methodName: string, ...args: Array): Array; 151 | pluck(propertyName: string): Array; 152 | max(iteratee?: (value: T) => number, context?: mixed): U; 153 | min(iteratee?: (value: T) => number, context?: mixed): U; 154 | sortBy(iteratee: (value: T) => number): Array; 155 | sortBy(iteratee: string): Array; 156 | // TODO: UnderscoreWrapTheseObjects 157 | groupBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; 158 | groupBy(iteratee: string, context?: mixed): { [key: any]: T }; 159 | indexBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; 160 | indexBy(iteratee: string, context?: mixed): { [key: any]: T }; 161 | countBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; 162 | shuffle(): Array; 163 | sample(n?: number): Array; 164 | toArray(): Array; 165 | size(): number; 166 | partition(predicate: (value: T) => boolean): Array>; 167 | 168 | // Handle Array function 169 | first(): T; 170 | first(n: number): Array; 171 | head(n?: number): Array; 172 | take(n?: number): Array; 173 | initial(n?: number): Array; 174 | last(n?: number): Array; 175 | rest(index?: number): Array; 176 | tail(index?: number): Array; 177 | drop(index?: number): Array; 178 | compact(): Array; 179 | flatten(shallow?: boolean): Array; 180 | without(...values: Array): Array; 181 | union(...arrays: Array): Array; 182 | intersection(...arrays: Array): Array; 183 | difference(...others: Array): Array; 184 | uniq(): Array; 185 | uniq(iteratee: FnIteratee): Array; 186 | uniq(isSorted: boolean, iteratee?: FnIteratee): Array; 187 | unique(): Array; 188 | unique(iteratee: FnIteratee): Array; 189 | unique(isSorted: boolean, iteratee?: FnIteratee): Array; 190 | zip(...arrays: Array): Array; 191 | unzip(): Array; 192 | object(values?: Array): Object; 193 | indexOf(value: T, isSorted?: boolean): number; 194 | lastIndexOf(value: T, iteratee?: Function, context?: mixed): number; 195 | sortedIndex(value: T, iteratee?: Function, context?: mixed): number; 196 | findIndex(predicate: (value: T) => boolean, context?: mixed): number; 197 | findLastIndex(predicate: (value: T) => boolean, context?: mixed): number; 198 | range(stop: number, step?: number): Array; 199 | range(): Array; 200 | 201 | // TODO _.propertyOf 202 | // TODO _.matcher, _.matches 203 | isEqual(b: Object): boolean; 204 | isMatch(b: Object): boolean; 205 | isEmpty(): boolean; 206 | isElement(): boolean; 207 | isArray(): boolean; 208 | isObject(): boolean; 209 | isArguments(): boolean; 210 | isFunction(): boolean; 211 | isString(): boolean; 212 | isNumber(): boolean; 213 | isFinite(): boolean; 214 | isBoolean(): boolean; 215 | isDate(): boolean; 216 | isRegExp(): boolean; 217 | isError(): boolean; 218 | isNaN(): boolean; 219 | isNull(): boolean; 220 | isUndefined(): boolean; 221 | } 222 | 223 | // Handle underscore chainables things. 224 | declare class UnderscoreChainedList { 225 | // End a Chain 226 | value(): Array; 227 | 228 | // Handle Collections functions 229 | each( 230 | iteratee: (element: T, index: number, list: Array) => void, 231 | ): Array; 232 | each(iteratee: (val: mixed, key: mixed, list: Object) => void): Object; 233 | map( 234 | iteratee: (value: T, index: number, list: Array) => U, 235 | ): UnderscoreChainedList; 236 | reduce( 237 | iteratee: (memo: Object, value: T, index: number) => U, 238 | init: Object, 239 | ): UnderscoreChainedValue; 240 | reduce( 241 | iteratee: (memo: Array, value: T, index: number) => U, 242 | init: Array, 243 | ): UnderscoreChainedList; 244 | reduce( 245 | iteratee: (memo: U, value: T, index: number) => U, 246 | init: U, 247 | ): UnderscoreChainedValue; 248 | reduceRight( 249 | iteratee: (memo: Object, value: T, index: number) => U, 250 | init: Object, 251 | ): UnderscoreChainedValue; 252 | reduceRight( 253 | iteratee: (memo: Array, value: T, index: number) => U, 254 | init: Array, 255 | ): UnderscoreChainedList; 256 | reduceRight( 257 | iteratee: (memo: U, value: T, index: number) => U, 258 | init: U, 259 | ): UnderscoreChainedValue; 260 | find(predicate: (value: T) => boolean): UnderscoreChainedValue; 261 | filter(predicate: (value: T) => boolean): UnderscoreChainedList; 262 | where(properties: Object): UnderscoreChainedList; 263 | findWhere(properties: $Shape): ?UnderscoreChainedValue; 264 | reject( 265 | predicate: (value: T) => boolean, 266 | context?: mixed, 267 | ): UnderscoreChainedList; 268 | every( 269 | predicate: (value: T) => boolean, 270 | context?: mixed, 271 | ): UnderscoreChainedValue; 272 | some( 273 | predicate: (value: T) => boolean, 274 | context?: mixed, 275 | ): UnderscoreChainedValue; 276 | contains(value: T, fromIndex?: number): UnderscoreChainedValue; 277 | invoke( 278 | methodName: string, 279 | ...args: Array 280 | ): UnderscoreChainedList; 281 | pluck(propertyName: string): UnderscoreChainedList; 282 | max( 283 | iteratee?: (value: T) => number, 284 | context?: mixed, 285 | ): UnderscoreChainedValue; 286 | min( 287 | iteratee?: (value: T) => number, 288 | context?: mixed, 289 | ): UnderscoreChainedValue; 290 | sortBy(iteratee: (value: T) => number): UnderscoreChainedList; 291 | sortBy(iteratee: string): UnderscoreChainedList; 292 | // TODO: UnderscoreWrapTheseObjects 293 | groupBy( 294 | iteratee: (value: T) => U, 295 | context?: mixed, 296 | ): UnderscoreChainedValue<{ [key: U]: T }>; 297 | groupBy( 298 | iteratee: string, 299 | context?: mixed, 300 | ): UnderscoreChainedValue<{ [key: any]: T }>; 301 | indexBy( 302 | iteratee: (value: T) => U, 303 | context?: mixed, 304 | ): UnderscoreChainedValue<{ [key: U]: T }>; 305 | indexBy( 306 | iteratee: string, 307 | context?: mixed, 308 | ): UnderscoreChainedValue<{ [key: any]: T }>; 309 | countBy( 310 | iteratee: (value: T) => U, 311 | context?: mixed, 312 | ): UnderscoreChainedValue<{ [key: U]: T }>; 313 | shuffle(): UnderscoreChainedList; 314 | sample(n?: number): UnderscoreChainedList; 315 | toArray(): UnderscoreChainedList; 316 | size(): UnderscoreChainedValue; 317 | partition( 318 | predicate: (value: T) => boolean, 319 | ): UnderscoreChainedList>; 320 | 321 | // Handle Array function 322 | first(n: number): UnderscoreChainedList; 323 | first(): UnderscoreChainedValue; 324 | head(n?: number): UnderscoreChainedList; 325 | take(n?: number): UnderscoreChainedList; 326 | initial(n?: number): UnderscoreChainedList; 327 | last(n?: number): UnderscoreChainedList; 328 | rest(index?: number): UnderscoreChainedList; 329 | tail(index?: number): UnderscoreChainedList; 330 | drop(index?: number): UnderscoreChainedList; 331 | compact(): UnderscoreChainedList; 332 | flatten(shallow?: boolean): UnderscoreChainedList; 333 | without(...values: Array): UnderscoreChainedList; 334 | union(...arrays: Array): UnderscoreChainedList; 335 | intersection(...arrays: Array): UnderscoreChainedList; 336 | difference(...others: Array): UnderscoreChainedList; 337 | uniq(): UnderscoreChainedList; 338 | uniq(iteratee: FnIteratee): UnderscoreChainedList; 339 | uniq(isSorted: boolean, iteratee?: FnIteratee): UnderscoreChainedList; 340 | unique(): UnderscoreChainedList; 341 | unique(iteratee: FnIteratee): UnderscoreChainedList; 342 | unique( 343 | isSorted: boolean, 344 | iteratee?: FnIteratee, 345 | ): UnderscoreChainedList; 346 | zip(...arrays: Array): UnderscoreChainedList; 347 | unzip(): UnderscoreChainedList; 348 | object(values?: Array): UnderscoreChainedValue; 349 | indexOf(value: T, isSorted?: boolean): UnderscoreChainedValue; 350 | lastIndexOf( 351 | value: T, 352 | iteratee?: Function, 353 | context?: mixed, 354 | ): UnderscoreChainedValue; 355 | sortedIndex( 356 | value: T, 357 | iteratee?: Function, 358 | context?: mixed, 359 | ): UnderscoreChainedValue; 360 | findIndex( 361 | predicate: (value: T) => boolean, 362 | context?: mixed, 363 | ): UnderscoreChainedValue; 364 | findLastIndex( 365 | predicate: (value: T) => boolean, 366 | context?: mixed, 367 | ): UnderscoreChainedValue; 368 | range(stop: number, step?: number): UnderscoreChainedList; 369 | range(): UnderscoreChainedList; 370 | 371 | isEqual(b: Object): UnderscoreChainedValue; 372 | isMatch(b: Object): UnderscoreChainedValue; 373 | isEmpty(): UnderscoreChainedValue; 374 | isElement(): UnderscoreChainedValue; 375 | isArray(): UnderscoreChainedValue; 376 | isObject(): UnderscoreChainedValue; 377 | isArguments(): UnderscoreChainedValue; 378 | isFunction(): UnderscoreChainedValue; 379 | isString(): UnderscoreChainedValue; 380 | isNumber(): UnderscoreChainedValue; 381 | isFinite(): UnderscoreChainedValue; 382 | isBoolean(): UnderscoreChainedValue; 383 | isDate(): UnderscoreChainedValue; 384 | isRegExp(): UnderscoreChainedValue; 385 | isError(): UnderscoreChainedValue; 386 | isNaN(): UnderscoreChainedValue; 387 | isNull(): UnderscoreChainedValue; 388 | isUndefined(): UnderscoreChainedValue; 389 | } 390 | 391 | declare class UnderscoreChainedValue { 392 | value(): T; 393 | } 394 | 395 | declare class UnderscoreWrappedValue { 396 | chain(): UnderscoreChainedValue; 397 | 398 | escape(): string; 399 | // TODO: Probably move this to UnderscoreWrappedNumber or something 400 | range(): Array; 401 | isEmpty(): boolean; 402 | } 403 | 404 | // Handle regular things. 405 | declare class UnderscoreList { 406 | // Handle chaining 407 | chain(a: Array): UnderscoreChainedList; 408 | chain(v: T): UnderscoreChainedValue; 409 | 410 | // Handle Collections functions 411 | 412 | each( 413 | o: { [key: string]: T }, 414 | iteratee: (val: T, key: string) => void, 415 | ): void; 416 | each(a: T[], iteratee: (val: T, key: string) => void): void; 417 | each( 418 | list: Object, 419 | iteratee: (val: mixed, key: mixed, list: Object) => void, 420 | ): void; 421 | forEach( 422 | o: { [key: string]: T }, 423 | iteratee: (val: T, key: string) => void, 424 | ): void; 425 | forEach(a: T[], iteratee: (val: T, key: string) => void): void; 426 | 427 | map(a: T[], iteratee: (val: T, n: number) => U): U[]; 428 | map(a: { [key: K]: T }, iteratee: (val: T, k: K) => U): U[]; 429 | collect(a: T[], iteratee: (val: T, n: number) => U): U[]; 430 | collect(a: { [key: K]: T }, iteratee: (val: T, k: K) => U): U[]; 431 | 432 | reduce( 433 | a: Array, 434 | iterator: (m: MemoT, o: T) => MemoT, 435 | initialMemo?: MemoT, 436 | ): MemoT; 437 | inject( 438 | a: Array, 439 | iterator: (m: MemoT, o: T) => MemoT, 440 | initialMemo?: MemoT, 441 | ): MemoT; 442 | foldl( 443 | a: Array, 444 | iterator: (m: MemoT, o: T) => MemoT, 445 | initialMemo?: MemoT, 446 | ): MemoT; 447 | 448 | reduceRight( 449 | a: Array, 450 | iterator: (m: MemoT, o: T) => MemoT, 451 | initialMemo?: MemoT, 452 | ): MemoT; 453 | foldr( 454 | a: Array, 455 | iterator: (m: MemoT, o: T) => MemoT, 456 | initialMemo?: MemoT, 457 | ): MemoT; 458 | 459 | find(list: T[], predicate: (val: T) => boolean): ?T; 460 | detect(list: T[], predicate: (val: T) => boolean): ?T; 461 | 462 | filter( 463 | o: { [key: string]: T }, 464 | pred: (val: T, k: string, o: { [string]: T }) => boolean, 465 | ): T[]; 466 | filter(a: T[], pred: (val: T, k: number, a: T[]) => boolean): T[]; 467 | filter(o: { [string]: T }[], pred: { [string]: T }): T[]; 468 | select( 469 | o: { [key: string]: T }, 470 | pred: (val: T, k: string, o: { [string]: T }) => boolean, 471 | ): T[]; 472 | select(a: T[], pred: (val: T, k: number, a: T[]) => boolean): T[]; 473 | select(o: { [string]: T }[], pred: { [string]: T }): T[]; 474 | where(list: Array, properties: Object): Array; 475 | findWhere(list: Array, properties: { [key: string]: any }): ?T; 476 | 477 | reject( 478 | o: { [key: string]: T }, 479 | pred: (val: T, k: string) => boolean, 480 | ): T[]; 481 | reject(a: T[], pred: (val: T, k: string) => boolean): T[]; 482 | 483 | every(a: Array, pred?: (val: T) => boolean): boolean; 484 | all(a: Array, pred?: (val: T) => boolean): boolean; 485 | 486 | some(a: Array, pred?: (val: T) => boolean): boolean; 487 | any(a: Array, pred?: (val: T) => boolean): boolean; 488 | 489 | contains(list: T[], val: T, fromIndex?: number): boolean; 490 | includes(list: T[], val: T, fromIndex?: number): boolean; 491 | 492 | invoke(list: Array, methodName: string, ...args?: Array): any; 493 | 494 | pluck(a: Array, propertyName: string): Array; 495 | 496 | max(a: Array | { [key: any]: T }): T; 497 | min(a: Array | { [key: any]: T }): T; 498 | 499 | sortBy(a: T[], property: any): T[]; 500 | sortBy(a: T[], iteratee: (val: T) => any): T[]; 501 | groupBy( 502 | a: Array, 503 | iteratee: string | ((val: T, index: number) => any), 504 | ): { [key: string]: T[] }; 505 | indexBy( 506 | a: Array, 507 | iteratee: string | ((val: T, index: number) => any), 508 | ): { [key: string]: T[] }; 509 | countBy( 510 | a: Array, 511 | iteratee: (val: T, index: number) => any, 512 | ): { [key: string]: T[] }; 513 | shuffle(list: ?Array): Array; 514 | sample(a: T[]): T; 515 | 516 | toArray(a: Iterable | { [key: any]: T }): Array; 517 | 518 | size(o: Object): number; 519 | size(o: Array): number; 520 | 521 | partition( 522 | o: { [key: string]: T }, 523 | pred: (val: T, k: string) => boolean, 524 | ): [T[], T[]]; 525 | partition(o: Array, pred: (val: T) => boolean): [T[], T[]]; 526 | 527 | // Handle Array function 528 | 529 | first(a: Array, n: number): Array; 530 | first(a: Array): T; 531 | head(a: Array, n: number): Array; 532 | head(a: Array): T; 533 | take(a: Array, n: number): Array; 534 | take(a: Array): T; 535 | 536 | initial(a: Array, n?: number): Array; 537 | 538 | last(a: Array, n: number): Array; 539 | last(a: Array): T; 540 | 541 | rest(a: Array, index?: number): Array; 542 | tail(a: Array, index?: number): Array; 543 | drop(a: Array, index?: number): Array; 544 | 545 | compact(a: Array): T[]; 546 | 547 | flatten(a: S[][]): S[]; 548 | 549 | without(a: T[], ...values: T[]): T[]; 550 | 551 | union(...arrays: Array>): Array; 552 | intersection(...arrays: Array>): Array; 553 | 554 | difference(array: Array, ...others: Array>): Array; 555 | 556 | uniq(a: T[]): T[]; 557 | uniq(list: Array, iteratee: Function): Array; 558 | uniq(list: Array, isSorted: boolean, iteratee?: Function): Array; 559 | unique(a: T[]): T[]; 560 | unique(list: Array, iteratee: Function): Array; 561 | unique(list: Array, isSorted: boolean, iteratee?: Function): Array; 562 | 563 | zip(a1: S[], a2: T[]): Array<[S, T]>; 564 | unzip(array: Array>): Array>; 565 | 566 | object(a: Array<[string, T]>): { [key: string]: T }; 567 | object(list: Array, values?: Array): { [key: string]: T }; 568 | 569 | indexOf(list: T[], val: T, isSorted?: boolean): number; 570 | lastIndexOf(array: Array, value: T, fromIndex?: number): number; 571 | sortedIndex( 572 | list: Array, 573 | value: T, 574 | iteratee?: (value: T) => mixed, 575 | context?: any, 576 | ): number; 577 | findIndex(list: T[], predicate: (val: T) => boolean): number; 578 | findLastIndex(array: Array, predicate: any, context?: any): number; 579 | range(a: number, b: number): Array; 580 | 581 | isEqual(object: Object, b: Object): boolean; 582 | isMatch(object: Object, b: Object): boolean; 583 | isEmpty(object: Object): boolean; 584 | isElement(object: any): boolean; 585 | isArray(value: any): boolean; 586 | isObject(value: any): boolean; 587 | isArguments(object: any): boolean; 588 | isFunction(object: any): boolean; 589 | isString(object: any): boolean; 590 | isNumber(object: any): boolean; 591 | isFinite(object: any): boolean; 592 | isBoolean(object: any): boolean; 593 | isDate(object: any): boolean; 594 | isRegExp(object: any): boolean; 595 | isError(object: any): boolean; 596 | isNaN(object: any): boolean; 597 | isNull(object: any): boolean; 598 | isUndefined(object: any): boolean; 599 | } 600 | 601 | declare class UnderscoreFunctions { 602 | bind(func: Function, object: Object, ...arguments: Array): Function; 603 | bindAll(object: ?Object, ...methodNames: Array): Object; 604 | partial(func: Function, ...arguments: Array): Function; 605 | memoize(func: Function, hashFunction?: Function): Function; 606 | delay(func: Function, wait: number, ...arguments: Array): void; 607 | defer(func: Function, ...arguments: Array): void; 608 | throttle( 609 | func: Function, 610 | wait: number, 611 | options?: { leading: boolean, trailing: boolean }, 612 | ): Function; 613 | debounce(func: Function, wait: number, immediate?: boolean): Function; 614 | once(func: Function): Function; 615 | after(count: number, func: Function): Function; 616 | before(count: number, func: Function): Function; 617 | wrap(func: Function, wrapper: Function): Function; 618 | negate(predicate: (...args: any) => boolean): Function; 619 | compose: Compose; 620 | 621 | isEqual(object: any, b: any): boolean; 622 | isMatch(object: Object, b: Object): boolean; 623 | isEmpty(object: Object): boolean; 624 | isElement(object: Object): boolean; 625 | isArray(value: any): boolean; 626 | isObject(value: any): boolean; 627 | isArguments(object: any): boolean; 628 | isFunction(object: any): boolean; 629 | isString(object: any): boolean; 630 | isNumber(object: any): boolean; 631 | isFinite(object: any): boolean; 632 | isBoolean(object: any): boolean; 633 | isDate(object: any): boolean; 634 | isRegExp(object: any): boolean; 635 | isError(object: any): boolean; 636 | isNaN(object: any): boolean; 637 | isNull(object: any): boolean; 638 | isUndefined(object: any): boolean; 639 | } 640 | 641 | declare class UnderscoreObject { 642 | keys(object: { [keys: K]: V }): Array; 643 | allKeys(object: { [keys: K]: V }): Array; 644 | values(object: { [keys: K]: V }): Array; 645 | mapObject( 646 | object: Object, 647 | iteratee: (val: any, key: string) => Object, 648 | context?: mixed, 649 | ): Object; 650 | pairs(object: { [keys: K]: V }): Array<[K, V]>; 651 | invert(object: { [keys: K]: V }): { [keys: V]: K }; 652 | // TODO: _.create 653 | functions(object: Object): Array; 654 | findKey( 655 | object: { [keys: K]: V }, 656 | predicate: (V, K, { [keys: K]: V }) => boolean, 657 | context?: mixed, 658 | ): ?string; 659 | extend: typeof $underscore$Extend; 660 | extendOwn: typeof $underscore$Extend; 661 | pick(object: { [keys: K]: V }, predicate?: K): { [keys: K]: V }; 662 | omit(object: { [keys: K]: V }, predicate?: K): { [keys: K]: V }; 663 | defaults(defaults: ?Object, ...mores?: Array): Object; 664 | clone(object: O): O; 665 | tap(object: O): O; 666 | has(object: Object, key: string): boolean; 667 | property(key: K): (obj: { [key: K]: V }) => V; 668 | // TODO _.propertyOf 669 | // TODO _.matcher, _.matches 670 | isEqual(object: Object, b: Object): boolean; 671 | isMatch(object: Object, b: Object): boolean; 672 | isEmpty(object: Object): boolean; 673 | isElement(object: any): boolean; 674 | isArray(value: any): boolean; 675 | isObject(value: any): boolean; 676 | isArguments(object: any): boolean; 677 | isFunction(object: any): boolean; 678 | isString(object: any): boolean; 679 | isNumber(object: any): boolean; 680 | isFinite(object: any): boolean; 681 | isBoolean(object: any): boolean; 682 | isDate(object: any): boolean; 683 | isRegExp(object: any): boolean; 684 | isError(object: any): boolean; 685 | isNaN(object: any): boolean; 686 | isNull(object: any): boolean; 687 | isUndefined(object: any): boolean; 688 | } 689 | 690 | declare class UnderscoreChainedObject { 691 | value(): WrappedObj; 692 | keys(): UnderscoreChainedList<$Keys>; 693 | allKeys(): UnderscoreChainedList<$Keys>; 694 | // This call necessarily loses precision since we treat chained lists generics of a single type. 695 | values(): UnderscoreChainedList; 696 | 697 | mapObject(v: V) => Ret>>( 698 | iteratee: Function, 699 | context?: mixed, 700 | ): UnderscoreChainedObject; 701 | map( 702 | mapFn: (v: any, k: $Keys, obj: WrappedObj) => T, 703 | ): UnderscoreChainedList; 704 | pairs(): UnderscoreChainedList<[any, any]>; 705 | invert(): UnderscoreChainedObject; 706 | // TODO: _.create 707 | functions(): UnderscoreChainedList; 708 | findKey( 709 | predicate: ( 710 | $Values, 711 | $Keys, 712 | WrappedObj, 713 | ) => boolean, 714 | context?: mixed, 715 | ): UnderscoreChainedValue>; 716 | // TODO: Reimplement these when you can get them to return UnderscoreChainedObject 717 | // extend: ExtendParameterized<{[key: K]: V}>; 718 | // extendOwn: ExtendParameterized<{[key: K]: V}>>; 719 | pick( 720 | ...rest: Array> 721 | ): UnderscoreChainedObject; 722 | pick( 723 | predicate: (v: any, k: any, object: WrappedObj) => boolean, 724 | ): UnderscoreChainedObject; 725 | omit( 726 | ...rest: Array> 727 | ): UnderscoreChainedObject; 728 | omit( 729 | predicate: (v: any, k: any, object: WrappedObj) => boolean, 730 | ): UnderscoreChainedObject; 731 | defaults(more: $Shape): UnderscoreChainedObject; 732 | clone(): UnderscoreChainedObject; 733 | tap(): UnderscoreChainedObject; 734 | has(key: string): UnderscoreChainedValue; 735 | // TODO _.propertyOf 736 | // TODO _.matcher, _.matches 737 | isEqual(b: Object): UnderscoreChainedValue; 738 | isMatch(b: Object): UnderscoreChainedValue; 739 | isEmpty(): UnderscoreChainedValue; 740 | isElement(): UnderscoreChainedValue; 741 | isArray(): UnderscoreChainedValue; 742 | isObject(): UnderscoreChainedValue; 743 | isArguments(): UnderscoreChainedValue; 744 | isFunction(): UnderscoreChainedValue; 745 | isString(): UnderscoreChainedValue; 746 | isNumber(): UnderscoreChainedValue; 747 | isFinite(): UnderscoreChainedValue; 748 | isBoolean(): UnderscoreChainedValue; 749 | isDate(): UnderscoreChainedValue; 750 | isRegExp(): UnderscoreChainedValue; 751 | isError(): UnderscoreChainedValue; 752 | isNaN(): UnderscoreChainedValue; 753 | isNull(): UnderscoreChainedValue; 754 | isUndefined(): UnderscoreChainedValue; 755 | } 756 | 757 | declare class UnderscoreWrappedObject { 758 | chain(): UnderscoreChainedObject; 759 | 760 | map(fn: (v: any, k: $Keys) => R): Array; 761 | filter(fn: (v: any, k: $Keys, obj: any) => boolean): Array; 762 | keys(): Array<$Keys>; 763 | allKeys(): Array<$Keys>; 764 | values(): Array; 765 | mapObject(v: V) => Ret>>( 766 | iteratee: Function, 767 | context?: mixed, 768 | ): NewObj; 769 | pairs(): Array<[K, V]>; 770 | invert(): { [keys: V]: K }; 771 | // TODO: _.create 772 | functions(): Array; 773 | find( 774 | predicate: (v: any, k: $Keys, obj: WrappedObj) => boolean, 775 | ): ?any; 776 | findKey( 777 | predicate: ( 778 | $Values, 779 | $Keys, 780 | WrappedObj, 781 | ) => boolean, 782 | context?: mixed, 783 | ): ?$Keys; 784 | extend: typeof $underscore$ExtendParameterized; 785 | extendOwn: typeof $underscore$ExtendParameterized; 786 | // TODO make these actually remove properties 787 | pick(...rest: Array>): WrappedObj; 788 | pick( 789 | predicate: (v: any, k: $Keys, object: WrappedObj) => boolean, 790 | ): WrappedObj; 791 | omit(...rest: Array>): WrappedObj; 792 | omit( 793 | predicate: (v: any, k: $Keys, object: WrappedObj) => boolean, 794 | ): WrappedObj; 795 | defaults(more: $Shape): WrappedObj; 796 | clone(): WrappedObj; 797 | tap(): WrappedObj; 798 | has(key: string): boolean; 799 | // TODO _.propertyOf 800 | // TODO _.matcher, _.matches 801 | isEqual(b: Object): boolean; 802 | isMatch(b: Object): boolean; 803 | isEmpty(): boolean; 804 | isElement(): boolean; 805 | isArray(): boolean; 806 | isObject(): boolean; 807 | isArguments(): boolean; 808 | isFunction(): boolean; 809 | isString(): boolean; 810 | isNumber(): boolean; 811 | isFinite(): boolean; 812 | isBoolean(): boolean; 813 | isDate(): boolean; 814 | isRegExp(): boolean; 815 | isError(): boolean; 816 | isNaN(): boolean; 817 | isNull(): boolean; 818 | isUndefined(): boolean; 819 | } 820 | 821 | declare class UnderscoreUtility { 822 | noConflict(): Underscore; 823 | identity(value: U): U; 824 | constant(value: U): () => U; 825 | noop(): void; 826 | times(n: number, iteratee: Function, context?: mixed): void; 827 | random(min: number, max: number): number; 828 | // TODO: Is this right? 829 | mixin(object: Object): Underscore & Object; 830 | // TODO: _.iteratee 831 | uniqueId(prefix?: string): string; 832 | escape(string: string): string; 833 | unescape(string: string): string; 834 | // TODO: _.result 835 | now(): number; 836 | template( 837 | templateText: string, 838 | ): (values: { [key: string]: string }) => string; 839 | } 840 | 841 | declare class UnderscoreWrappedList { 842 | chain(): UnderscoreChainedList; 843 | 844 | // Handle Collections functions 845 | each( 846 | iteratee: (element: T, index: number, list: Array) => void, 847 | ): Array; 848 | each(iteratee: (val: mixed, key: mixed, list: Object) => void): Object; 849 | map(iteratee: (value: T, index: number, list: Array) => U): Array; 850 | reduce( 851 | iteratee: (memo: Object, value: T, index?: number) => U, 852 | init: Object, 853 | ): Object; 854 | reduce( 855 | iteratee: (memo: Array, value: T, index?: number) => U, 856 | init: Array, 857 | ): Array; 858 | reduce(iteratee: (memo: U, value: T, index?: number) => U, init: U): U; 859 | reduceRight( 860 | iteratee: (memo: Object, value: T, index?: number) => U, 861 | init: Object, 862 | ): U; 863 | reduceRight( 864 | iteratee: (memo: Array, value: T, index?: number) => U, 865 | init: Array, 866 | ): Array; 867 | reduceRight( 868 | iteratee: (memo: U, value: T, index?: number) => U, 869 | init: U, 870 | ): U; 871 | find(predicate: (value: T) => boolean): ?T; 872 | filter(predicate: (value: T) => boolean): Array; 873 | filter(predicate: { [string]: T }): Array; 874 | where(properties: Object): Array; 875 | findWhere(properties: $Shape): ?T; 876 | reject(predicate: (value: T) => boolean, context?: mixed): Array; 877 | every(predicate: (value: T) => boolean, context?: mixed): boolean; 878 | some(predicate: (value: T) => boolean, context?: mixed): boolean; 879 | contains(value: T, fromIndex?: number): boolean; 880 | invoke(methodName: string, ...args: Array): Array; 881 | pluck(propertyName: string): Array; 882 | max(iteratee?: (value: T) => number, context?: mixed): U; 883 | min(iteratee?: (value: T) => number, context?: mixed): U; 884 | sortBy(iteratee: (value: T) => number): Array; 885 | sortBy(iteratee: string): Array; 886 | // TODO: UnderscoreWrapTheseObjects 887 | groupBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; 888 | groupBy(iteratee: string, context?: mixed): { [key: any]: T }; 889 | indexBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; 890 | indexBy(iteratee: string, context?: mixed): { [key: any]: T }; 891 | countBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; 892 | shuffle(): Array; 893 | sample(n?: number): Array; 894 | toArray(): Array; 895 | size(): number; 896 | partition(predicate: (value: T) => boolean): Array>; 897 | 898 | // Handle Array function 899 | first(): T; 900 | first(n: number): Array; 901 | head(n?: number): Array; 902 | take(n?: number): Array; 903 | initial(n?: number): Array; 904 | last(n?: number): Array; 905 | rest(index?: number): Array; 906 | tail(index?: number): Array; 907 | drop(index?: number): Array; 908 | compact(): Array; 909 | flatten(shallow?: boolean): Array; 910 | without(...values: Array): Array; 911 | union(...arrays: Array): Array; 912 | intersection(...arrays: Array): Array; 913 | difference(...others: Array): Array; 914 | uniq(): Array; 915 | uniq(iteratee: Function): Array; 916 | uniq(isSorted: boolean, iteratee?: Function): Array; 917 | unique(): Array; 918 | unique(iteratee: Function): Array; 919 | unique(isSorted: boolean, iteratee?: Function): Array; 920 | zip(...arrays: Array): Array; 921 | unzip(): Array; 922 | object(values?: Array): Object; 923 | indexOf(value: T, isSorted?: boolean): number; 924 | lastIndexOf(value: T, iteratee?: Function, context?: mixed): number; 925 | sortedIndex(value: T, iteratee?: Function, context?: mixed): number; 926 | findIndex(predicate: (value: T) => boolean, context?: mixed): number; 927 | findLastIndex(predicate: (value: T) => boolean, context?: mixed): number; 928 | range(stop: number, step?: number): Array; 929 | range(): Array; 930 | isEmpty(): boolean; 931 | isEqual(other: Array): boolean; 932 | } 933 | 934 | // Have to use a type with $call instead of function type because otherwise this will cause us to lose type 935 | // information. see: https://github.com/facebook/flow/issues/3781 936 | declare type WrappedExports = { 937 | $call: (( // A type that can be an object or an array (usually 'any') should have both return types. 938 | arg: AnyType, 939 | ) => UnderscoreWrappedObject & UnderscoreWrappedList) & 940 | // It's important that UnderscoreWrappedObject, UnderscoreWrappedList takes precedence over UnderscoreWrappedValue 941 | (( 942 | arg: WrappedObj, 943 | ) => UnderscoreWrappedObject) & 944 | ((arg: Array) => UnderscoreWrappedList) & 945 | ((arg: [T]) => UnderscoreWrappedList) & 946 | ((arg: T) => UnderscoreWrappedValue), 947 | }; 948 | 949 | declare type Underscore = UnderscoreList & 950 | UnderscoreFunctions & 951 | UnderscoreObject & 952 | UnderscoreUtility & 953 | WrappedExports; 954 | 955 | declare module.exports: Underscore; 956 | } 957 | --------------------------------------------------------------------------------