everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
51 lines (49 loc) • 1.75 kB
JavaScript
//#region src/auth-types-gen.ts
const AUTH_DERIVED_TYPES_BODY = `
export type AuthSessionUser = NonNullable<InferOutput<"getSession">["user"]>;
export type AuthSessionData = NonNullable<InferOutput<"getSession">["session"]>;
export type AuthSession = {
user: AuthSessionUser | null;
session: AuthSessionData | null;
};
export type AuthRequestContext = InferOutput<"getContext">;
export type AuthPluginContext = Partial<AuthRequestContext> & {
reqHeaders?: Headers;
getRawBody?: () => Promise<string>;
};
`;
function buildAuthTypesGenContent(authExportImportPath, contractImportPath) {
return `export type * from "${authExportImportPath}";
import type { InferOutput } from "${contractImportPath}";
${AUTH_DERIVED_TYPES_BODY}
`;
}
function buildAuthExportStub() {
return `export type Auth = any;
export type AuthOrganizationContext = any;
export type AuthOrganization = any;
export type AuthOrganizationSummary = any;
export type AuthOrganizationMember = any;
export type AuthApiKey = any;
export type AuthInvitation = any;
export type AuthTeam = any;
export type GetActiveMemberInput = any;
export type GetFullOrganizationInput = any;
export type ListMembersInput = any;
export type ListInvitationsInput = any;
export type ListApiKeysInput = any;
export type AuthServices = any;
export type createAuthInstance = any;
`;
}
function buildAuthContractStub() {
return `export type ContractType = any;
export type InferOutput<_TRoute extends string> = any;
`;
}
//#endregion
exports.AUTH_DERIVED_TYPES_BODY = AUTH_DERIVED_TYPES_BODY;
exports.buildAuthContractStub = buildAuthContractStub;
exports.buildAuthExportStub = buildAuthExportStub;
exports.buildAuthTypesGenContent = buildAuthTypesGenContent;
//# sourceMappingURL=auth-types-gen.cjs.map