/opt/canhelp/node_modules/better-auth/dist/plugins/organization
Edit: /opt/canhelp/node_modules/better-auth/dist/plugins/organization/schema.d.mts (11081B)
import { FieldAttributeToObject, RemoveFieldsWithReturnedFalse } from "../../db/field.mjs";
import { OrganizationOptions } from "./types.mjs";
import { BetterAuthPluginDBSchema, DBFieldAttribute } from "@better-auth/core/db";
import { Prettify } from "better-call";
import * as z from "zod";
//#region src/plugins/organization/schema.d.ts
type InferSchema
= {
modelName: Schema[TableName] extends {
modelName: infer M;
} ? M extends string ? M : string : string;
fields: { [K in keyof DefaultFields]: DefaultFields[K] } & (Schema[TableName] extends {
additionalFields: infer F;
} ? F : {});
};
interface OrganizationRoleDefaultFields {
organizationId: {
type: "string";
required: true;
references: {
model: "organization";
field: "id";
};
};
role: {
type: "string";
required: true;
};
permission: {
type: "string";
required: true;
};
createdAt: {
type: "date";
required: true;
defaultValue: Date;
};
updatedAt: {
type: "date";
required: false;
};
}
interface TeamDefaultFields {
name: {
type: "string";
required: true;
};
organizationId: {
type: "string";
required: true;
references: {
model: "organization";
field: "id";
};
};
createdAt: {
type: "date";
required: true;
};
updatedAt: {
type: "date";
required: false;
};
}
interface TeamMemberDefaultFields {
teamId: {
type: "string";
required: true;
references: {
model: "team";
field: "id";
};
};
userId: {
type: "string";
required: true;
references: {
model: "user";
field: "id";
};
};
createdAt: {
type: "date";
required: false;
};
}
interface OrganizationDefaultFields {
name: {
type: "string";
required: true;
sortable: true;
};
slug: {
type: "string";
required: true;
unique: true;
sortable: true;
};
logo: {
type: "string";
required: false;
};
createdAt: {
type: "date";
required: true;
};
updatedAt: {
type: "date";
required: false;
};
}
interface MemberDefaultFields {
organizationId: {
type: "string";
required: true;
references: {
model: "organization";
field: "id";
};
};
userId: {
type: "string";
required: true;
references: {
model: "user";
field: "id";
};
};
role: {
type: "string";
required: true;
defaultValue: "member";
};
createdAt: {
type: "date";
required: true;
};
}
interface InvitationDefaultFields {
organizationId: {
type: "string";
required: true;
references: {
model: "organization";
field: "id";
};
};
email: {
type: "string";
required: true;
sortable: true;
};
role: {
type: "string";
required: true;
sortable: true;
};
status: {
type: "string";
required: true;
sortable: true;
defaultValue: "pending";
};
expiresAt: {
type: "date";
required: false;
};
createdAt: {
type: "date";
required: true;
defaultValue: Date;
};
inviterId: {
type: "string";
required: true;
references: {
model: "user";
field: "id";
};
};
}
interface SessionDefaultFields {
activeOrganizationId: {
type: "string";
required: false;
};
}
type OrganizationSchema = (O["dynamicAccessControl"] extends {
enabled: true;
} ? {
organizationRole: InferSchema;
} & {
session: {
fields: InferSchema["fields"];
};
} : {}) & (O["teams"] extends {
enabled: true;
} ? {
team: InferSchema;
teamMember: InferSchema;
} : {}) & {
organization: InferSchema;
member: InferSchema;
invitation: {
modelName: O["schema"] extends BetterAuthPluginDBSchema ? InferSchema["modelName"] : string;
fields: InferSchema["fields"] & (O extends {
teams: {
enabled: true;
};
} ? {
teamId: {
type: "string";
required: false;
sortable: true;
};
} : {});
};
session: {
fields: InferSchema["fields"] & (O["teams"] extends {
enabled: true;
} ? {
activeTeamId: {
type: "string";
required: false;
};
} : {});
};
};
declare const roleSchema: z.ZodString;
declare const invitationStatus: z.ZodDefault>;
declare const organizationSchema: z.ZodObject<{
id: z.ZodDefault;
name: z.ZodString;
slug: z.ZodString;
logo: z.ZodOptional>>;
metadata: z.ZodOptional, z.ZodPipe>]>>;
createdAt: z.ZodDate;
}, z.core.$strip>;
declare const memberSchema: z.ZodObject<{
id: z.ZodDefault;
organizationId: z.ZodString;
userId: z.ZodCoercedString;
role: z.ZodString;
createdAt: z.ZodDefault;
}, z.core.$strip>;
declare const invitationSchema: z.ZodObject<{
id: z.ZodDefault;
organizationId: z.ZodString;
email: z.ZodString;
role: z.ZodString;
status: z.ZodDefault>;
teamId: z.ZodOptional>;
inviterId: z.ZodString;
expiresAt: z.ZodDate;
createdAt: z.ZodDefault;
}, z.core.$strip>;
declare const teamSchema: z.ZodObject<{
id: z.ZodDefault;
name: z.ZodString;
organizationId: z.ZodString;
createdAt: z.ZodDate;
updatedAt: z.ZodOptional;
}, z.core.$strip>;
declare const teamMemberSchema: z.ZodObject<{
id: z.ZodDefault;
teamId: z.ZodString;
userId: z.ZodString;
createdAt: z.ZodDefault;
}, z.core.$strip>;
declare const organizationRoleSchema: z.ZodObject<{
id: z.ZodDefault;
organizationId: z.ZodString;
role: z.ZodString;
permission: z.ZodRecord>;
createdAt: z.ZodDefault;
updatedAt: z.ZodOptional;
}, z.core.$strip>;
type Organization = z.infer;
type Member = z.infer;
type TeamMember = z.infer;
type Team = z.infer;
type Invitation = z.infer;
type InvitationInput = z.input;
type MemberInput = z.input;
type TeamMemberInput = z.input;
type OrganizationInput = z.input;
type TeamInput = z.infer;
type OrganizationRole = z.infer;
declare const defaultRolesSchema: z.ZodUnion, z.ZodArray>]>;
type CustomRolesSchema = O extends {
roles: {
[key: string]: any;
};
} ? z.ZodType> : typeof defaultRolesSchema;
type InferOrganizationZodRolesFromOption = CustomRolesSchema;
type InferOrganizationRolesFromOption = O extends {
roles: any;
} ? keyof O["roles"] extends infer K extends string ? K : "admin" | "member" | "owner" : "admin" | "member" | "owner";
type InvitationStatus = "pending" | "accepted" | "rejected" | "canceled";
type InferAdditionalFieldsOutput = Options["schema"] extends { [key in SchemaName]?: {
additionalFields: infer Field extends Record;
} } ? isClientSide extends true ? FieldAttributeToObject> : FieldAttributeToObject : {};
type InferMember = Prettify<(O["teams"] extends {
enabled: true;
} ? {
id: string;
organizationId: string;
role: InferOrganizationRolesFromOption;
createdAt: Date;
userId: string;
teamId?: string | undefined;
user: {
id: string;
email: string;
name: string;
image?: string | undefined;
};
} : {
id: string;
organizationId: string;
role: InferOrganizationRolesFromOption;
createdAt: Date;
userId: string;
user: {
id: string;
email: string;
name: string;
image?: string | undefined;
};
}) & InferAdditionalFieldsOutput<"member", O, isClientSide>>;
type InferOrganization = Prettify>;
type InferTeam = Prettify>;
type InferInvitation = Prettify<(O["teams"] extends {
enabled: true;
} ? {
id: string;
organizationId: string;
email: string;
role: InferOrganizationRolesFromOption;
status: InvitationStatus;
inviterId: string;
expiresAt: Date;
createdAt: Date;
teamId?: string | undefined;
} : {
id: string;
organizationId: string;
email: string;
role: InferOrganizationRolesFromOption;
status: InvitationStatus;
inviterId: string;
expiresAt: Date;
createdAt: Date;
}) & InferAdditionalFieldsOutput<"invitation", O, isClientSide>>;
//#endregion
export { InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferTeam, Invitation, InvitationInput, InvitationStatus, Member, MemberInput, Organization, OrganizationInput, OrganizationRole, OrganizationSchema, Team, TeamInput, TeamMember, TeamMemberInput, defaultRolesSchema, invitationSchema, invitationStatus, memberSchema, organizationRoleSchema, organizationSchema, roleSchema, teamMemberSchema, teamSchema };
//# sourceMappingURL=schema.d.mts.map