type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
InterfaceDeclaration | /**
* Example creating a button component
*/
export interface OnlySomeProps extends
React.ButtonHTMLAttributes<HTMLButtonElement>,
gls.SizeProps {
} | basarat/gls | src/demos/index.tsx | TypeScript |
InterfaceDeclaration |
export interface AllTheProps extends
React.ButtonHTMLAttributes<HTMLButtonElement>,
gls.ComponentProps {
} | basarat/gls | src/demos/index.tsx | TypeScript |
InterfaceDeclaration |
export interface LimitedButtonProps extends
gls.ComponentProps {
/** Turns red if in error state */
error?: boolean
} | basarat/gls | src/demos/index.tsx | TypeScript |
InterfaceDeclaration | /**
* Example creating a default component prop
*/
export interface DefaultInputProps extends
React.InputHTMLAttributes<HTMLInputElement>,
gls.ComponentProps {
} | basarat/gls | src/demos/index.tsx | TypeScript |
InterfaceDeclaration | /**
* Example creating an input component
*/
export interface ExampleInputProps extends
React.InputHTMLAttributes<HTMLInputElement>,
gls.ComponentProps {
} | basarat/gls | src/demos/index.tsx | TypeScript |
ArrowFunction |
(error, stdout, stderr) => {
this.running = false;
this.exitCode = this.childProcess.exitCode !== null ? this.childProcess.exitCode : undefined;
if(error !== null){
console.log();
console.log("Error running CommandExecuter!" + (na... | yerTools/UIX | src/Utilities/BuildTools/Worker/CommandExecuter.ts | TypeScript |
ArrowFunction |
data => this.outputBuffer += data | yerTools/UIX | src/Utilities/BuildTools/Worker/CommandExecuter.ts | TypeScript |
ClassDeclaration |
export class CommandExecuter{
public name?:string;
public running = true;
public exitCode?:number;
private childProcess:ChildProcess;
private outputBuffer = "";
constructor(command:string, args?:string, workingDirectory?:string, name?:string, mute = false){
... | yerTools/UIX | src/Utilities/BuildTools/Worker/CommandExecuter.ts | TypeScript |
MethodDeclaration |
public readLine(){
if(this.outputBuffer){
if(this.running){
let index = this.outputBuffer.indexOf("\n");
if(index !== -1){
const result = this.outputBuffer.substring(0, index);
this.outputBuffer = this.o... | yerTools/UIX | src/Utilities/BuildTools/Worker/CommandExecuter.ts | TypeScript |
ArrowFunction |
(initialt: system locale) | zionsuperfly/westlandcoin | src/qt/locale/bitcoin_ro_RO.ts | TypeScript |
ArrowFunction |
(initial: 5333 sau testnet: 15333) | zionsuperfly/westlandcoin | src/qt/locale/bitcoin_ro_RO.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class EncountersService {
v = 'default';
constructor(private httpClient: HttpClient) { }
fetchEncounters(patientUuid) {
let url = Constants.baseOpenmrsURL;
url += '/encounter';
const params: HttpParams = new HttpParams()
.set('v', (this.v))
... | enyachoke/single-spa-hackathon | patientdashboard/src/app/services/encounters.service.ts | TypeScript |
MethodDeclaration |
fetchEncounters(patientUuid) {
let url = Constants.baseOpenmrsURL;
url += '/encounter';
const params: HttpParams = new HttpParams()
.set('v', (this.v))
.set('patient', (patientUuid));
return this.httpClient.get(url, {
params
});
} | enyachoke/single-spa-hackathon | patientdashboard/src/app/services/encounters.service.ts | TypeScript |
InterfaceDeclaration |
export interface IDateProvider {
startOfDay(): Date;
endOfDay(): Date;
} | mbrunoviegas/pipedrive-bling | src/shared/core/providers/dateProvider.interface.ts | TypeScript |
ArrowFunction |
(): User => (
useSelector<RootState, User>(
(state) => state.user
)
) | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(state) => state.user | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(): Roles => (
useSelector<RootState, Roles>(
(state) => state.user.Role.role
)
) | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(state) => state.user.Role.role | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(): void => {
const dispatch = useDispatch();
useSsrEffect(() => dispatch(authorization()));
} | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
() => dispatch(authorization()) | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(): UserStatistic => {
const { comments, posts } = useSelector<RootState, UserStatistic>(state => state.user.Statistic);
return {
comments, posts
};
} | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
state => state.user.Statistic | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(): {
signin: (props: { email: string; password: string }) => void;
signup: (props: { email: string; password: string }) => void;
signout: () => void;
} => {
const dispatch = useDispatch();
return {
signin: (user): void => {
dispatch(signIn(user));
},
signup: (user): void => {
dispat... | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(user): void => {
dispatch(signIn(user));
} | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(user): void => {
dispatch(signUp(user));
} | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ArrowFunction |
(): void => {
dispatch(signOut());
} | AlexSergey/rock | next/web-client/src/features/User/hooks.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class AuthService {
public constructor(
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
private readonly jwtService: JwtService
) {}
public getJwtToken(id: string): JwtToken {
const payload: JwtPayload = { id };
return {
accessToken: thi... | kentayamada-dev/instagram-clone | apps/backend/src/auth/auth.service.ts | TypeScript |
MethodDeclaration |
public getJwtToken(id: string): JwtToken {
const payload: JwtPayload = { id };
return {
accessToken: this.jwtService.sign(payload)
};
} | kentayamada-dev/instagram-clone | apps/backend/src/auth/auth.service.ts | TypeScript |
FunctionDeclaration | /**
* Ignores all items emitted by the source Observable and only passes calls of `complete` or `error`.
*
* <img src="./img/ignoreElements.png" width="100%">
*
* @return {Observable} An empty Observable that only calls `complete`
* or `error`, based on which one is called by the source Observable.
* @method ign... | IgorMinar/rxjs | src/internal/operators/ignoreElements.ts | TypeScript |
ClassDeclaration |
class IgnoreElementsOperator<T, R> implements Operator<T, R> {
call(subscriber: Subscriber<R>, source: any): any {
return source.subscribe(new IgnoreElementsSubscriber(subscriber));
}
} | IgorMinar/rxjs | src/internal/operators/ignoreElements.ts | TypeScript |
ClassDeclaration | /**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
class IgnoreElementsSubscriber<T> extends Subscriber<T> {
protected _next(unused: T): void {
// Do nothing
}
} | IgorMinar/rxjs | src/internal/operators/ignoreElements.ts | TypeScript |
MethodDeclaration |
call(subscriber: Subscriber<R>, source: any): any {
return source.subscribe(new IgnoreElementsSubscriber(subscriber));
} | IgorMinar/rxjs | src/internal/operators/ignoreElements.ts | TypeScript |
MethodDeclaration |
protected _next(unused: T): void {
// Do nothing
} | IgorMinar/rxjs | src/internal/operators/ignoreElements.ts | TypeScript |
FunctionDeclaration | /** docoment ready */
export function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) {
return new Promise((resolve) => {
if (condition.includes(document.readyState)) {
resolve(true)
}
else {
document.addEventListener('readystatechange', () => {
if (condition.in... | ConteMan/contea-desktop | src/preload/utils.ts | TypeScript |
ArrowFunction |
(resolve) => {
if (condition.includes(document.readyState)) {
resolve(true)
}
else {
document.addEventListener('readystatechange', () => {
if (condition.includes(document.readyState))
resolve(true)
})
}
} | ConteMan/contea-desktop | src/preload/utils.ts | TypeScript |
ArrowFunction |
() => {
if (condition.includes(document.readyState))
resolve(true)
} | ConteMan/contea-desktop | src/preload/utils.ts | TypeScript |
InterfaceDeclaration |
interface Window {
game: Engine;
} | tony-go/pixi-experimental | global.d.ts | TypeScript |
ArrowFunction |
({name, route_name, children}: IProps) => {
const [profileIsOpen, setProfileIsOpen] = useState(false)
const [searchQuery, setSearchQuery] = useState('')
const [searchActive, setSearchActive] = useState(false);
const {handleMobileNavToggle} = useAppContext()
const focusOnSearch = (event: KeyboardEv... | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
(event: KeyboardEvent) => {
const windowsCombination = event.ctrlKey && event.keyCode === 75
const macCombination = event.metaKey && event.keyCode === 75
if (windowsCombination || macCombination) {
setSearchActive(true)
} else if (event.key === 'Escape') {
setSea... | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
() => {
setSearchActive(false)
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
() => {
setSearchActive(true)
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
(event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.value !== '/') {
setSearchQuery(event.target.value)
}
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
(event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault()
axios.post('/logout')
.then(() => {
window.location.href = '/'
})
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
() => {
window.location.href = '/'
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
() => {
window.addEventListener("keydown", focusOnSearch)
return () => {
window.removeEventListener("keydown", focusOnSearch)
}
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
() => {
window.removeEventListener("keydown", focusOnSearch)
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
() => setProfileIsOpen(!profileIsOpen) | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
() => setProfileIsOpen(false) | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
InterfaceDeclaration |
interface IProps {
name: string
route_name: string
children: React.ReactNode,
} | roderick-martina/laravel-react-boilerplate | resources/js/Shared/NestedLayout.tsx | TypeScript |
ArrowFunction |
(vaikeväärtus: system locale) | oceancoindev/oceancoin | src/qt/locale/bitcoin_et.ts | TypeScript |
ArrowFunction |
(vaikeväärtus: 16893 või testnet: 116893) | oceancoindev/oceancoin | src/qt/locale/bitcoin_et.ts | TypeScript |
ArrowFunction |
(vaikeväärtus: 16892 või testnet: 116892) | oceancoindev/oceancoin | src/qt/locale/bitcoin_et.ts | TypeScript |
ArrowFunction |
(vaikeväärtus: 127.0.0.1) | oceancoindev/oceancoin | src/qt/locale/bitcoin_et.ts | TypeScript |
ArrowFunction |
(vaikeväärtus: 100) | oceancoindev/oceancoin | src/qt/locale/bitcoin_et.ts | TypeScript |
FunctionDeclaration |
function assert(condition: any, message: string): asserts condition {
if (!condition) throw new Error(message)
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export function simpleRolesIsAuthorized({ctx, args}: SimpleRolesIsAuthorizedArgs) {
const [roleOrRoles] = args
const $publicData = (ctx.session as SessionContext).$publicData
const publicData = $publicData as typeof $publicData & {roles: unknown}
if (!("roles" in publicData)) {
throw new Error("Session pub... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration | // const isBlitzApiRequest = (req: BlitzApiRequest | IncomingMessage): req is BlitzApiRequest => {
// return "cookies" in req
// }
function ensureBlitzApiRequest(
req: BlitzApiRequest | IncomingMessage,
): asserts req is BlitzApiRequest {
if (!("cookies" in req)) {
// Cookie parser isn't include inside getSer... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration | // const isMiddlewareApResponse = (
// res: MiddlewareResponse | ServerResponse,
// ): res is MiddlewareResponse => {
// return "blitzCtx" in res
// }
function ensureMiddlewareResponse(
res: BlitzApiResponse | ServerResponse,
): asserts res is MiddlewareResponse {
if (!("blitzCtx" in res)) {
;(res as Middle... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function getSessionContext(
req: BlitzApiRequest | IncomingMessage,
res: BlitzApiResponse | ServerResponse,
): Promise<SessionContext> {
ensureBlitzApiRequest(req)
ensureMiddlewareResponse(res)
if (res.blitzCtx.session) {
return res.blitzCtx.session as SessionContext
}
// ensureMiddlew... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration | // --------------------------------
// Get Session
// --------------------------------
export async function getSession(
req: BlitzApiRequest,
res: ServerResponse,
): Promise<SessionKernel | null> {
const anonymousSessionToken = req.cookies[COOKIE_ANONYMOUS_SESSION_TOKEN()]
const sessionToken = req.cookies[COOK... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration | // --------------------------------
// Create Session
// --------------------------------
export async function createNewSession(
req: IncomingMessage,
res: ServerResponse,
publicData: PublicData,
privateData: Record<any, any> = {},
opts: {anonymous?: boolean; jwtPayload?: JwtPayload} = {},
): Promise<Session... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function createAnonymousSession(req: IncomingMessage, res: ServerResponse) {
// TODO remove `as any` after https://github.com/blitz-js/blitz/pull/1788 merged
return await createNewSession(req, res, {userId: null, roles: []} as any, undefined, {
anonymous: true,
})
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration | // --------------------------------
// Session/DB utils
// --------------------------------
export async function refreshSession(
req: IncomingMessage,
res: ServerResponse,
sessionKernel: SessionKernel,
{publicDataChanged}: {publicDataChanged: boolean},
) {
debug("Refreshing session", sessionKernel)
if (ses... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function getAllSessionHandlesForUser(userId: string) {
return (await config.getSessions(userId)).map((session) => session.handle)
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function updateAllPublicDataRolesForUser(userId: string | number, roles: string[]) {
const sessions = await config.getSessions(userId)
for (const session of sessions) {
const publicData = JSON.stringify({
...(session.publicData ? JSON.parse(session.publicData) : {}),
roles,
})
... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function revokeSession(
req: IncomingMessage,
res: ServerResponse,
handle: string,
anonymous: boolean = false,
): Promise<void> {
debug("Revoking session", handle)
if (!anonymous) {
try {
await config.deleteSession(handle)
} catch (error) {
// Ignore any errors, like if ses... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function revokeMultipleSessions(
req: IncomingMessage,
res: ServerResponse,
sessionHandles: string[],
) {
let revoked: string[] = []
for (const handle of sessionHandles) {
await revokeSession(req, res, handle)
revoked.push(handle)
}
return revoked
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function revokeAllSessionsForUser(
req: IncomingMessage,
res: ServerResponse,
userId: string | number,
) {
let sessionHandles = (await config.getSessions(userId)).map((session) => session.handle)
return revokeMultipleSessions(req, res, sessionHandles)
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function getPublicData(sessionKernel: SessionKernel): Promise<PublicData> {
if (sessionKernel.jwtPayload?.publicData) {
return sessionKernel.jwtPayload?.publicData
} else {
const session = await config.getSession(sessionKernel.handle)
if (!session) {
throw new Error("getPublicData() ... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function getPrivateData(handle: string): Promise<Record<any, any> | null> {
const session = await config.getSession(handle)
if (session && session.privateData) {
return JSON.parse(session.privateData) as Record<any, any>
} else {
return null
}
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function setPrivateData(sessionKernel: SessionKernel, data: Record<any, any>) {
let existingPrivateData = await getPrivateData(sessionKernel.handle)
if (existingPrivateData === null) {
// Anonymous sessions may not exist in the DB yet
try {
await config.createSession({handle: sessionKern... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration |
export async function setPublicData(
req: IncomingMessage,
res: ServerResponse,
sessionKernel: SessionKernel,
data: Record<any, any>,
) {
// Don't allow updating userId
delete data.userId
const publicData: PublicData = {
...(await getPublicData(sessionKernel)),
...data,
}
await refreshSessi... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
FunctionDeclaration | /**
* Append additional header `field` with value `val`.
*
* Example:
*
* append(res, 'Set-Cookie', 'foo=bar; Path=/; HttpOnly');
*
* @param {ServerResponse} res
* @param {string} field
* @param {string| string[]} val
*/
export function append(res: ServerResponse, field: string, val: string | string[]) {
... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
() => {
const projectRoot = getProjectRoot()
const path = join(projectRoot, ".next/blitz/db.js")
// eslint-disable-next-line no-eval -- block webpack from following this module path
return eval("require")(path).default
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(handle) => getDb().session.findFirst({where: {handle}}) | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(userId) => getDb().session.findMany({where: {userId}}) | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(session) => {
let user
if (session.userId) {
user = {connect: {id: session.userId}}
}
return getDb().session.create({
data: {...session, userId: undefined, user},
})
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
async (handle, session) => {
try {
return await getDb().session.update({where: {handle}, data: session})
} catch (error) {
// Session doesn't exist in DB for some reason, so create it
if (error.code === "P2016") {
log.warning("Could not update session because it's not in the DB")
... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(handle) => getDb().session.delete({where: {handle}}) | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
() => {
throw new Error("No isAuthorized implementation provided")
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(sessionConfig: Partial<SessionConfig> = {}): Middleware => {
assert(
sessionConfig.isAuthorized,
"You must provide an authorization implementation to sessionMiddleware as isAuthorized(userRoles, input)",
)
config = {
...defaultConfig,
...sessionConfig,
} as Required<SessionConfig>
return as... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
async (req, res, next) => {
if (req.method !== "HEAD" && !res.blitzCtx.session) {
// This function also saves session to res.blitzCtx
await getSessionContext(req, res)
}
return next()
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
<T extends SessionContextClass>(ctxClass: T): T => {
return new Proxy(ctxClass, {
get(target, prop, receiver) {
if (prop in target || prop === "then") {
return Reflect.get(target, prop, receiver)
} else {
return Reflect.get(target.$publicData, prop, receiver)
}
},
})
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
() => {
return generateToken(TOKEN_LENGTH) + HANDLE_SEPARATOR + SESSION_TYPE_OPAQUE_TOKEN_SIMPLE
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
() => {
return generateToken(TOKEN_LENGTH) + HANDLE_SEPARATOR + SESSION_TYPE_ANONYMOUS_JWT
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(handle: string, publicData: PublicData | string) => {
// We store the hashed public data in the opaque token so that when we verify,
// we can detect changes in it and return a new set of tokens if necessary.
let publicDataString
if (typeof publicData === "string") {
publicDataString = publicData
} els... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(token: string) => {
const [handle, id, hashedPublicData, version] = fromBase64(token).split(TOKEN_SEPARATOR)
if (!handle || !id || !hashedPublicData || !version) {
throw new AuthenticationError("Failed to parse session token")
}
return {
handle,
id,
hashedPublicData,
version,
}
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(publicData: string | PublicData) => {
const payload = typeof publicData === "string" ? publicData : JSON.stringify(publicData)
return toBase64(payload)
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
() => generateToken(TOKEN_LENGTH) | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
() => {
if (process.env.NODE_ENV === "production") {
assert(
process.env.SESSION_SECRET_KEY,
"You must provide the SESSION_SECRET_KEY environment variable in production. This used to sign and verify tokens. It should be 32 chars long.",
)
assert(
process.env.SESSION_SECRET_KEY.length >=... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(payload: AnonymousSessionPayload) => {
return jwtSign({[JWT_NAMESPACE]: payload}, getSessionSecretKey(), {
algorithm: JWT_ALGORITHM,
issuer: JWT_ISSUER,
audience: JWT_AUDIENCE,
subject: JWT_ANONYMOUS_SUBJECT,
})
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(token: string) => {
// This must happen outside the try/catch because it could throw an error
// about a missing environment variable
const secret = getSessionSecretKey()
try {
const fullPayload = jwtVerify(token, secret, {
algorithms: [JWT_ALGORITHM],
issuer: JWT_ISSUER,
audience: JWT_... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(res: ServerResponse, cookie: string) => {
append(res, "Set-Cookie", cookie)
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(res: ServerResponse, name: string, value: string) => {
res.setHeader(name, value)
if ("_blitz" in res) {
;(res as any)._blitz[name] = value
}
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(res: ServerResponse, name: string) => {
res.removeHeader(name)
if ("_blitz" in res) {
delete (res as any)._blitz[name]
}
} | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(
req: IncomingMessage,
res: ServerResponse,
sessionToken: string,
expiresAt: Date,
) => {
setCookie(
res,
cookie.serialize(COOKIE_SESSION_TOKEN(), sessionToken, {
path: "/",
httpOnly: true,
secure:
!process.env.DISABLE_SECURE_COOKIES &&
process.env.NODE_ENV === "pro... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(
req: IncomingMessage,
res: ServerResponse,
token: string,
expiresAt: Date,
) => {
setCookie(
res,
cookie.serialize(COOKIE_ANONYMOUS_SESSION_TOKEN(), token, {
path: "/",
httpOnly: true,
secure:
!process.env.DISABLE_SECURE_COOKIES &&
process.env.NODE_ENV === "product... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(
req: IncomingMessage,
res: ServerResponse,
antiCSRFToken: string,
expiresAt: Date,
) => {
debug("setCSRFCookie", antiCSRFToken)
setCookie(
res,
cookie.serialize(COOKIE_CSRF_TOKEN(), antiCSRFToken, {
path: "/",
secure:
!process.env.DISABLE_SECURE_COOKIES &&
process.env.... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(
req: IncomingMessage,
res: ServerResponse,
publicDataToken: string,
expiresAt: Date,
) => {
setHeader(res, HEADER_PUBLIC_DATA_TOKEN, "updated")
setCookie(
res,
cookie.serialize(COOKIE_PUBLIC_DATA_TOKEN(), publicDataToken, {
path: "/",
secure:
!process.env.DISABLE_SECURE_COOKIE... | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
ArrowFunction |
(session) => session.handle | alii/blitz | packages/server/src/supertokens.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.