Skip to content

Commit

Permalink
Revert "chore: move from koa-generic-session to koa-session (#35)" (#69)
Browse files Browse the repository at this point in the history
Revert "chore: move from koa-generic-session to koa-session (#35)"
  • Loading branch information
niftylettuce committed Jan 7, 2020
2 parents 118943e + c38fa12 commit f40993c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 83 deletions.
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -58,14 +58,14 @@ yarn add koa-redis

## Usage

`koa-redis` works with [koa-session](https://github.com/koajs/session) (a basic session middleware for koa).
`koa-redis` works with [koa-generic-session](https://github.com/koajs/generic-session) (a generic session middleware for koa).

For more examples, please see the [examples folder of `koa-session`](https://github.com/koajs/session/tree/master/example).
For more examples, please see the [examples folder of `koa-generic-session`](https://github.com/koajs/generic-session/tree/master/example).

### Basic

```js
const session = require('koa-session');
const session = require('koa-generic-session');
const redisStore = require('koa-redis');
const koa = require('koa');

Expand All @@ -75,7 +75,7 @@ app.use(session({
store: redisStore({
// Options specified here
})
}, app));
}));

app.use(function *() {
switch (this.path) {
Expand Down Expand Up @@ -115,7 +115,7 @@ app.listen(8080);
### Sentinel

```js
const session = require('koa-session');
const session = require('koa-generic-session');
const redisStore = require('koa-redis');
const koa = require('koa');

Expand All @@ -132,15 +132,15 @@ app.use(session({
],
name: 'mymaster'
})
}, app));
}));

// ...
```

### Cluster

```js
const session = require('koa-session');
const session = require('koa-generic-session');
const redisStore = require('koa-redis');
const koa = require('koa');

Expand Down Expand Up @@ -170,7 +170,7 @@ app.use(session({
}
}
})
}, app));
}));

