Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Update dependencies and types for [email protected] (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGrandon authored Nov 13, 2018
1 parent 71f1eac commit 9b16f54
Show file tree
Hide file tree
Showing 5 changed files with 337 additions and 1,154 deletions.
153 changes: 86 additions & 67 deletions flow-typed/tape-cup_v4.x.x.js
Original file line number Diff line number Diff line change
@@ -1,104 +1,123 @@
/* eslint-disable */

declare type tape$TestOpts = {
skip: boolean,
timeout?: number,
} | {
skip?: boolean,
timeout: number,
};
declare type tape$TestOpts =
| {
skip: boolean,
timeout?: number,
}
| {
skip?: boolean,
timeout: number,
};

declare type tape$TestCb = (t: tape$Context) => mixed;
declare type tape$TestFn = (a: string | tape$TestOpts | tape$TestCb, b?: tape$TestOpts | tape$TestCb, c?: tape$TestCb) => void;
declare type tape$TestFn = (
a: string | tape$TestOpts | tape$TestCb,
b?: tape$TestOpts | tape$TestCb,
c?: tape$TestCb
) => void;

declare interface tape$Context {
fail(msg?: string): void,
pass(msg?: string): void,
fail(msg?: string): void;
pass(msg?: string): void;

error(err: mixed, msg?: string): void,
ifError(err: mixed, msg?: string): void,
ifErr(err: mixed, msg?: string): void,
iferror(err: mixed, msg?: string): void,
error(err: mixed, msg?: string): void;
ifError(err: mixed, msg?: string): void;
ifErr(err: mixed, msg?: string): void;
iferror(err: mixed, msg?: string): void;

ok(value: mixed, msg?: string): void,
true(value: mixed, msg?: string): void,
assert(value: mixed, msg?: string): void,
ok(value: mixed, msg?: string): void;
true(value: mixed, msg?: string): void;
assert(value: mixed, msg?: string): void;

notOk(value: mixed, msg?: string): void,
false(value: mixed, msg?: string): void,
notok(value: mixed, msg?: string): void,
notOk(value: mixed, msg?: string): void;
false(value: mixed, msg?: string): void;
notok(value: mixed, msg?: string): void;

// equal + aliases
equal(actual: mixed, expected: mixed, msg?: string): void,
equals(actual: mixed, expected: mixed, msg?: string): void,
isEqual(actual: mixed, expected: mixed, msg?: string): void,
is(actual: mixed, expected: mixed, msg?: string): void,
strictEqual(actual: mixed, expected: mixed, msg?: string): void,
strictEquals(actual: mixed, expected: mixed, msg?: string): void,
equal(actual: mixed, expected: mixed, msg?: string): void;
equals(actual: mixed, expected: mixed, msg?: string): void;
isEqual(actual: mixed, expected: mixed, msg?: string): void;
is(actual: mixed, expected: mixed, msg?: string): void;
strictEqual(actual: mixed, expected: mixed, msg?: string): void;
strictEquals(actual: mixed, expected: mixed, msg?: string): void;

// notEqual + aliases
notEqual(actual: mixed, expected: mixed, msg?: string): void,
notEquals(actual: mixed, expected: mixed, msg?: string): void,
notStrictEqual(actual: mixed, expected: mixed, msg?: string): void,
notStrictEquals(actual: mixed, expected: mixed, msg?: string): void,
isNotEqual(actual: mixed, expected: mixed, msg?: string): void,
isNot(actual: mixed, expected: mixed, msg?: string): void,
not(actual: mixed, expected: mixed, msg?: string): void,
doesNotEqual(actual: mixed, expected: mixed, msg?: string): void,
isInequal(actual: mixed, expected: mixed, msg?: string): void,
notEqual(actual: mixed, expected: mixed, msg?: string): void;
notEquals(actual: mixed, expected: mixed, msg?: string): void;
notStrictEqual(actual: mixed, expected: mixed, msg?: string): void;
notStrictEquals(actual: mixed, expected: mixed, msg?: string): void;
isNotEqual(actual: mixed, expected: mixed, msg?: string): void;
isNot(actual: mixed, expected: mixed, msg?: string): void;
not(actual: mixed, expected: mixed, msg?: string): void;
doesNotEqual(actual: mixed, expected: mixed, msg?: string): void;
isInequal(actual: mixed, expected: mixed, msg?: string): void;

// deepEqual + aliases
deepEqual(actual: mixed, expected: mixed, msg?: string): void,
deepEquals(actual: mixed, expected: mixed, msg?: string): void,
isEquivalent(actual: mixed, expected: mixed, msg?: string): void,
same(actual: mixed, expected: mixed, msg?: string): void,
deepEqual(actual: mixed, expected: mixed, msg?: string): void;
deepEquals(actual: mixed, expected: mixed, msg?: string): void;
isEquivalent(actual: mixed, expected: mixed, msg?: string): void;
same(actual: mixed, expected: mixed, msg?: string): void;

// notDeepEqual
notDeepEqual(actual: mixed, expected: mixed, msg?: string): void,
notEquivalent(actual: mixed, expected: mixed, msg?: string): void,
notDeeply(actual: mixed, expected: mixed, msg?: string): void,
notSame(actual: mixed, expected: mixed, msg?: string): void,
isNotDeepEqual(actual: mixed, expected: mixed, msg?: string): void,
isNotDeeply(actual: mixed, expected: mixed, msg?: string): void,
isNotEquivalent(actual: mixed, expected: mixed, msg?: string): void,
isInequivalent(actual: mixed, expected: mixed, msg?: string): void,
notDeepEqual(actual: mixed, expected: mixed, msg?: string): void;
notEquivalent(actual: mixed, expected: mixed, msg?: string): void;
notDeeply(actual: mixed, expected: mixed, msg?: string): void;
notSame(actual: mixed, expected: mixed, msg?: string): void;
isNotDeepEqual(actual: mixed, expected: mixed, msg?: string): void;
isNotDeeply(actual: mixed, expected: mixed, msg?: string): void;
isNotEquivalent(actual: mixed, expected: mixed, msg?: string): void;
isInequivalent(actual: mixed, expected: mixed, msg?: string): void;

// deepLooseEqual
deepLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
looseEqual(actual: mixed, expected: mixed, msg?: string): void,
looseEquals(actual: mixed, expected: mixed, msg?: string): void,
deepLooseEqual(actual: mixed, expected: mixed, msg?: string): void;
looseEqual(actual: mixed, expected: mixed, msg?: string): void;
looseEquals(actual: mixed, expected: mixed, msg?: string): void;

// notDeepLooseEqual
notDeepLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
notLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
notLooseEquals(actual: mixed, expected: mixed, msg?: string): void,

throws(fn: Function, expected?: RegExp | Function, msg?: string): void,
doesNotThrow(fn: Function, expected?: RegExp | Function, msg?: string): void,

timeoutAfter(ms: number): void,

skip(msg?: string): void,
plan(n: number): void,
onFinish(fn: Function): void,
end(): void,
comment(msg: string): void,
test: tape$TestFn,
notDeepLooseEqual(actual: mixed, expected: mixed, msg?: string): void;
notLooseEqual(actual: mixed, expected: mixed, msg?: string): void;
notLooseEquals(actual: mixed, expected: mixed, msg?: string): void;

throws(fn: Function, expected?: RegExp | Function, msg?: string): void;
throws(fn: Function, msg?: string): void;
doesNotThrow(fn: Function, expected?: RegExp | Function, msg?: string): void;
doesNotThrow(fn: Function, msg?: string): void;

timeoutAfter(ms: number): void;

skip(msg?: string): void;
plan(n: number): void;
onFinish(fn: Function): void;
end(): void;
comment(msg: string): void;
test: tape$TestFn;
}

declare module 'tape-cup' {
declare type TestHarness = Tape;
declare type tape$TestCb = tape$TestCb;
declare type StreamOpts = {
objectMode?: boolean,
};

declare type Tape = {
(a: string | tape$TestOpts | tape$TestCb, b?: tape$TestCb | tape$TestOpts, c?: tape$TestCb, ...rest: Array<void>): void,
(
a: string | tape$TestOpts | tape$TestCb,
b?: tape$TestCb | tape$TestOpts,
c?: tape$TestCb,
...rest: Array<void>
): void,
test: tape$TestFn,
skip: (name: string, cb?: tape$TestCb) => void,
createHarness: () => TestHarness,
createStream: (opts?: StreamOpts) => stream$Readable,
only: (a: string | tape$TestOpts | tape$TestCb, b?: tape$TestCb | tape$TestOpts, c?: tape$TestCb, ...rest: Array<void>) => void,
only: (
a: string | tape$TestOpts | tape$TestCb,
b?: tape$TestCb | tape$TestOpts,
c?: tape$TestCb,
...rest: Array<void>
) => void,
};

declare module.exports: Tape;
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@
},
"dependencies": {
"base64-url": "^2.2.0",
"eslint-plugin-jest": "^21.22.0"
"eslint-plugin-jest": "^22.0.0"
},
"devDependencies": {
"@babel/preset-react": "7.0.0",
"babel-eslint": "^10.0.0",
"babel-eslint": "^10.0.1",
"body-parser": "^1.18.3",
"create-universal-package": "^3.4.6",
"eslint": "^5.4.0",
"eslint": "^5.9.0",
"eslint-config-fusion": "^4.0.0",
"eslint-plugin-cup": "^2.0.0",
"eslint-plugin-flowtype": "^3.0.0",
"eslint-plugin-flowtype": "^3.2.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-prettier": "3.0.0",
"eslint-plugin-react": "^7.11.1",
"express": "^4.16.3",
"flow-bin": "^0.83.0",
"fusion-core": "1.9.0-0",
"fusion-test-utils": "^1.2.2",
"fusion-tokens": "^1.0.4",
"express": "^4.16.4",
"flow-bin": "^0.86.0",
"fusion-core": "^1.9.1-1",
"fusion-test-utils": "^1.2.3",
"fusion-tokens": "^1.1.0",
"generic-session": "0.1.2",
"get-port": "4.0.0",
"nyc": "^13.0.1",
"prettier": "^1.14.2",
"sinon": "^6.1.5",
"nyc": "^13.1.0",
"prettier": "^1.15.1",
"sinon": "^7.1.1",
"tape-cup": "4.7.1",
"unitest": "2.1.1"
},
Expand Down
4 changes: 1 addition & 3 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ const enhancer = (fetch: Fetch) => {
const prefix = window.__ROUTE_PREFIX__ || ''; // created by fusion-core/src/server
let fetchWithCsrfToken: Fetch = (url, options) => {
if (!options) options = {};
// $FlowFixMe
const isCsrfMethod = verifyMethod(options.method || 'GET');
if (!isCsrfMethod) {
return fetch(url, options);
}
// $FlowFixMe
return fetch(prefix + url, {
return fetch(prefix + String(url), {
...options,
credentials: 'same-origin',
headers: {
Expand Down
12 changes: 10 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
* @flow
*/

import {createPlugin} from 'fusion-core';
import {createPlugin, type FusionPlugin} from 'fusion-core';
import type {Fetch} from 'fusion-tokens';

import {verifyMethod, CsrfIgnoreRoutesToken} from './shared';

const enhancer = (oldFetch: Fetch) => {
type PluginDepsType = {
ignored: typeof CsrfIgnoreRoutesToken.optional,
};

type ServiceType = () => Promise<void>;

const enhancer = (
oldFetch: Fetch
): FusionPlugin<PluginDepsType, ServiceType> => {
return createPlugin({
deps: {
ignored: CsrfIgnoreRoutesToken.optional,
Expand Down
Loading

0 comments on commit 9b16f54

Please sign in to comment.