diff --git a/packages/remix-server-runtime/crypto.ts b/packages/remix-server-runtime/crypto.ts index 58d333033dd..c28c2717677 100644 --- a/packages/remix-server-runtime/crypto.ts +++ b/packages/remix-server-runtime/crypto.ts @@ -1,14 +1,14 @@ -import type { PromiseOrSync } from "./utils"; +import type { Promisable } from "type-fest"; export type SignFunction = ( value: string, secret: string -) => PromiseOrSync; +) => Promisable; export type UnsignFunction = ( cookie: string, secret: string -) => PromiseOrSync; +) => Promisable; // 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" diff --git a/packages/remix-server-runtime/sessions.ts b/packages/remix-server-runtime/sessions.ts index a56372197d4..7dcf4344d88 100644 --- a/packages/remix-server-runtime/sessions.ts +++ b/packages/remix-server-runtime/sessions.ts @@ -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. @@ -224,14 +224,14 @@ export interface SessionIdStorageStrategy< createData: ( data: FlashSessionData, expires?: Date - ) => PromiseOrSync; + ) => Promisable; /** * Returns data for a given session id, or `null` if there isn't any. */ readData: ( id: string - ) => PromiseOrSync | null>; + ) => Promisable | null>; /** * Updates data for the given session id. @@ -240,12 +240,12 @@ export interface SessionIdStorageStrategy< id: string, data: FlashSessionData, expires?: Date - ) => PromiseOrSync; + ) => Promisable; /** * Deletes data for a given session id from the data store. */ - deleteData: (id: string) => PromiseOrSync; + deleteData: (id: string) => Promisable; } export type CreateSessionStorageFunction = < diff --git a/packages/remix-server-runtime/utils.ts b/packages/remix-server-runtime/utils.ts deleted file mode 100644 index ad9891bd8eb..00000000000 --- a/packages/remix-server-runtime/utils.ts +++ /dev/null @@ -1 +0,0 @@ -export type PromiseOrSync = Promise | T;