diff --git a/packages/types/src/lib/context/context.ts b/packages/types/src/lib/context/context.ts index efa9b077e..3cea2e66b 100644 --- a/packages/types/src/lib/context/context.ts +++ b/packages/types/src/lib/context/context.ts @@ -1,5 +1,6 @@ import { Cookies } from './cookies.js' import { Geo } from './geo.js' +import { NetlifyUser } from './netlify-user.js' import { Server } from './server.js' import { Site } from './site.js' @@ -43,5 +44,11 @@ export interface Context { server: Server site: Site url: URL + + /** + * The Netlify user who passed SSO site protection for this request. + */ + user?: NetlifyUser + waitUntil: (promise: Promise) => void } diff --git a/packages/types/src/lib/context/netlify-user.ts b/packages/types/src/lib/context/netlify-user.ts new file mode 100644 index 000000000..a8b49a51d --- /dev/null +++ b/packages/types/src/lib/context/netlify-user.ts @@ -0,0 +1,8 @@ +export interface NetlifyUser { + /** Netlify user ID of the signed-in visitor. */ + id: string + /** Email address on the visitor's Netlify account. */ + email?: string + /** When the visitor's access to this site expires. */ + expiresAt: Date +} diff --git a/packages/types/src/main.ts b/packages/types/src/main.ts index 795b2a005..e6514b530 100644 --- a/packages/types/src/main.ts +++ b/packages/types/src/main.ts @@ -34,5 +34,6 @@ export type { FormSubmittedEvent, FormSubmittedHandler } from './lib/events/subm export type { EnvironmentVariables } from './lib/environment-variables.js' export type { FunctionRegion } from './lib/function-regions.js' export type { NetlifyGlobal } from './lib/globals.js' +export type { NetlifyUser } from './lib/context/netlify-user.js' export type { ServerRegion } from './lib/server-regions.js' export type { Site } from './lib/context/site.js'