ts: auth, api, utils

This commit is contained in:
Tom Moor committed 2020-12-29 13:07:18 -08:00
1 parent e81605fb9d
commit aa29a96cd0
57 files changed
+9 -51

No files matched your search

+1 -2
View File
@@ -1,4 +1,3 @@
// @flow
export default {
add: () => {},
add: () => { },
};
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import auth from "../middlewares/authentication";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import format from "date-fns/format";
import Router from "koa-router";
import uuid from "uuid";
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import { reject } from "lodash";
import { parseDomain, isCustomSubdomain } from "../../shared/utils/domains";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import fs from "fs";
import Router from "koa-router";
import { ValidationError } from "../errors";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import Sequelize from "sequelize";
import { subtractDate } from "../../shared/utils/date";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import Sequelize from "sequelize";
import auth from "../middlewares/authentication";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import { MAX_AVATAR_DISPLAY } from "../../shared/constants";
import auth from "../middlewares/authentication";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import { escapeRegExp } from "lodash";
import { AuthenticationError, InvalidRequestError } from "../errors";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Koa from "koa";
import bodyParser from "koa-body";
import Router from "koa-router";
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import auth from "../middlewares/authentication";
import { Event } from "../models";
@@ -1,11 +1,10 @@
// @flow
import stream from "stream";
import { type Context } from "koa";
import { Context } from "koa";
export default function apiWrapper() {
return async function apiWrapperMiddleware(
ctx: Context,
next: () => Promise<*>
next: (() => Promise<unknown>)
) {
await next();
@@ -1,11 +1,10 @@
// @flow
import { type Context } from "koa";
import { Context } from "koa";
import pkg from "rich-markdown-editor/package.json";
import semver from "semver";
import { EditorUpdateError } from "../../errors";
export default function editor() {
return async function editorMiddleware(ctx: Context, next: () => Promise<*>) {
return async function editorMiddleware(ctx: Context, next: (() => Promise<unknown>)) {
const clientVersion = ctx.headers["x-editor-version"];
// If the editor version on the client is behind the current version being
@@ -1,12 +1,11 @@
// @flow
import querystring from "querystring";
import { type Context } from "koa";
import { Context } from "koa";
import { InvalidRequestError } from "../../errors";
export default function pagination(options?: Object) {
return async function paginationMiddleware(
ctx: Context,
next: () => Promise<*>
next: (() => Promise<unknown>)
) {
const opts = {
defaultLimit: 15,
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import auth from "../middlewares/authentication";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import { NotFoundError } from "../errors";
import auth from "../middlewares/authentication";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import Sequelize from "sequelize";
import { NotFoundError } from "../errors";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import auth from "../middlewares/authentication";
import { Event, Team } from "../models";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import userInviter from "../commands/userInviter";
import userSuspender from "../commands/userSuspender";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import subDays from "date-fns/sub_days";
import debug from "debug";
import Router from "koa-router";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import Router from "koa-router";
import auth from "../middlewares/authentication";
import { View, Document, Event } from "../models";
@@ -1,4 +1,3 @@
// @flow
import subMinutes from "date-fns/sub_minutes";
import Router from "koa-router";
import { AuthorizationError } from "../errors";
@@ -1,4 +1,3 @@
// @flow
import crypto from "crypto";
import { OAuth2Client } from "google-auth-library";
import Router from "koa-router";
@@ -1,4 +1,3 @@
// @flow
import addMonths from "date-fns/add_months";
import Koa from "koa";
import bodyParser from "koa-body";
@@ -1,4 +1,3 @@
// @flow
import addHours from "date-fns/add_hours";
import Router from "koa-router";
import Sequelize from "sequelize";
File renamed without changes.
@@ -1,4 +1,3 @@
// @flow
import dataURItoBuffer from "./dataURItoBuffer";
it("should parse value data URI", () => {
@@ -1,4 +1,3 @@
// @flow
export default function dataURItoBuffer(dataURI: string) {
const split = dataURI.split(",");
@@ -1,4 +1,3 @@
// @flow
import { parseDomain, stripSubdomain } from "../../shared/utils/domains";
export function getCookieDomain(domain: string) {
@@ -1,4 +1,3 @@
// @flow
import subMinutes from "date-fns/sub_minutes";
import JWT from "jsonwebtoken";
import { AuthenticationError } from "../errors";
@@ -1,4 +1,3 @@
// @flow
export const opensearchResponse = (): string => {
return `
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
@@ -1,4 +1,3 @@
// @flow
const attachmentRegex = /!\[.*?\]\(\/api\/attachments\.redirect\?id=(?<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\)/gi;
export default function parseAttachmentIds(text: any): string[] {
@@ -1,4 +1,3 @@
// @flow
import parseDocumentIds from "./parseDocumentIds";
it("should not return non links", () => {
@@ -1,4 +1,3 @@
// @flow
import { parser } from "rich-markdown-editor";
export default function parseDocumentIds(text: string): string[] {
@@ -1,4 +1,3 @@
// @flow
import parseImages from "./parseImages";
it("should not return non images", () => {
@@ -1,4 +1,3 @@
// @flow
import { parser } from "rich-markdown-editor";
export default function parseImages(text: string): string[] {
@@ -1,4 +1,3 @@
// @flow
import fs from "fs";
import path from "path";
import * as React from "react";
@@ -1,4 +1,3 @@
// @flow
import Queue from "bull";
import Redis from "ioredis";
import { client, subscriber } from "../redis";
@@ -1,9 +1,8 @@
// @flow
import { type Context } from "koa";
import { Context } from "koa";
const DISALLOW_ROBOTS = `User-agent: *
Disallow: /`;
export const robotsResponse = (ctx: Context): ?string => {
export const robotsResponse = (ctx: Context): string | null => {
if (ctx.headers.host.indexOf("getoutline.com") < 0) return DISALLOW_ROBOTS;
};
@@ -1,4 +1,3 @@
// @flow
import crypto from "crypto";
import * as Sentry from "@sentry/node";
import AWS from "aws-sdk";
@@ -1,4 +1,3 @@
// @flow
import slug from "slug";
slug.defaults.mode = "rfc3986";
@@ -1,4 +1,3 @@
// @flow
import crypto from "crypto";
import invariant from "invariant";
import fetch from "isomorphic-fetch";
@@ -1,4 +1,3 @@
// @flow
import fs from "fs";
import * as Sentry from "@sentry/node";
import JSZip from "jszip";