Skip to content

Commit

Permalink
Remove unused properties of SessionStrategy (#4835)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Feb 15, 2021
1 parent d9c20ba commit 687fd5e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .changeset/eleven-waves-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/keystone': patch
'@keystone-next/types': patch
---

Removed the unused `connect` and `disconnect` properties of `SessionStrategy`.
2 changes: 0 additions & 2 deletions packages-next/keystone/src/session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ export function storedSessions({
let store = typeof storeOption === 'function' ? storeOption({ maxAge }) : storeOption;
let isConnected = false;
return {
connect: store.connect,
disconnect: store.disconnect,
async get({ req, createContext }) {
let sessionId = await get({ req, createContext });
if (typeof sessionId === 'string') {
Expand Down
16 changes: 4 additions & 12 deletions packages-next/types/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import type { ServerResponse, IncomingMessage } from 'http';
import { CreateContext } from '.';

export type SessionStrategy<StoredSessionData, StartSessionData = never> = {
connect?: () => Promise<void>;
disconnect?: () => Promise<void>;
// -- these two are invoked from mutations
// creates token from data, sets the cookie with token via res, returns token
start: (args: {
res: ServerResponse;
Expand All @@ -30,15 +27,10 @@ export type SessionStore = {
connect?: () => Promise<void>;
disconnect?: () => Promise<void>;
get(key: string): undefined | JSONValue | Promise<JSONValue | undefined>;
set(
key: string,
value: JSONValue
): // 😞 using any here rather than void to be compatible with Map. note that `| Promise<void>` doesn't actually do anything type wise because it just turns into any, it's just to show intent here
any | Promise<void>;
delete(
key: string
): // 😞 | boolean is for compatibility with Map
void | boolean | Promise<void>;
// � using any here rather than void to be compatible with Map. note that `| Promise<void>` doesn't actually do anything type wise because it just turns into any, it's just to show intent here
set(key: string, value: JSONValue): any | Promise<void>;
// � | boolean is for compatibility with Map
delete(key: string): void | boolean | Promise<void>;
};

export type SessionStoreFunction = (args: {
Expand Down

1 comment on commit 687fd5e

@vercel
Copy link

@vercel vercel bot commented on 687fd5e Feb 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.