Function: createTrpcBuilders()
function createTrpcBuilders<C extends {
auth: {
api: {
getSession: (input: {
headers: Headers;
}) => Promise<
| {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| null>;
};
};
db: PrismaClient<PrismaClientOptions, never, DefaultArgs>;
organization: | {
createdAt: Date;
createdBy: string | null;
deletedAt: Date | null;
deletedBy: string | null;
id: string;
logo: string | null;
metadata: JsonValue;
name: string;
slug: string;
updatedAt: Date;
updatedBy: string | null;
}
| null;
session: | {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| null;
} = {
auth: Auth<{
account: | {
accountLinking: | {
enabled: boolean | undefined;
}
| undefined;
}
| undefined;
advanced: {
database: {
generateId: false;
};
};
baseURL: string;
database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
emailAndPassword: | {
enabled: true;
password: PasswordHashingConfig;
requireEmailVerification: boolean;
sendResetPassword: | ((args: {
token: string;
url: string;
user: {
email: string;
id: string;
};
}) => Promise<void>)
| undefined;
}
| {
enabled: false;
password?: undefined;
requireEmailVerification?: undefined;
sendResetPassword?: undefined;
};
emailVerification: | {
sendVerificationEmail: (args: {
token: string;
url: string;
user: {
email: string;
id: string;
};
}) => Promise<void>;
}
| undefined;
plugins: BetterAuthPlugin[];
secret: string;
session: | {
disableSessionRefresh: boolean | undefined;
expiresIn: number | undefined;
}
| undefined;
socialProviders: | Record<string, {
clientId: string;
clientSecret: string;
scope?: string[];
}>
| undefined;
trustedOrigins: | string[]
| ((request?: Request) => Promise<(string | null | undefined)[]>)
| undefined;
}> & {
extendWith: Auth<{
account: | {
accountLinking: | {
enabled: boolean | undefined;
}
| undefined;
}
| undefined;
advanced: {
database: {
generateId: false;
};
};
baseURL: string;
database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
emailAndPassword: | {
enabled: true;
password: PasswordHashingConfig;
requireEmailVerification: boolean;
sendResetPassword: | ((args: {
token: string;
url: string;
user: {
email: ...;
id: ...;
};
}) => Promise<void>)
| undefined;
}
| {
enabled: false;
password?: undefined;
requireEmailVerification?: undefined;
sendResetPassword?: undefined;
};
emailVerification: | {
sendVerificationEmail: (args: {
token: string;
url: string;
user: {
email: string;
id: string;
};
}) => Promise<void>;
}
| undefined;
plugins: (BetterAuthPlugin | P)[];
secret: string;
session: | {
disableSessionRefresh: boolean | undefined;
expiresIn: number | undefined;
}
| undefined;
socialProviders: | Record<string, {
clientId: string;
clientSecret: string;
scope?: string[];
}>
| undefined;
trustedOrigins: | string[]
| ((request?: Request) => Promise<(string | null | undefined)[]>)
| undefined;
}>;
} & {
api: {
getSession: (input: {
headers: Headers;
}) => Promise<
| {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| null>;
};
};
db: PrismaClient<PrismaClientOptions, never, DefaultArgs>;
organization: | {
createdAt: Date;
createdBy: string | null;
deletedAt: Date | null;
deletedBy: string | null;
id: string;
logo: string | null;
metadata: JsonValue;
name: string;
slug: string;
updatedAt: Date;
updatedBy: string | null;
}
| null;
session: | {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
}
| null;
}>(): {
t: TRPCRootObject<C extends ContextCallback ? Unwrap<C> : C, object, {
errorFormatter: (__namedParameters: {
ctx: C extends ContextCallback ? Unwrap<C> : C | undefined;
error: TRPCError;
input: unknown;
path: string | undefined;
shape: DefaultErrorShape;
type: "unknown" | "query" | "mutation" | "subscription";
}) => {
code: TRPC_ERROR_CODE_NUMBER;
data: {
code: | "FORBIDDEN"
| "PARSE_ERROR"
| "BAD_REQUEST"
| "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED"
| "BAD_GATEWAY"
| "SERVICE_UNAVAILABLE"
| "GATEWAY_TIMEOUT"
| "UNAUTHORIZED"
| "PAYMENT_REQUIRED"
| "NOT_FOUND"
| "METHOD_NOT_SUPPORTED"
| "TIMEOUT"
| "CONFLICT"
| "PRECONDITION_FAILED"
| "PAYLOAD_TOO_LARGE"
| "UNSUPPORTED_MEDIA_TYPE"
| "UNPROCESSABLE_CONTENT"
| "PRECONDITION_REQUIRED"
| "TOO_MANY_REQUESTS"
| "CLIENT_CLOSED_REQUEST"
| undefined;
httpStatus: number;
path?: string;
stack?: string;
};
message: string;
};
}, {
ctx: C extends ContextCallback ? Unwrap<C> : C;
errorShape: {
code: TRPC_ERROR_CODE_NUMBER;
data: {
code: | "FORBIDDEN"
| "PARSE_ERROR"
| "BAD_REQUEST"
| "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED"
| "BAD_GATEWAY"
| "SERVICE_UNAVAILABLE"
| "GATEWAY_TIMEOUT"
| "UNAUTHORIZED"
| "PAYMENT_REQUIRED"
| "NOT_FOUND"
| "METHOD_NOT_SUPPORTED"
| "TIMEOUT"
| "CONFLICT"
| "PRECONDITION_FAILED"
| "PAYLOAD_TOO_LARGE"
| "UNSUPPORTED_MEDIA_TYPE"
| "UNPROCESSABLE_CONTENT"
| "PRECONDITION_REQUIRED"
| "TOO_MANY_REQUESTS"
| "CLIENT_CLOSED_REQUEST"
| undefined;
httpStatus: number;
path?: string;
stack?: string;
};
message: string;
};
meta: object;
transformer: false;
}>;
tAuthed: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, Overwrite<object, Simplify<C extends ContextCallback ? Unwrap<C> : C extends object ? { [K in string | number | symbol]: K extends never ? object[K] : K extends keyof ((...) extends (...) ? (...) : (...)) ? ((...) & (...))[K] : never } : object> & {
session: {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
user: NonNullable<C["session"]>["user"];
}>, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
tBase: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
tOrgScoped: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, Overwrite<Overwrite<object, Simplify<C extends ContextCallback ? Unwrap<C> : C extends object ? { [K in string | number | symbol]: K extends never ? object[K] : K extends keyof (...) ? (...)[(...)] : never } : object> & {
session: {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
user: NonNullable<C["session"]>["user"];
}>, Simplify<Overwrite<C extends ContextCallback ? Unwrap<C> : C, Overwrite<object, Simplify<... extends ... ? ... : ... extends object ? { [K in (...)]: (...) } : object> & {
session: {
session: {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
user: NonNullable<...>["user"];
}>>> & {
organization: {
createdAt: Date;
createdBy: string | null;
deletedAt: Date | null;
deletedBy: string | null;
id: string;
logo: string | null;
metadata: JsonValue;
name: string;
slug: string;
updatedAt: Date;
updatedBy: string | null;
};
}>, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
};Defined in: server/auth/next/trpc.ts:91
Type Parameters
| Type Parameter | Default type |
|---|---|
C extends { auth: { api: { getSession: (input: { headers: Headers; }) => Promise< | { session: { createdAt: Date; expiresAt: Date; id: string; ipAddress?: string | null; token: string; updatedAt: Date; userAgent?: string | null; userId: string; }; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | null>; }; }; db: PrismaClient<PrismaClientOptions, never, DefaultArgs>; organization: | { createdAt: Date; createdBy: string | null; deletedAt: Date | null; deletedBy: string | null; id: string; logo: string | null; metadata: JsonValue; name: string; slug: string; updatedAt: Date; updatedBy: string | null; } | null; session: | { session: { createdAt: Date; expiresAt: Date; id: string; ipAddress?: string | null; token: string; updatedAt: Date; userAgent?: string | null; userId: string; }; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | null; } | { auth: Auth<{ account: | { accountLinking: | { enabled: boolean | undefined; } | undefined; } | undefined; advanced: { database: { generateId: false; }; }; baseURL: string; database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>; emailAndPassword: | { enabled: true; password: PasswordHashingConfig; requireEmailVerification: boolean; sendResetPassword: | ((args: { token: string; url: string; user: { email: string; id: string; }; }) => Promise<void>) | undefined; } | { enabled: false; password?: undefined; requireEmailVerification?: undefined; sendResetPassword?: undefined; }; emailVerification: | { sendVerificationEmail: (args: { token: string; url: string; user: { email: string; id: string; }; }) => Promise<void>; } | undefined; plugins: BetterAuthPlugin[]; secret: string; session: | { disableSessionRefresh: boolean | undefined; expiresIn: number | undefined; } | undefined; socialProviders: | Record<string, { clientId: string; clientSecret: string; scope?: string[]; }> | undefined; trustedOrigins: | string[] | ((request?: Request) => Promise<(string | null | undefined)[]>) | undefined; }> & { extendWith: Auth<{ account: | { accountLinking: | { enabled: boolean | undefined; } | undefined; } | undefined; advanced: { database: { generateId: false; }; }; baseURL: string; database: (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>; emailAndPassword: | { enabled: true; password: PasswordHashingConfig; requireEmailVerification: boolean; sendResetPassword: | ((args: { token: string; url: string; user: { email: ...; id: ...; }; }) => Promise<void>) | undefined; } | { enabled: false; password?: undefined; requireEmailVerification?: undefined; sendResetPassword?: undefined; }; emailVerification: | { sendVerificationEmail: (args: { token: string; url: string; user: { email: string; id: string; }; }) => Promise<void>; } | undefined; plugins: (BetterAuthPlugin | P)[]; secret: string; session: | { disableSessionRefresh: boolean | undefined; expiresIn: number | undefined; } | undefined; socialProviders: | Record<string, { clientId: string; clientSecret: string; scope?: string[]; }> | undefined; trustedOrigins: | string[] | ((request?: Request) => Promise<(string | null | undefined)[]>) | undefined; }>; } & { api: { getSession: (input: { headers: Headers; }) => Promise< | { session: { createdAt: Date; expiresAt: Date; id: string; ipAddress?: string | null; token: string; updatedAt: Date; userAgent?: string | null; userId: string; }; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | null>; }; }; db: PrismaClient<PrismaClientOptions, never, DefaultArgs>; organization: | { createdAt: Date; createdBy: string | null; deletedAt: Date | null; deletedBy: string | null; id: string; logo: string | null; metadata: JsonValue; name: string; slug: string; updatedAt: Date; updatedBy: string | null; } | null; session: | { session: { createdAt: Date; expiresAt: Date; id: string; ipAddress?: string | null; token: string; updatedAt: Date; userAgent?: string | null; userId: string; }; user: { createdAt: Date; email: string; emailVerified: boolean; id: string; image?: string | null; name: string; updatedAt: Date; }; } | null; } |
Returns
{
t: TRPCRootObject<C extends ContextCallback ? Unwrap<C> : C, object, {
errorFormatter: (__namedParameters: {
ctx: C extends ContextCallback ? Unwrap<C> : C | undefined;
error: TRPCError;
input: unknown;
path: string | undefined;
shape: DefaultErrorShape;
type: "unknown" | "query" | "mutation" | "subscription";
}) => {
code: TRPC_ERROR_CODE_NUMBER;
data: {
code: | "FORBIDDEN"
| "PARSE_ERROR"
| "BAD_REQUEST"
| "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED"
| "BAD_GATEWAY"
| "SERVICE_UNAVAILABLE"
| "GATEWAY_TIMEOUT"
| "UNAUTHORIZED"
| "PAYMENT_REQUIRED"
| "NOT_FOUND"
| "METHOD_NOT_SUPPORTED"
| "TIMEOUT"
| "CONFLICT"
| "PRECONDITION_FAILED"
| "PAYLOAD_TOO_LARGE"
| "UNSUPPORTED_MEDIA_TYPE"
| "UNPROCESSABLE_CONTENT"
| "PRECONDITION_REQUIRED"
| "TOO_MANY_REQUESTS"
| "CLIENT_CLOSED_REQUEST"
| undefined;
httpStatus: number;
path?: string;
stack?: string;
};
message: string;
};
}, {
ctx: C extends ContextCallback ? Unwrap<C> : C;
errorShape: {
code: TRPC_ERROR_CODE_NUMBER;
data: {
code: | "FORBIDDEN"
| "PARSE_ERROR"
| "BAD_REQUEST"
| "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED"
| "BAD_GATEWAY"
| "SERVICE_UNAVAILABLE"
| "GATEWAY_TIMEOUT"
| "UNAUTHORIZED"
| "PAYMENT_REQUIRED"
| "NOT_FOUND"
| "METHOD_NOT_SUPPORTED"
| "TIMEOUT"
| "CONFLICT"
| "PRECONDITION_FAILED"
| "PAYLOAD_TOO_LARGE"
| "UNSUPPORTED_MEDIA_TYPE"
| "UNPROCESSABLE_CONTENT"
| "PRECONDITION_REQUIRED"
| "TOO_MANY_REQUESTS"
| "CLIENT_CLOSED_REQUEST"
| undefined;
httpStatus: number;
path?: string;
stack?: string;
};
message: string;
};
meta: object;
transformer: false;
}>;
tAuthed: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, Overwrite<object, Simplify<C extends ContextCallback ? Unwrap<C> : C extends object ? { [K in string | number | symbol]: K extends never ? object[K] : K extends keyof ((...) extends (...) ? (...) : (...)) ? ((...) & (...))[K] : never } : object> & {
session: {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
user: NonNullable<C["session"]>["user"];
}>, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
tBase: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
tOrgScoped: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, Overwrite<Overwrite<object, Simplify<C extends ContextCallback ? Unwrap<C> : C extends object ? { [K in string | number | symbol]: K extends never ? object[K] : K extends keyof (...) ? (...)[(...)] : never } : object> & {
session: {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
user: NonNullable<C["session"]>["user"];
}>, Simplify<Overwrite<C extends ContextCallback ? Unwrap<C> : C, Overwrite<object, Simplify<... extends ... ? ... : ... extends object ? { [K in (...)]: (...) } : object> & {
session: {
session: {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
user: NonNullable<...>["user"];
}>>> & {
organization: {
createdAt: Date;
createdBy: string | null;
deletedAt: Date | null;
deletedBy: string | null;
id: string;
logo: string | null;
metadata: JsonValue;
name: string;
slug: string;
updatedAt: Date;
updatedBy: string | null;
};
}>, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
}t
t: TRPCRootObject<C extends ContextCallback ? Unwrap<C> : C, object, {
errorFormatter: (__namedParameters: {
ctx: C extends ContextCallback ? Unwrap<C> : C | undefined;
error: TRPCError;
input: unknown;
path: string | undefined;
shape: DefaultErrorShape;
type: "unknown" | "query" | "mutation" | "subscription";
}) => {
code: TRPC_ERROR_CODE_NUMBER;
data: {
code: | "FORBIDDEN"
| "PARSE_ERROR"
| "BAD_REQUEST"
| "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED"
| "BAD_GATEWAY"
| "SERVICE_UNAVAILABLE"
| "GATEWAY_TIMEOUT"
| "UNAUTHORIZED"
| "PAYMENT_REQUIRED"
| "NOT_FOUND"
| "METHOD_NOT_SUPPORTED"
| "TIMEOUT"
| "CONFLICT"
| "PRECONDITION_FAILED"
| "PAYLOAD_TOO_LARGE"
| "UNSUPPORTED_MEDIA_TYPE"
| "UNPROCESSABLE_CONTENT"
| "PRECONDITION_REQUIRED"
| "TOO_MANY_REQUESTS"
| "CLIENT_CLOSED_REQUEST"
| undefined;
httpStatus: number;
path?: string;
stack?: string;
};
message: string;
};
}, {
ctx: C extends ContextCallback ? Unwrap<C> : C;
errorShape: {
code: TRPC_ERROR_CODE_NUMBER;
data: {
code: | "FORBIDDEN"
| "PARSE_ERROR"
| "BAD_REQUEST"
| "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED"
| "BAD_GATEWAY"
| "SERVICE_UNAVAILABLE"
| "GATEWAY_TIMEOUT"
| "UNAUTHORIZED"
| "PAYMENT_REQUIRED"
| "NOT_FOUND"
| "METHOD_NOT_SUPPORTED"
| "TIMEOUT"
| "CONFLICT"
| "PRECONDITION_FAILED"
| "PAYLOAD_TOO_LARGE"
| "UNSUPPORTED_MEDIA_TYPE"
| "UNPROCESSABLE_CONTENT"
| "PRECONDITION_REQUIRED"
| "TOO_MANY_REQUESTS"
| "CLIENT_CLOSED_REQUEST"
| undefined;
httpStatus: number;
path?: string;
stack?: string;
};
message: string;
};
meta: object;
transformer: false;
}>;tAuthed
tAuthed: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, Overwrite<object, Simplify<C extends ContextCallback ? Unwrap<C> : C extends object ? { [K in string | number | symbol]: K extends never ? object[K] : K extends keyof ((...) extends (...) ? (...) : (...)) ? ((...) & (...))[K] : never } : object> & {
session: {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
user: NonNullable<C["session"]>["user"];
}>, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;tBase
tBase: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;tOrgScoped
tOrgScoped: ProcedureBuilder<C extends ContextCallback ? Unwrap<C> : C, object, Overwrite<Overwrite<object, Simplify<C extends ContextCallback ? Unwrap<C> : C extends object ? { [K in string | number | symbol]: K extends never ? object[K] : K extends keyof (...) ? (...)[(...)] : never } : object> & {
session: {
session: {
createdAt: Date;
expiresAt: Date;
id: string;
ipAddress?: string | null;
token: string;
updatedAt: Date;
userAgent?: string | null;
userId: string;
};
user: {
createdAt: Date;
email: string;
emailVerified: boolean;
id: string;
image?: string | null;
name: string;
updatedAt: Date;
};
};
user: NonNullable<C["session"]>["user"];
}>, Simplify<Overwrite<C extends ContextCallback ? Unwrap<C> : C, Overwrite<object, Simplify<... extends ... ? ... : ... extends object ? { [K in (...)]: (...) } : object> & {
session: {
session: {
createdAt: ...;
expiresAt: ...;
id: ...;
ipAddress?: ...;
token: ...;
updatedAt: ...;
userAgent?: ...;
userId: ...;
};
user: {
createdAt: ...;
email: ...;
emailVerified: ...;
id: ...;
image?: ...;
name: ...;
updatedAt: ...;
};
};
user: NonNullable<...>["user"];
}>>> & {
organization: {
createdAt: Date;
createdBy: string | null;
deletedAt: Date | null;
deletedBy: string | null;
id: string;
logo: string | null;
metadata: JsonValue;
name: string;
slug: string;
updatedAt: Date;
updatedBy: string | null;
};
}>, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;