mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-21 21:50:39 -06:00
Compare commits
2 Commits
fix/react-
...
fix/v2-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad0faf7054 | ||
|
|
1830fc044b |
@@ -9,7 +9,6 @@ import {
|
||||
ZContactAttributeKeyInput,
|
||||
ZGetContactAttributeKeysFilter,
|
||||
} from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys";
|
||||
import { managementServer } from "@/modules/api/v2/management/lib/openapi";
|
||||
import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response";
|
||||
|
||||
export const getContactAttributeKeysEndpoint: ZodOpenApiOperationObject = {
|
||||
@@ -59,13 +58,11 @@ export const createContactAttributeKeyEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const contactAttributeKeyPaths: ZodOpenApiPathsObject = {
|
||||
"/contact-attribute-keys": {
|
||||
servers: managementServer,
|
||||
"/management/contact-attribute-keys": {
|
||||
get: getContactAttributeKeysEndpoint,
|
||||
post: createContactAttributeKeyEndpoint,
|
||||
},
|
||||
"/contact-attribute-keys/{id}": {
|
||||
servers: managementServer,
|
||||
"/management/contact-attribute-keys/{id}": {
|
||||
get: getContactAttributeKeyEndpoint,
|
||||
put: updateContactAttributeKeyEndpoint,
|
||||
delete: deleteContactAttributeKeyEndpoint,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export const managementServer = [
|
||||
{
|
||||
url: `https://app.formbricks.com/api/v2/management`,
|
||||
description: "Formbricks Management API",
|
||||
},
|
||||
];
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi";
|
||||
import { ZResponse } from "@formbricks/database/zod/responses";
|
||||
import { managementServer } from "@/modules/api/v2/management/lib/openapi";
|
||||
import {
|
||||
deleteResponseEndpoint,
|
||||
getResponseEndpoint,
|
||||
@@ -57,13 +56,11 @@ export const createResponseEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const responsePaths: ZodOpenApiPathsObject = {
|
||||
"/responses": {
|
||||
servers: managementServer,
|
||||
"/management/responses": {
|
||||
get: getResponsesEndpoint,
|
||||
post: createResponseEndpoint,
|
||||
},
|
||||
"/responses/{id}": {
|
||||
servers: managementServer,
|
||||
"/management/responses/{id}": {
|
||||
get: getResponseEndpoint,
|
||||
put: updateResponseEndpoint,
|
||||
delete: deleteResponseEndpoint,
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { ZodOpenApiPathsObject } from "zod-openapi";
|
||||
import { managementServer } from "@/modules/api/v2/management/lib/openapi";
|
||||
import { getContactLinksBySegmentEndpoint } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/openapi";
|
||||
|
||||
export const surveyContactLinksBySegmentPaths: ZodOpenApiPathsObject = {
|
||||
"/surveys/{surveyId}/contact-links/segments/{segmentId}": {
|
||||
servers: managementServer,
|
||||
"/management/surveys/{surveyId}/contact-links/segments/{segmentId}": {
|
||||
get: getContactLinksBySegmentEndpoint,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi";
|
||||
import { ZSurveyWithoutQuestionType } from "@formbricks/database/zod/surveys";
|
||||
import { managementServer } from "@/modules/api/v2/management/lib/openapi";
|
||||
import { getPersonalizedSurveyLink } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/contacts/[contactId]/lib/openapi";
|
||||
import { ZGetSurveysFilter, ZSurveyInput } from "@/modules/api/v2/management/surveys/types/surveys";
|
||||
|
||||
@@ -52,19 +51,16 @@ export const createSurveyEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const surveyPaths: ZodOpenApiPathsObject = {
|
||||
// "/surveys": {
|
||||
// servers: managementServer,
|
||||
// "/management/surveys": {
|
||||
// get: getSurveysEndpoint,
|
||||
// post: createSurveyEndpoint,
|
||||
// },
|
||||
// "/surveys/{id}": {
|
||||
// servers: managementServer,
|
||||
// "/management/surveys/{id}": {
|
||||
// get: getSurveyEndpoint,
|
||||
// put: updateSurveyEndpoint,
|
||||
// delete: deleteSurveyEndpoint,
|
||||
// },
|
||||
"/surveys/{surveyId}/contact-links/contacts/{contactId}/": {
|
||||
servers: managementServer,
|
||||
"/management/surveys/{surveyId}/contact-links/contacts/{contactId}/": {
|
||||
get: getPersonalizedSurveyLink,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi";
|
||||
import { ZWebhook } from "@formbricks/database/zod/webhooks";
|
||||
import { managementServer } from "@/modules/api/v2/management/lib/openapi";
|
||||
import {
|
||||
deleteWebhookEndpoint,
|
||||
getWebhookEndpoint,
|
||||
@@ -56,13 +55,11 @@ export const createWebhookEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const webhookPaths: ZodOpenApiPathsObject = {
|
||||
"/webhooks": {
|
||||
servers: managementServer,
|
||||
"/management/webhooks": {
|
||||
get: getWebhooksEndpoint,
|
||||
post: createWebhookEndpoint,
|
||||
},
|
||||
"/webhooks/{id}": {
|
||||
servers: managementServer,
|
||||
"/management/webhooks/{id}": {
|
||||
get: getWebhookEndpoint,
|
||||
put: updateWebhookEndpoint,
|
||||
delete: deleteWebhookEndpoint,
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
ZProjectTeamInput,
|
||||
} from "@/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams";
|
||||
import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations";
|
||||
import { organizationServer } from "@/modules/api/v2/organizations/lib/openapi";
|
||||
import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response";
|
||||
|
||||
export const getProjectTeamsEndpoint: ZodOpenApiOperationObject = {
|
||||
@@ -119,8 +118,7 @@ export const updateProjectTeamEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const projectTeamPaths: ZodOpenApiPathsObject = {
|
||||
"/{organizationId}/project-teams": {
|
||||
servers: organizationServer,
|
||||
"/organizations/{organizationId}/project-teams": {
|
||||
get: getProjectTeamsEndpoint,
|
||||
post: createProjectTeamEndpoint,
|
||||
put: updateProjectTeamEndpoint,
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
ZTeamInput,
|
||||
} from "@/modules/api/v2/organizations/[organizationId]/teams/types/teams";
|
||||
import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations";
|
||||
import { organizationServer } from "@/modules/api/v2/organizations/lib/openapi";
|
||||
import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response";
|
||||
|
||||
export const getTeamsEndpoint: ZodOpenApiOperationObject = {
|
||||
@@ -69,13 +68,11 @@ export const createTeamEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const teamPaths: ZodOpenApiPathsObject = {
|
||||
"/{organizationId}/teams": {
|
||||
servers: organizationServer,
|
||||
"/organizations/{organizationId}/teams": {
|
||||
get: getTeamsEndpoint,
|
||||
post: createTeamEndpoint,
|
||||
},
|
||||
"/{organizationId}/teams/{id}": {
|
||||
servers: organizationServer,
|
||||
"/organizations/{organizationId}/teams/{id}": {
|
||||
get: getTeamEndpoint,
|
||||
put: updateTeamEndpoint,
|
||||
delete: deleteTeamEndpoint,
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
ZUserInput,
|
||||
ZUserInputPatch,
|
||||
} from "@/modules/api/v2/organizations/[organizationId]/users/types/users";
|
||||
import { organizationServer } from "@/modules/api/v2/organizations/lib/openapi";
|
||||
import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response";
|
||||
|
||||
export const getUsersEndpoint: ZodOpenApiOperationObject = {
|
||||
@@ -96,8 +95,7 @@ export const updateUserEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const userPaths: ZodOpenApiPathsObject = {
|
||||
"/{organizationId}/users": {
|
||||
servers: organizationServer,
|
||||
"/organizations/{organizationId}/users": {
|
||||
get: getUsersEndpoint,
|
||||
post: createUserEndpoint,
|
||||
patch: updateUserEndpoint,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export const organizationServer = [
|
||||
{
|
||||
url: `https://app.formbricks.com/api/v2/organizations`,
|
||||
description: "Formbricks Organizations API",
|
||||
},
|
||||
];
|
||||
@@ -1,6 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi";
|
||||
import { managementServer } from "@/modules/api/v2/management/lib/openapi";
|
||||
import { ZContactBulkUploadRequest } from "@/modules/ee/contacts/types/contact";
|
||||
|
||||
const bulkContactEndpoint: ZodOpenApiOperationObject = {
|
||||
@@ -111,8 +110,7 @@ const bulkContactEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const bulkContactPaths: ZodOpenApiPathsObject = {
|
||||
"/contacts/bulk": {
|
||||
servers: managementServer,
|
||||
"/management/contacts/bulk": {
|
||||
put: bulkContactEndpoint,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi";
|
||||
import { managementServer } from "@/modules/api/v2/management/lib/openapi";
|
||||
import { makePartialSchema } from "@/modules/api/v2/types/openapi-response";
|
||||
import { ZContactCreateRequest, ZContactResponse } from "@/modules/ee/contacts/types/contact";
|
||||
|
||||
@@ -54,8 +53,7 @@ export const createContactEndpoint: ZodOpenApiOperationObject = {
|
||||
};
|
||||
|
||||
export const contactPaths: ZodOpenApiPathsObject = {
|
||||
"/contacts": {
|
||||
servers: managementServer,
|
||||
"/management/contacts": {
|
||||
post: createContactEndpoint,
|
||||
},
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,7 @@ checksums:
|
||||
common/ranking_items: 463f2eb500f1b42fbce6cec17612fb9a
|
||||
common/respondents_will_not_see_this_card: 18c3dd44d6ff6ca2310ad196b84f30d3
|
||||
common/retry: 6e44d18639560596569a1278f9c83676
|
||||
common/retrying: 0cb623dbdcbf16d3680f0180ceac734c
|
||||
common/select_a_date: 521e4a705800da06d091fde3e801ce02
|
||||
common/select_for_ranking: e5f4e20752d1c2d852cd02dc3a0e9dd0
|
||||
common/sending_responses: 184772f70cca69424eaf34f73520789f
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"@prisma/client": "6.14.0",
|
||||
"zod": "3.24.4",
|
||||
"zod-openapi": "4.2.4",
|
||||
"node-html-parser": "7.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { z } from "zod";
|
||||
import { extendZodWithOpenApi } from "zod-openapi";
|
||||
import { ZId } from "../common";
|
||||
|
||||
extendZodWithOpenApi(z);
|
||||
|
||||
// Logic operators
|
||||
export const ZSurveyLogicConditionsOperator = z.enum([
|
||||
"equals",
|
||||
@@ -211,13 +214,15 @@ export const ZSingleConditionDeprecated = z
|
||||
|
||||
export type TSingleConditionDeprecated = z.infer<typeof ZSingleConditionDeprecated>;
|
||||
|
||||
export const ZConditionGroup: z.ZodType<TConditionGroup> = z.lazy(() =>
|
||||
z.object({
|
||||
id: ZId,
|
||||
connector: ZConnector,
|
||||
conditions: z.array(z.union([ZSingleCondition, ZConditionGroup])),
|
||||
})
|
||||
);
|
||||
export const ZConditionGroup: z.ZodType<TConditionGroup> = z
|
||||
.lazy(() =>
|
||||
z.object({
|
||||
id: ZId,
|
||||
connector: ZConnector,
|
||||
conditions: z.array(z.union([ZSingleCondition, ZConditionGroup])),
|
||||
})
|
||||
)
|
||||
.openapi({ ref: "conditionGroup" });
|
||||
|
||||
export interface TConditionGroup {
|
||||
id: string;
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -883,6 +883,9 @@ importers:
|
||||
zod:
|
||||
specifier: 3.24.4
|
||||
version: 3.24.4
|
||||
zod-openapi:
|
||||
specifier: 4.2.4
|
||||
version: 4.2.4(zod@3.24.4)
|
||||
devDependencies:
|
||||
'@formbricks/config-typescript':
|
||||
specifier: workspace:*
|
||||
|
||||
Reference in New Issue
Block a user