+1








78393a2b8b
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Co-authored-by: Leo Giovanetti <hello@leog.me> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: Efraín Rochín <roae.85@gmail.com>
219 lines
7.4 KiB
TypeScript
219 lines
7.4 KiB
TypeScript
import authedProcedure from "../../../procedures/authedProcedure";
|
|
import { router } from "../../../trpc";
|
|
import { ZActivateEventTypeInputSchema } from "./activateEventType.schema";
|
|
import { ZCreateInputSchema } from "./create.schema";
|
|
import { ZDeleteInputSchema } from "./delete.schema";
|
|
import { ZFilteredListInputSchema } from "./filteredList.schema";
|
|
import { ZGetInputSchema } from "./get.schema";
|
|
import { ZGetVerifiedNumbersInputSchema } from "./getVerifiedNumbers.schema";
|
|
import { ZListInputSchema } from "./list.schema";
|
|
import { ZSendVerificationCodeInputSchema } from "./sendVerificationCode.schema";
|
|
import { ZUpdateInputSchema } from "./update.schema";
|
|
import { ZVerifyPhoneNumberInputSchema } from "./verifyPhoneNumber.schema";
|
|
|
|
type WorkflowsRouterHandlerCache = {
|
|
list?: typeof import("./list.handler").listHandler;
|
|
get?: typeof import("./get.handler").getHandler;
|
|
create?: typeof import("./create.handler").createHandler;
|
|
delete?: typeof import("./delete.handler").deleteHandler;
|
|
update?: typeof import("./update.handler").updateHandler;
|
|
activateEventType?: typeof import("./activateEventType.handler").activateEventTypeHandler;
|
|
sendVerificationCode?: typeof import("./sendVerificationCode.handler").sendVerificationCodeHandler;
|
|
verifyPhoneNumber?: typeof import("./verifyPhoneNumber.handler").verifyPhoneNumberHandler;
|
|
getVerifiedNumbers?: typeof import("./getVerifiedNumbers.handler").getVerifiedNumbersHandler;
|
|
getWorkflowActionOptions?: typeof import("./getWorkflowActionOptions.handler").getWorkflowActionOptionsHandler;
|
|
filteredList?: typeof import("./filteredList.handler").filteredListHandler;
|
|
};
|
|
|
|
const UNSTABLE_HANDLER_CACHE: WorkflowsRouterHandlerCache = {};
|
|
|
|
export const workflowsRouter = router({
|
|
list: authedProcedure.input(ZListInputSchema).query(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.list) {
|
|
UNSTABLE_HANDLER_CACHE.list = await import("./list.handler").then((mod) => mod.listHandler);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.list) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.list({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
get: authedProcedure.input(ZGetInputSchema).query(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.get) {
|
|
UNSTABLE_HANDLER_CACHE.get = await import("./get.handler").then((mod) => mod.getHandler);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.get) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.get({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
create: authedProcedure.input(ZCreateInputSchema).mutation(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.create) {
|
|
UNSTABLE_HANDLER_CACHE.create = await import("./create.handler").then((mod) => mod.createHandler);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.create) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.create({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
delete: authedProcedure.input(ZDeleteInputSchema).mutation(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.delete) {
|
|
UNSTABLE_HANDLER_CACHE.delete = await import("./delete.handler").then((mod) => mod.deleteHandler);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.delete) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.delete({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
update: authedProcedure.input(ZUpdateInputSchema).mutation(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.update) {
|
|
UNSTABLE_HANDLER_CACHE.update = await import("./update.handler").then((mod) => mod.updateHandler);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.update) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.update({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
activateEventType: authedProcedure.input(ZActivateEventTypeInputSchema).mutation(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.activateEventType) {
|
|
UNSTABLE_HANDLER_CACHE.activateEventType = await import("./activateEventType.handler").then(
|
|
(mod) => mod.activateEventTypeHandler
|
|
);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.activateEventType) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.activateEventType({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
sendVerificationCode: authedProcedure
|
|
.input(ZSendVerificationCodeInputSchema)
|
|
.mutation(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.sendVerificationCode) {
|
|
UNSTABLE_HANDLER_CACHE.sendVerificationCode = await import("./sendVerificationCode.handler").then(
|
|
(mod) => mod.sendVerificationCodeHandler
|
|
);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.sendVerificationCode) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.sendVerificationCode({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
verifyPhoneNumber: authedProcedure.input(ZVerifyPhoneNumberInputSchema).mutation(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.verifyPhoneNumber) {
|
|
UNSTABLE_HANDLER_CACHE.verifyPhoneNumber = await import("./verifyPhoneNumber.handler").then(
|
|
(mod) => mod.verifyPhoneNumberHandler
|
|
);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.verifyPhoneNumber) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.verifyPhoneNumber({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
getVerifiedNumbers: authedProcedure.input(ZGetVerifiedNumbersInputSchema).query(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.getVerifiedNumbers) {
|
|
UNSTABLE_HANDLER_CACHE.getVerifiedNumbers = await import("./getVerifiedNumbers.handler").then(
|
|
(mod) => mod.getVerifiedNumbersHandler
|
|
);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.getVerifiedNumbers) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.getVerifiedNumbers({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
|
|
getWorkflowActionOptions: authedProcedure.query(async ({ ctx }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.getWorkflowActionOptions) {
|
|
UNSTABLE_HANDLER_CACHE.getWorkflowActionOptions = await import(
|
|
"./getWorkflowActionOptions.handler"
|
|
).then((mod) => mod.getWorkflowActionOptionsHandler);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.getWorkflowActionOptions) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.getWorkflowActionOptions({
|
|
ctx,
|
|
});
|
|
}),
|
|
filteredList: authedProcedure.input(ZFilteredListInputSchema).query(async ({ ctx, input }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.filteredList) {
|
|
UNSTABLE_HANDLER_CACHE.filteredList = await import("./filteredList.handler").then(
|
|
(mod) => mod.filteredListHandler
|
|
);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.filteredList) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.filteredList({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
});
|