Skip to content

Commit

Permalink
Switch to Promisable over PromiseOrSync
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg authored and MichaelDeBoey committed Aug 15, 2023
1 parent b937cdc commit f705613
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/remix-server-runtime/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { PromiseOrSync } from "./utils";
import type { Promisable } from "type-fest";

export type SignFunction = (
value: string,
secret: string
) => PromiseOrSync<string>;
) => Promisable<string>;

export type UnsignFunction = (
cookie: string,
secret: string
) => PromiseOrSync<string | false>;
) => Promisable<string | false>;

// TODO: Once node v16 is available on AWS we should use the globally provided
// webcrypto "crypto" variable and re-enable this code-path in "./cookies.ts"
Expand Down
10 changes: 5 additions & 5 deletions packages/remix-server-runtime/sessions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { CookieParseOptions, CookieSerializeOptions } from "cookie";
import type { Promisable } from "type-fest";

import type { Cookie, CookieOptions, CreateCookieFunction } from "./cookies";
import { isCookie } from "./cookies";
import { warnOnce } from "./warnings";
import type { PromiseOrSync } from "./utils";

/**
* An object of name/value pairs to be used in the session.
Expand Down Expand Up @@ -224,14 +224,14 @@ export interface SessionIdStorageStrategy<
createData: (
data: FlashSessionData<Data, FlashData>,
expires?: Date
) => PromiseOrSync<string>;
) => Promisable<string>;

/**
* Returns data for a given session id, or `null` if there isn't any.
*/
readData: (
id: string
) => PromiseOrSync<FlashSessionData<Data, FlashData> | null>;
) => Promisable<FlashSessionData<Data, FlashData> | null>;

/**
* Updates data for the given session id.
Expand All @@ -240,12 +240,12 @@ export interface SessionIdStorageStrategy<
id: string,
data: FlashSessionData<Data, FlashData>,
expires?: Date
) => PromiseOrSync<void>;
) => Promisable<void>;

/**
* Deletes data for a given session id from the data store.
*/
deleteData: (id: string) => PromiseOrSync<void>;
deleteData: (id: string) => Promisable<void>;
}

export type CreateSessionStorageFunction = <
Expand Down
1 change: 0 additions & 1 deletion packages/remix-server-runtime/utils.ts

This file was deleted.

0 comments on commit f705613

Please sign in to comment.