// ...
```
Expand Down Expand Up @@ -199,10 +199,10 @@ See the [`ioredis` docs](https://github.com/luin/ioredis#connection-events) for

## API

These are some the functions that `koa-session` uses that you can use manually. You will need to initialize differently than the example above:
These are some the functions that `koa-generic-session` uses that you can use manually. You will need to initialize differently than the example above:

```js
const session = require('koa-session');
const session = require('koa-generic-session');
const redisStore = require('koa-redis')({
// Options specified here
});
Expand All @@ -211,7 +211,7 @@ const app = require('koa')();
app.keys = ['keys', 'keykeys'];
app.use(session({
store: redisStore
}, app));
}));
```

### module([options](#options))
Expand Down
17 changes: 7 additions & 10 deletions benchmark/koa.js
@@ -1,18 +1,15 @@
const Koa = require('koa');
const session = require('koa-session');
const redisStore = require('../src');
const koa = require('koa');
const session = require('koa-generic-session');
const redisStore = require('..');

const app = new Koa();
const app = koa();

app.keys = ['keys', 'keykeys'];
if (process.argv[2] !== 'nosession') {
app.use(
session(
{
store: redisStore()
},
app
)
session({
store: redisStore()
})
);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -39,7 +39,7 @@
"husky": "^2.1.0",
"istanbul": "^0.4.5",
"koa": "^2.7.0",
"koa-session": "^5.12.2",
"koa-generic-session": "^2.0.1",
"lint-staged": "^8.1.5",
"mocha": "3.5.3",
"remark-cli": "^6.0.1",
Expand Down
91 changes: 30 additions & 61 deletions yarn.lock
Expand Up @@ -1931,11 +1931,6 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=

base64-js@^1.0.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3"
integrity sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==

base@^0.11.1:
version "0.11.2"
resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f"
Expand Down Expand Up @@ -2023,14 +2018,6 @@ buffer-from@^1.0.0:
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==

buffer@^5.1.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6"
integrity sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"

bytes@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
Expand Down Expand Up @@ -2455,7 +2442,7 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=

copy-to@^2.0.1:
copy-to@^2.0.1, copy-to@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/copy-to/-/copy-to-2.0.1.tgz#2680fbb8068a48d08656b6098092bdafc906f4a5"
integrity sha1-JoD7uAaKSNCGVrYJgJK9r8kG9KU=
Expand Down Expand Up @@ -2493,7 +2480,7 @@ core-js@^2.0.0, core-js@^2.4.0, core-js@^2.5.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895"
integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==

core-util-is@^1.0.2, core-util-is@~1.0.0:
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
Expand All @@ -2518,12 +2505,10 @@ cosmiconfig@^5.0.2, cosmiconfig@^5.2.0:
js-yaml "^3.13.0"
parse-json "^4.0.0"

crc@^3.4.4:
version "3.8.0"
resolved "https://registry.yarnpkg.com/crc/-/crc-3.8.0.tgz#ad60269c2c856f8c299e2c4cc0de4556914056c6"
integrity sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==
dependencies:
buffer "^5.1.0"
crc@~3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/crc/-/crc-3.5.0.tgz#98b8ba7d489665ba3979f59b21381374101a1964"
integrity sha1-mLi6fUiWZbo5efWbITgTdBAaGWQ=

create-error-class@^3.0.0:
version "3.0.2"
Expand Down Expand Up @@ -3960,11 +3945,6 @@ iconv-lite@0.4.24, iconv-lite@^0.4.15, iconv-lite@^0.4.24, iconv-lite@^0.4.4:
dependencies:
safer-buffer ">= 2.1.2 < 3"

ieee754@^1.1.4:
version "1.1.13"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==

ignore-walk@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8"
Expand Down Expand Up @@ -4171,11 +4151,6 @@ is-ci@^2.0.0:
dependencies:
ci-info "^2.0.0"

is-class-hotfix@~0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/is-class-hotfix/-/is-class-hotfix-0.0.6.tgz#a527d31fb23279281dde5f385c77b5de70a72435"
integrity sha512-0n+pzCC6ICtVr/WXnN2f03TK/3BfXY7me4cjCAqT8TYXEl0+JBRoqBo94JJHXcyDSLUeWbNX8Fvy5g5RJdAstQ==

is-data-descriptor@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56"
Expand Down Expand Up @@ -4448,15 +4423,6 @@ is-text-path@^1.0.0:
dependencies:
text-extensions "^1.0.0"

is-type-of@^1.0.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/is-type-of/-/is-type-of-1.2.1.tgz#e263ec3857aceb4f28c47130ec78db09a920f8c5"
integrity sha512-uK0kyX9LZYhSDS7H2sVJQJop1UnWPWmo5RvR3q2kFH6AUHYs7sOrVg0b4nyBHw29kRRNFofYN/JbHZDlHiItTA==
dependencies:
core-util-is "^1.0.2"
is-class-hotfix "~0.0.6"
isstream "~0.1.2"

is-url@^1.2.2:
version "1.2.4"
resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.4.tgz#04a4df46d28c4cff3d73d01ff06abeb318a1aa52"
Expand Down Expand Up @@ -4509,11 +4475,6 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=

isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=

istanbul@^0.4.5:
version "0.4.5"
resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b"
Expand Down Expand Up @@ -4670,21 +4631,22 @@ koa-convert@^1.2.0:
co "^4.6.0"
koa-compose "^3.0.0"

koa-generic-session@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/koa-generic-session/-/koa-generic-session-2.0.1.tgz#d6bdf4f288b2f553065d049a630c28c76d877ccf"
integrity sha512-yw+sG7PdfIX8HBFMjvpmnQWoGHpo07BgMAem3PMM8UEKO9jaZeJu5ywtatYduWGrc5XfGu7Tgw8zQEcdSCunxw==
dependencies:
copy-to "~2.0.1"
crc "~3.5.0"
debug "~3.1.0"
parseurl "~1.3.1"
uid-safe "~2.1.4"

koa-is-json@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/koa-is-json/-/koa-is-json-1.0.0.tgz#273c07edcdcb8df6a2c1ab7d59ee76491451ec14"
integrity sha1-JzwH7c3Ljfaiwat9We52SRRR7BQ=

koa-session@^5.12.2:
version "5.12.2"
resolved "https://registry.yarnpkg.com/koa-session/-/koa-session-5.12.2.tgz#a9549361751e84b137e778bb93df5eeb51478c1f"
integrity sha512-gCJ3PXMEOrARM9iYgiALZufdHz7UTDVPTZAc8ScrXl7K9kOTFDEcMIIIwNR03AiJ0BHZs7aLO+kqqEZ3Dvd8Mw==
dependencies:
crc "^3.4.4"
debug "^3.1.0"
is-type-of "^1.0.0"
uuid "^3.3.2"

koa@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/koa/-/koa-2.7.0.tgz#7e00843506942b9d82c6cc33749f657c6e5e7adf"
Expand Down Expand Up @@ -5863,7 +5825,7 @@ parse-latin@^4.0.0:
unist-util-modify-children "^1.0.0"
unist-util-visit-children "^1.0.0"

parseurl@^1.3.2, parseurl@~1.3.2:
parseurl@^1.3.2, parseurl@~1.3.1, parseurl@~1.3.2:
version "1.3.3"
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
Expand Down Expand Up @@ -6122,6 +6084,11 @@ quotation@^1.0.1:
resolved "https://registry.yarnpkg.com/quotation/-/quotation-1.1.1.tgz#b599a2b7361a566086458014fda9d6b00326f169"
integrity sha512-bjz7kEsfg6D3uMeed+VbeypnooGlX7enMnDbx0KLYEEM8J1k24jk2pc+1nyQ1sExnERz8xKXRSZ0EYNIwLM83g==

random-bytes@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/random-bytes/-/random-bytes-1.0.0.tgz#4f68a1dc0ae58bd3fb95848c30324db75d64360b"
integrity sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=

raw-body@^2.2.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332"
Expand Down Expand Up @@ -8051,6 +8018,13 @@ uglify-js@^3.1.4:
commander "~2.20.0"
source-map "~0.6.1"

uid-safe@~2.1.4:
version "2.1.5"
resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.5.tgz#2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a"
integrity sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==
dependencies:
random-bytes "~1.0.0"

unescape@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/unescape/-/unescape-1.0.1.tgz#956e430f61cad8a4d57d82c518f5e6cc5d0dda96"
Expand Down Expand Up @@ -8360,11 +8334,6 @@ utils-merge@1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=

uuid@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==

validate-npm-package-license@^3.0.1:
version "3.0.4"
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"
Expand Down

0 comments on commit f40993c

Please sign in to comment.