fix: build

This commit is contained in:
Dhruwang
2025-11-14 11:50:55 +05:30
parent 31f02aa53c
commit a4563819eb
90 changed files with 138 additions and 101 deletions

View File

@@ -78,10 +78,7 @@ export const createResponseWithQuotaEvaluation = async (
return txResponse;
};
export const createResponse = async (
responseInput: TResponseInput,
tx: Prisma.TransactionClient
): Promise<TResponse> => {
export const createResponse = async (responseInput: TResponseInput, tx: any): Promise<TResponse> => {
validateInputs([responseInput, ZResponseInput]);
captureTelemetry("response created");

View File

@@ -16,7 +16,7 @@ export const GET = withV1ApiWrapper({
(permission) => permission.environmentId
);
const actionClasses = await getActionClasses(environmentIds);
const actionClasses = await getActionClasses(environmentIds as string[]);
return {
response: responses.successResponse(actionClasses),

View File

@@ -88,10 +88,9 @@ export const createResponseWithQuotaEvaluation = async (
return txResponse;
};
export const createResponse = async (
responseInput: TResponseInput,
tx?: Prisma.TransactionClient
): Promise<TResponse> => {
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export const createResponse = async (responseInput: TResponseInput, tx?: any): Promise<TResponse> => {
validateInputs([responseInput, ZResponseInput]);
captureTelemetry("response created");

View File

@@ -49,7 +49,11 @@ export const GET = withV1ApiWrapper({
const environmentIds = authentication.environmentPermissions.map(
(permission) => permission.environmentId
);
const environmentResponses = await getResponsesByEnvironmentIds(environmentIds, limit, offset);
const environmentResponses = await getResponsesByEnvironmentIds(
environmentIds as string[],
limit,
offset
);
allResponses.push(...environmentResponses);
}
return {

View File

@@ -27,7 +27,7 @@ export const GET = withV1ApiWrapper({
const environmentIds = authentication.environmentPermissions.map(
(permission) => permission.environmentId
);
const surveys = await getSurveys(environmentIds, limit, offset);
const surveys = await getSurveys(environmentIds as string[], limit, offset);
return {
response: responses.successResponse(surveys),

View File

@@ -13,7 +13,7 @@ export const GET = withV1ApiWrapper({
const environmentIds = authentication.environmentPermissions.map(
(permission) => permission.environmentId
);
const webhooks = await getWebhooks(environmentIds);
const webhooks = await getWebhooks(environmentIds as string[]);
return {
response: responses.successResponse(webhooks),
};

View File

@@ -86,10 +86,9 @@ const buildPrismaResponseData = (
};
};
export const createResponse = async (
responseInput: TResponseInputV2,
tx?: Prisma.TransactionClient
): Promise<TResponse> => {
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export const createResponse = async (responseInput: TResponseInputV2, tx?: any): Promise<TResponse> => {
validateInputs([responseInput, ZResponseInput]);
captureTelemetry("response created");

View File

@@ -25,6 +25,10 @@ export type TApiV1Authentication = TAuthenticationApiKey | Session | null;
export type TApiKeyAuthentication = TAuthenticationApiKey | null;
export type TSessionAuthentication = Session | null;
// Helper type to properly narrow NonNullable<TApiKeyAuthentication> to TAuthenticationApiKey
// This ensures TypeScript properly infers nested properties like environmentPermissions
export type TNonNullableApiKeyAuthentication = NonNullable<TApiKeyAuthentication> & TAuthenticationApiKey;
// Interface for handler function parameters
export interface THandlerParams<TProps = unknown> {
req?: NextRequest;
@@ -272,6 +276,15 @@ const getRouteType = (
*
*/
export const withV1ApiWrapper: {
// More specific overload for TAuthenticationApiKey (non-null) - must come first for proper type inference
<TResult extends { response: Response }, TProps = unknown>(
params: TWithV1ApiWrapperParams<TResult, TProps> & {
handler: (
params: THandlerParams<TProps> & { authentication: TAuthenticationApiKey }
) => Promise<TResult>;
}
): (req: NextRequest, props: TProps) => Promise<Response>;
<TResult extends { response: Response }, TProps = unknown>(
params: TWithV1ApiWrapperParams<TResult, TProps> & {
handler: (

View File

@@ -42,7 +42,9 @@ export const getDisplayCountBySurveyId = reactCache(
}
);
export const deleteDisplay = async (displayId: string, tx?: Prisma.TransactionClient): Promise<TDisplay> => {
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export const deleteDisplay = async (displayId: string, tx?: any): Promise<TDisplay> => {
validateInputs([displayId, ZId]);
try {
const prismaClient = tx ?? prisma;

View File

@@ -480,10 +480,12 @@ export const getResponsesByEnvironmentId = reactCache(
}
);
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export const updateResponse = async (
responseId: string,
responseInput: TResponseUpdateInput,
tx?: Prisma.TransactionClient
tx?: any
): Promise<TResponse> => {
validateInputs([responseId, ZId], [responseInput, ZResponseUpdateInput]);
try {

View File

@@ -32,7 +32,9 @@ export const GET = async (request: NextRequest) =>
}
environmentIds = [query.environmentId];
} else {
environmentIds = authentication.environmentPermissions.map((permission) => permission.environmentId);
environmentIds = authentication.environmentPermissions.map(
(permission) => permission.environmentId
) as string[];
}
const res = await getContactAttributeKeys(environmentIds, query);

View File

@@ -128,10 +128,12 @@ export const deleteResponse = async (responseId: string): Promise<Result<Respons
}
};
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export const updateResponse = async (
responseId: string,
responseInput: z.infer<typeof ZResponseUpdateSchema>,
tx?: Prisma.TransactionClient
tx?: any
): Promise<Result<Response, ApiErrorResponseV2>> => {
try {
const prismaClient = tx ?? prisma;

View File

@@ -46,10 +46,12 @@ export const getResponses = async (
}
};
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export const createResponse = async (
environmentId: string,
responseInput: TResponseInput,
tx?: Prisma.TransactionClient
tx?: any
): Promise<Result<Response, ApiErrorResponseV2>> => {
captureTelemetry("response created");

View File

@@ -35,7 +35,7 @@ export const GET = async (request: NextRequest) =>
);
const environmentResponses: Response[] = [];
const res = await getResponses(environmentIds, query);
const res = await getResponses(environmentIds as string[], query);
if (!res.ok) {
return handleApiError(request, res.error);

View File

@@ -27,7 +27,7 @@ export const GET = async (request: NextRequest) =>
(permission) => permission.environmentId
);
const res = await getWebhooks(environemntIds, query);
const res = await getWebhooks(environemntIds as string[], query);
if (res.ok) {
return responses.successResponse(res.data);

View File

@@ -25,7 +25,7 @@ export const GET = withV1ApiWrapper({
(permission) => permission.environmentId
);
const contactAttributeKeys = await getContactAttributeKeys(environmentIds);
const contactAttributeKeys = await getContactAttributeKeys(environmentIds as string[]);
return {
response: responses.successResponse(contactAttributeKeys),

View File

@@ -20,7 +20,7 @@ export const GET = withV1ApiWrapper({
(permission) => permission.environmentId
);
const attributes = await getContactAttributes(environmentIds);
const attributes = await getContactAttributes(environmentIds as string[]);
return {
response: responses.successResponse(attributes),
};

View File

@@ -1,11 +1,12 @@
import { TAuthenticationApiKey } from "@formbricks/types/auth";
import { DatabaseError } from "@formbricks/types/errors";
import { responses } from "@/app/lib/api/response";
import { TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging";
import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging";
import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils";
import { getContacts } from "./lib/contacts";
export const GET = withV1ApiWrapper({
handler: async ({ authentication }: { authentication: NonNullable<TApiKeyAuthentication> }) => {
handler: async ({ authentication }: { authentication: TAuthenticationApiKey }) => {
try {
const isContactsEnabled = await getIsContactsEnabled();
if (!isContactsEnabled) {
@@ -18,7 +19,7 @@ export const GET = withV1ApiWrapper({
const environmentIds = authentication.environmentPermissions.map(
(permission) => permission.environmentId
);
) as string[];
const contacts = await getContacts(environmentIds);

View File

@@ -1,7 +1,7 @@
"use client";
import { useTranslation } from "react-i18next";
import { Language } from "@formbricks/database/generated/client";
import { Language } from "@formbricks/database/generated/browser";
import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils";
import { DefaultTag } from "@/modules/ui/components/default-tag";
import { Label } from "@/modules/ui/components/label";

View File

@@ -6,7 +6,7 @@ import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Language } from "@formbricks/database/generated/client";
import { Language } from "@formbricks/database/generated/browser";
import { iso639Languages } from "@formbricks/i18n-utils/src/utils";
import type { TProject } from "@formbricks/types/project";
import { TUserLocale } from "@formbricks/types/user";

View File

@@ -1,7 +1,7 @@
"use client";
import { useTranslation } from "react-i18next";
import { Language } from "@formbricks/database/generated/client";
import { Language } from "@formbricks/database/generated/browser";
import { TUserLocale } from "@formbricks/types/user";
import { Button } from "@/modules/ui/components/button";
import { Input } from "@/modules/ui/components/input";

View File

@@ -3,7 +3,7 @@
import { ChevronDown } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Language } from "@formbricks/database/generated/client";
import { Language } from "@formbricks/database/generated/browser";
import { TIso639Language, iso639Languages } from "@formbricks/i18n-utils/src/utils";
import { TUserLocale } from "@formbricks/types/user";
import { useClickOutside } from "@/lib/utils/hooks/useClickOutside";

View File

@@ -1,7 +1,7 @@
"use client";
import { useTranslation } from "react-i18next";
import { Language } from "@formbricks/database/generated/client";
import { Language } from "@formbricks/database/generated/browser";
import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils";
import type { TUserLocale } from "@formbricks/types/user";
import { Label } from "@/modules/ui/components/label";

View File

@@ -7,7 +7,7 @@ import Link from "next/link";
import type { FC } from "react";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Language } from "@formbricks/database/generated/client";
import { Language } from "@formbricks/database/generated/browser";
import type { TSurvey, TSurveyLanguage, TSurveyQuestionId } from "@formbricks/types/surveys/types";
import { TUserLocale } from "@formbricks/types/user";
import { cn } from "@/lib/cn";

View File

@@ -1,7 +1,7 @@
"use client";
import { useTranslation } from "react-i18next";
import { Language } from "@formbricks/database/generated/client";
import { Language } from "@formbricks/database/generated/browser";
import type { TSurvey, TSurveyQuestionId } from "@formbricks/types/surveys/types";
import { TUserLocale } from "@formbricks/types/user";
import { LanguageToggle } from "./language-toggle";

View File

@@ -1,12 +1,14 @@
import "server-only";
import { prisma } from "@formbricks/database";
import { Prisma, Response } from "@formbricks/database/generated/client";
import { Response } from "@formbricks/database/generated/client";
import { logger } from "@formbricks/logger";
import { TSurveyQuota } from "@formbricks/types/quota";
import { getSurvey } from "@/lib/survey/service";
import { getQuotas } from "./quotas";
import { evaluateQuotas, handleQuotas } from "./utils";
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export interface QuotaEvaluationInput {
surveyId: string;
responseId: string;
@@ -14,7 +16,7 @@ export interface QuotaEvaluationInput {
responseFinished: boolean;
variables?: Response["variables"];
language?: string;
tx?: Prisma.TransactionClient;
tx?: any;
}
export interface QuotaEvaluationResult {

View File

@@ -110,7 +110,9 @@ export const deleteQuota = async (quotaId: string): Promise<TSurveyQuota> => {
}
};
export const reduceQuotaLimits = async (quotaIds: string[], tx?: Prisma.TransactionClient): Promise<void> => {
// Use any for transaction client to avoid dist/src type mismatch in TypeScript
// Runtime behavior is correct, this is purely a type resolution issue
export const reduceQuotaLimits = async (quotaIds: string[], tx?: any): Promise<void> => {
try {
const prismaClient = tx ?? prisma;
await prismaClient.surveyQuota.updateMany({

View File

@@ -59,7 +59,7 @@ export const upsertResponseQuotaLinks = async (
fullQuota: TSurveyQuota[],
otherQuota: TSurveyQuota[],
failedQuotas: TSurveyQuota[],
tx: Prisma.TransactionClient
tx: any
): Promise<void> => {
// remove records for quotas that failed
await tx.responseQuotaLink.deleteMany({

View File

@@ -1,4 +1,4 @@
import { ProjectTeamPermission, TeamUserRole } from "@formbricks/database/generated/client";
import { ProjectTeamPermission, TeamUserRole } from "@formbricks/database/generated/browser";
export const TeamPermissionMapping = {
[ProjectTeamPermission.read]: "Read",

View File

@@ -7,7 +7,7 @@ import { useState } from "react";
import { useForm } from "react-hook-form";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { PipelineTriggers } from "@formbricks/database/generated/client";
import { PipelineTriggers } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { getFormattedErrorMessage } from "@/lib/utils/helper";
import { SurveyCheckboxGroup } from "@/modules/integrations/webhooks/components/survey-checkbox-group";

View File

@@ -2,7 +2,7 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { PipelineTriggers } from "@formbricks/database/generated/client";
import { PipelineTriggers } from "@formbricks/database/generated/browser";
import { Checkbox } from "@/modules/ui/components/checkbox";
interface TriggerCheckboxGroupProps {

View File

@@ -3,7 +3,7 @@
import { WebhookIcon } from "lucide-react";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Webhook } from "@formbricks/database/generated/client";
import { Webhook } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { WebhookOverviewTab } from "@/modules/integrations/webhooks/components/webhook-overview-tab";
import { WebhookSettingsTab } from "@/modules/integrations/webhooks/components/webhook-settings-tab";

View File

@@ -2,7 +2,7 @@
import { TFunction } from "i18next";
import { useTranslation } from "react-i18next";
import { Webhook } from "@formbricks/database/generated/client";
import { Webhook } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { convertDateTimeStringShort } from "@/lib/time";
import { Label } from "@/modules/ui/components/label";

View File

@@ -2,7 +2,7 @@
import { TFunction } from "i18next";
import { useTranslation } from "react-i18next";
import { Webhook } from "@formbricks/database/generated/client";
import { Webhook } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { TUserLocale } from "@formbricks/types/user";
import { timeSince } from "@/lib/time";

View File

@@ -8,7 +8,7 @@ import { useState } from "react";
import { useForm } from "react-hook-form";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { PipelineTriggers, Webhook } from "@formbricks/database/generated/client";
import { PipelineTriggers, Webhook } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { getFormattedErrorMessage } from "@/lib/utils/helper";
import { SurveyCheckboxGroup } from "@/modules/integrations/webhooks/components/survey-checkbox-group";

View File

@@ -2,7 +2,7 @@
import { type JSX, useState } from "react";
import { useTranslation } from "react-i18next";
import { Webhook } from "@formbricks/database/generated/client";
import { Webhook } from "@formbricks/database/generated/browser";
import { TEnvironment } from "@formbricks/types/environment";
import { TSurvey } from "@formbricks/types/surveys/types";
import { WebhookModal } from "@/modules/integrations/webhooks/components/webhook-detail-modal";

View File

@@ -5,7 +5,7 @@ import { useState } from "react";
import { useForm } from "react-hook-form";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { ApiKeyPermission } from "@formbricks/database/generated/client";
import { ApiKeyPermission } from "@formbricks/database/generated/enums";
import { TOrganizationAccess } from "@formbricks/types/api-key";
import { TOrganizationProject } from "@/modules/organization/settings/api-keys/types/api-keys";
import { Alert, AlertTitle } from "@/modules/ui/components/alert";

View File

@@ -4,7 +4,7 @@ import { FilesIcon, TrashIcon } from "lucide-react";
import { useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { ApiKeyPermission } from "@formbricks/database/generated/client";
import { ApiKeyPermission } from "@formbricks/database/generated/enums";
import { TOrganizationAccess } from "@formbricks/types/api-key";
import { TUserLocale } from "@formbricks/types/user";
import { timeSince } from "@/lib/time";

View File

@@ -1,5 +1,6 @@
import { z } from "zod";
import { ApiKey, ApiKeyPermission } from "@formbricks/database/generated/client";
import { ApiKey } from "@formbricks/database/generated/browser";
import { ApiKeyPermission } from "@formbricks/database/generated/enums";
import { ZApiKey, ZApiKeyEnvironment } from "@formbricks/database/zod/api-keys";
import { ZOrganizationAccess } from "@formbricks/types/api-key";
import { ZEnvironment } from "@formbricks/types/environment";

View File

@@ -6,7 +6,7 @@ import { useRouter } from "next/navigation";
import { FormProvider, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { z } from "zod";
import { OrganizationRole } from "@formbricks/database/generated/client";
import { OrganizationRole } from "@formbricks/database/generated/browser";
import { TOrganizationRole, ZOrganizationRole } from "@formbricks/types/memberships";
import { ZUserName } from "@formbricks/types/user";
import { AddMemberRole } from "@/modules/ee/role-management/components/add-member-role";

View File

@@ -1,5 +1,5 @@
import { z } from "zod";
import { Invite } from "@formbricks/database/generated/client";
import { Invite } from "@formbricks/database/generated/browser";
import { ZInvite } from "@formbricks/database/zod/invites";
import { ZUserName } from "@formbricks/types/user";

View File

@@ -4,7 +4,7 @@ import Image from "next/image";
import { ChangeEvent, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { getFormattedErrorMessage } from "@/lib/utils/helper";
import { updateProjectAction } from "@/modules/projects/settings/actions";
import { handleFileUpload } from "@/modules/storage/file-upload";

View File

@@ -5,7 +5,7 @@ import { SubmitHandler, useForm } from "react-hook-form";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { z } from "zod";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { cn } from "@/lib/cn";
import { getFormattedErrorMessage } from "@/lib/utils/helper";
import { updateProjectAction } from "@/modules/projects/settings/actions";

View File

@@ -7,7 +7,7 @@ import { useCallback, useState } from "react";
import { SubmitHandler, UseFormReturn, useForm } from "react-hook-form";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TProjectStyling, ZProjectStyling } from "@formbricks/types/project";
import { TSurveyStyling, TSurveyType } from "@formbricks/types/surveys/types";
import { previewSurvey } from "@/app/lib/templates";

View File

@@ -2,7 +2,7 @@
import { PlusCircleIcon } from "lucide-react";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TTemplate } from "@formbricks/types/templates";
import { customSurveyTemplate } from "@/app/lib/templates";
import { cn } from "@/lib/cn";

View File

@@ -1,7 +1,7 @@
"use client";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TTemplate, TTemplateFilter } from "@formbricks/types/templates";
import { cn } from "@/lib/cn";
import { Button } from "@/modules/ui/components/button";

View File

@@ -4,7 +4,7 @@ import { useRouter } from "next/navigation";
import { useMemo, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { ZProjectConfigChannel, ZProjectConfigIndustry } from "@formbricks/types/project";
import { TSurveyCreateInput, TSurveyType } from "@formbricks/types/surveys/types";
import { TTemplate, TTemplateFilter, ZTemplateRole } from "@formbricks/types/templates";

View File

@@ -2,7 +2,7 @@
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { ActionClass } from "@formbricks/database/generated/client";
import { ActionClass } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { CreateNewActionTab } from "@/modules/survey/editor/components/create-new-action-tab";
import { SavedActionsTab } from "@/modules/survey/editor/components/saved-actions-tab";

View File

@@ -6,7 +6,7 @@ import * as Collapsible from "@radix-ui/react-collapsible";
import { PlusIcon } from "lucide-react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { cn } from "@/lib/cn";
import {
getCXQuestionTypes,

View File

@@ -5,7 +5,7 @@ import { useMemo } from "react";
import { FormProvider, useForm } from "react-hook-form";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { ActionClass } from "@formbricks/database/generated/client";
import { ActionClass } from "@formbricks/database/generated/browser";
import { TActionClassInput } from "@formbricks/types/action-classes";
import { TSurvey } from "@formbricks/types/surveys/types";
import { ActionNameDescriptionFields } from "@/modules/ui/components/action-name-description-fields";

View File

@@ -4,7 +4,7 @@ import { createId } from "@paralleldrive/cuid2";
import { ArrowDownIcon, ArrowUpIcon, CopyIcon, EllipsisIcon, TrashIcon } from "lucide-react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import {
TSurvey,
TSurveyEndScreenCard,

View File

@@ -6,7 +6,7 @@ import Link from "next/link";
import { type JSX, useMemo, useState } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TAllowedFileExtension, ZAllowedFileExtension } from "@formbricks/types/storage";
import { TSurvey, TSurveyFileUploadQuestion } from "@formbricks/types/surveys/types";
import { TUserLocale } from "@formbricks/types/user";

View File

@@ -5,7 +5,7 @@ import * as Collapsible from "@radix-ui/react-collapsible";
import { CheckIcon, LinkIcon, MonitorIcon } from "lucide-react";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Environment } from "@formbricks/database/generated/client";
import { Environment } from "@formbricks/database/generated/browser";
import { TSegment } from "@formbricks/types/segment";
import { TSurvey, TSurveyType } from "@formbricks/types/surveys/types";
import { getDefaultEndingCard } from "@/app/lib/survey-builder";

View File

@@ -7,7 +7,7 @@ import * as Collapsible from "@radix-ui/react-collapsible";
import { ChevronDownIcon, ChevronRightIcon, GripIcon } from "lucide-react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import {
TI18nString,
TSurvey,

View File

@@ -1,6 +1,6 @@
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
import { useAutoAnimate } from "@formkit/auto-animate/react";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TSurvey, TSurveyQuestionId } from "@formbricks/types/surveys/types";
import { TUserLocale } from "@formbricks/types/user";
import { QuestionCard } from "@/modules/survey/editor/components/question-card";

View File

@@ -14,7 +14,7 @@ import { createId } from "@paralleldrive/cuid2";
import React, { SetStateAction, useEffect, useMemo } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Language, Project } from "@formbricks/database/generated/client";
import { Language, Project } from "@formbricks/database/generated/browser";
import { TSurveyQuota } from "@formbricks/types/quota";
import {
TConditionGroup,

View File

@@ -2,7 +2,7 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { ActionClass } from "@formbricks/database/generated/client";
import { ActionClass } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { ACTION_TYPE_ICON_LOOKUP } from "@/modules/projects/settings/(setup)/app-connection/utils";
import { ActionClassInfo } from "@/modules/ui/components/action-class-info";

View File

@@ -1,4 +1,4 @@
import { ActionClass, Environment, OrganizationRole } from "@formbricks/database/generated/client";
import { ActionClass, Environment, OrganizationRole } from "@formbricks/database/generated/browser";
import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key";
import { TSurveyQuota } from "@formbricks/types/quota";
import { TSegment } from "@formbricks/types/segment";

View File

@@ -6,7 +6,7 @@ import React, { useEffect, useMemo, useState } from "react";
import { UseFormReturn, useForm } from "react-hook-form";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TProjectStyling } from "@formbricks/types/project";
import { TSurvey, TSurveyStyling } from "@formbricks/types/surveys/types";
import { defaultStyling } from "@/lib/styling/constants";

View File

@@ -7,7 +7,7 @@ import {
Language,
OrganizationRole,
Project,
} from "@formbricks/database/generated/client";
} from "@formbricks/database/generated/browser";
import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key";
import { TSurveyQuota } from "@formbricks/types/quota";
import { TSegment } from "@formbricks/types/segment";

View File

@@ -6,7 +6,7 @@ import { useRouter } from "next/navigation";
import { useEffect, useMemo, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils";
import { TSegment } from "@formbricks/types/segment";
import {

View File

@@ -5,7 +5,7 @@ import * as Collapsible from "@radix-ui/react-collapsible";
import { CheckIcon, PlusIcon, Trash2Icon } from "lucide-react";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { ActionClass, OrganizationRole } from "@formbricks/database/generated/client";
import { ActionClass, OrganizationRole } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { getAccessFlags } from "@/lib/membership/utils";
import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team";

View File

@@ -1,5 +1,5 @@
import { type JSX, useState } from "react";
import { Project, SurveyType } from "@formbricks/database/generated/client";
import { Project, SurveyType } from "@formbricks/database/generated/browser";
import { TProjectStyling } from "@formbricks/types/project";
import { TSurveyStyling } from "@formbricks/types/surveys/types";
import { cn } from "@/lib/cn";

View File

@@ -2,7 +2,7 @@
import { useSearchParams } from "next/navigation";
import { useEffect, useMemo, useState } from "react";
import { Project, Response } from "@formbricks/database/generated/client";
import { Project, Response } from "@formbricks/database/generated/browser";
import { TResponseData, TResponseHiddenFieldValue } from "@formbricks/types/responses";
import { TSurvey } from "@formbricks/types/surveys/types";
import { LinkSurveyWrapper } from "@/modules/survey/link/components/link-survey-wrapper";

View File

@@ -2,7 +2,7 @@
import { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Project, Response } from "@formbricks/database/generated/client";
import { Project, Response } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import { cn } from "@/lib/cn";
import { getFormattedErrorMessage } from "@/lib/utils/helper";

View File

@@ -1,7 +1,7 @@
import { CalendarClockIcon, CheckCircle2Icon, HelpCircleIcon, PauseCircleIcon } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TSurveyClosedMessage } from "@formbricks/types/surveys/types";
import { getTranslate } from "@/lingodotdev/server";
import { Button } from "@/modules/ui/components/button";

View File

@@ -4,7 +4,7 @@ import { CheckCircle2Icon } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TSurveySingleUse } from "@formbricks/types/surveys/types";
import footerLogo from "../lib/footerlogo.svg";

View File

@@ -1,5 +1,5 @@
import { notFound } from "next/navigation";
import { type Response } from "@formbricks/database/generated/client";
import { type Response } from "@formbricks/database/generated/browser";
import { TSurvey } from "@formbricks/types/surveys/types";
import {
IMPRINT_URL,

View File

@@ -1,4 +1,4 @@
import { Environment, Project } from "@formbricks/database/generated/client";
import { Environment, Project } from "@formbricks/database/generated/browser";
export interface TUserProject extends Pick<Project, "id" | "name"> {
environments: Pick<Environment, "id" | "type">[];

View File

@@ -1,5 +1,5 @@
import { z } from "zod";
import { Language, Project } from "@formbricks/database/generated/client";
import { Language, Project } from "@formbricks/database/generated/browser";
import { ZSurveyStatus } from "@formbricks/types/surveys/types";
export const ZSurvey = z.object({

View File

@@ -2,7 +2,7 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import type { Environment, Project } from "@formbricks/database/generated/client";
import type { Environment, Project } from "@formbricks/database/generated/browser";
import type { TTemplate } from "@formbricks/types/templates";
import { customSurveyTemplate } from "@/app/lib/templates";
import { TemplateList } from "@/modules/survey/components/template-list";

View File

@@ -6,7 +6,7 @@ import { CheckIcon } from "lucide-react";
import React from "react";
import { UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TProjectStyling } from "@formbricks/types/project";
import { TSurveyStyling, TSurveyType } from "@formbricks/types/surveys/types";
import { cn } from "@/lib/cn";

View File

@@ -4,7 +4,7 @@ import { ArrowUpRight } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { cn } from "@/lib/cn";
interface ClientLogoProps {

View File

@@ -4,7 +4,7 @@ import Image from "next/image";
import Link from "next/link";
import React, { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { SurveyType } from "@formbricks/database/generated/client";
import { SurveyType } from "@formbricks/database/generated/browser";
import { TProjectStyling } from "@formbricks/types/project";
import { TSurveyStyling } from "@formbricks/types/surveys/types";

View File

@@ -4,7 +4,7 @@ import { motion } from "framer-motion";
import { ExpandIcon, MonitorIcon, ShrinkIcon, SmartphoneIcon } from "lucide-react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Environment, Project } from "@formbricks/database/generated/client";
import { Environment, Project } from "@formbricks/database/generated/browser";
import { TProjectStyling } from "@formbricks/types/project";
import { TSurvey, TSurveyQuestionId, TSurveyStyling } from "@formbricks/types/surveys/types";
import { cn } from "@/lib/cn";

View File

@@ -3,7 +3,7 @@
import { Variants, motion } from "framer-motion";
import { Fragment, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Project } from "@formbricks/database/generated/client";
import { Project } from "@formbricks/database/generated/browser";
import { TSurvey, TSurveyType } from "@formbricks/types/surveys/types";
import { ClientLogo } from "@/modules/ui/components/client-logo";
import { MediaBackground } from "@/modules/ui/components/media-background";

View File

@@ -19,7 +19,7 @@ const nextConfig = {
output: "standalone",
poweredByHeader: false,
productionBrowserSourceMaps: true,
serverExternalPackages: ["@aws-sdk", "@opentelemetry/instrumentation", "pino", "pino-pretty"],
serverExternalPackages: ["@aws-sdk", "@opentelemetry/instrumentation", "pino", "pino-pretty", "@prisma/client"],
outputFileTracingIncludes: {
"/api/auth/**/*": ["../../node_modules/jose/**/*"],
},
@@ -113,6 +113,15 @@ const nextConfig = {
config.resolve.fallback = {
http: false, // Prevents Next.js from trying to bundle 'http'
https: false,
// Externalize Node.js built-in modules used by Prisma
"node:async_hooks": false,
"node:buffer": false,
"node:crypto": false,
"node:events": false,
"node:fs": false,
"node:path": false,
"node:stream": false,
"node:util": false,
};
return config;
},

View File

@@ -4,7 +4,7 @@ import {
type ApiKeyEnvironment,
ApiKeyPermission,
EnvironmentType,
} from "@formbricks/database/generated/client";
} from "@formbricks/database/generated/browser";
import { ZOrganizationAccess } from "../../types/api-key";
export const ZApiKeyPermission = z.nativeEnum(ApiKeyPermission);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import { type ContactAttributeKey, ContactAttributeType } from "@formbricks/database/generated/client";
import { type ContactAttributeKey, ContactAttributeType } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import type { ContactAttribute } from "@formbricks/database/generated/client";
import type { ContactAttribute } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import type { Contact } from "@formbricks/database/generated/client";
import type { Contact } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,5 +1,5 @@
import { z } from "zod";
import { type Invite } from "@formbricks/database/generated/client";
import { type Invite } from "@formbricks/database/generated/browser";
export const ZInvite = z.object({
id: z.string(),

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import type { Organization } from "@formbricks/database/generated/client";
import type { Organization } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import { type ProjectTeam, ProjectTeamPermission } from "@formbricks/database/generated/client";
import { type ProjectTeam, ProjectTeamPermission } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import type { Response } from "@formbricks/database/generated/client";
import type { Response } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import { SurveyStatus, SurveyType } from "@formbricks/database/generated/client";
import { SurveyStatus, SurveyType } from "@formbricks/database/generated/browser";
// eslint-disable-next-line import/no-relative-packages -- Need to import from parent package
import {
ZSurveyEnding,

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import type { Team } from "@formbricks/database/generated/client";
import type { Team } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import { OrganizationRole, User } from "@formbricks/database/generated/client";
import { OrganizationRole, User } from "@formbricks/database/generated/browser";
import { ZUserEmail, ZUserName } from "../../types/user";
extendZodWithOpenApi(z);

View File

@@ -1,6 +1,6 @@
import { z } from "zod";
import { extendZodWithOpenApi } from "zod-openapi";
import type { Webhook } from "@formbricks/database/generated/client";
import type { Webhook } from "@formbricks/database/generated/browser";
extendZodWithOpenApi(z);

View File

@@ -1,5 +1,5 @@
import { ApiKeyPermission, EnvironmentType } from "@prisma/client";
import { z } from "zod";
import { ApiKeyPermission, EnvironmentType } from "@formbricks/database/generated/browser";
import { ZOrganizationAccess } from "./api-key";
import { ZUser } from "./user";