Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/types/src/lib/context/context.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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<unknown>) => void
}
8 changes: 8 additions & 0 deletions packages/types/src/lib/context/netlify-user.ts
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions packages/types/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Loading