* feat: api v2 add missing event type fields for advanced settings Add 9 event type fields to API v2 that were available in tRPC but missing from the platform API: - disableCancelling: disable cancelling for guests/organizer - disableRescheduling: disable rescheduling for guests/organizer - canSendCalVideoTranscriptionEmails: send Cal Video transcription emails - autoTranslateInstantMeetingTitleEnabled: auto-translate instant meeting titles - interfaceLanguage: preferred booking interface language - allowReschedulingPastBookings: allow rescheduling past events - allowReschedulingCancelledBookings: allow booking via reschedule link - customReplyToEmail: custom reply-to email for confirmations - showOptimizedSlots: optimize time slot arrangement Updated output/input schemas, transformation services, and E2E tests. * fix(api-v2): add proper OpenAPI types for nullable event type fields Add explicit type and nullable properties to @ApiPropertyOptional decorators for fields with `boolean | null` or `string | null` types. Without these, Swagger was generating incorrect "type": "object" instead of the correct types. Fixed fields: - disableCancelling: type: Boolean, nullable: true - disableRescheduling: type: Boolean, nullable: true - interfaceLanguage: type: String, nullable: true - allowReschedulingCancelledBookings: type: Boolean, nullable: true - customReplyToEmail: type: String, nullable: true - showOptimizedSlots: type: Boolean, nullable: true * refactor: customReplyToEmail was intentionally excluded from this PR. The web UI restricts this field to only allow the user's own verified emails via a dropdown, but implementing the same validation in the API requires additional business logic. This will be addressed in a separate PR with proper email ownership validation. * feat(api-v2): add validation for interfaceLanguage field Add @IsIn validation to interfaceLanguage field to only accept supported locales. This ensures API v2 matches the web UI behavior where users can only select from a predefined dropdown of supported languages. Changes: - Add SUPPORTED_LOCALES constant to @calcom/platform-constants - Add @IsIn([...SUPPORTED_LOCALES]) validation to create/update DTOs - Add E2E tests for invalid locale rejection (400 error) - Add cross-reference comments in i18n.json and api.ts to keep in sync * docs(api): add default values to event type input field documentation Added default value documentation to @DocsPropertyOptional decorators for the new event type fields in API v2 (2024_06_14): - disableCancelling: false - disableRescheduling: false - canSendCalVideoTranscriptionEmails: true - autoTranslateInstantMeetingTitleEnabled: false - allowReschedulingPastBookings: false - allowReschedulingCancelledBookings: false - showOptimizedSlots: false This improves API documentation by clearly communicating default values to API consumers in the OpenAPI spec. * feat(api-v2): refactor event type settings to object types for future extensibility - Convert disableRescheduling from boolean to object with disabled and minutesBefore properties - Convert disableCancelling from boolean to object with disabled property - Move canSendCalVideoTranscriptionEmails into CalVideoSettings as sendTranscriptionEmails - Remove autoTranslateInstantMeetingTitleEnabled (Enterprise-only feature) - Add DisableRescheduling_2024_06_14 and DisableCancelling_2024_06_14 input/output types - Add transformation methods for new object types in input and output services - Update E2E tests for new API contract BREAKING CHANGE: disableRescheduling and disableCancelling now accept objects instead of booleans * fix(api-v2): prevent clearing calVideoSettings when only sendTranscriptionEmails is provided Only include calVideoSettings in transformed output if it has properties, avoiding unintentional reset of existing settings during updates.
118 lines
2.7 KiB
TypeScript
118 lines
2.7 KiB
TypeScript
export const BASE_URL = "http://localhost:5555";
|
|
export const V2_ENDPOINTS = {
|
|
me: "me",
|
|
availability: "schedules",
|
|
eventTypes: "event-types",
|
|
bookings: "bookings",
|
|
};
|
|
|
|
export const SUCCESS_STATUS = "success";
|
|
export const ERROR_STATUS = "error";
|
|
export const REDIRECT_STATUS = "redirect";
|
|
// Client Errors (4xx)
|
|
export const BAD_REQUEST = "BAD_REQUEST";
|
|
export const UNAUTHORIZED = "UNAUTHORIZED";
|
|
export const FORBIDDEN = "FORBIDDEN";
|
|
export const NOT_FOUND = "NOT_FOUND";
|
|
export const METHOD_NOT_ALLOWED = "METHOD_NOT_ALLOWED";
|
|
export const UNPROCESSABLE_ENTITY = "UNPROCESSABLE_ENTITY";
|
|
export const ACCESS_TOKEN_EXPIRED = "ACCESS_TOKEN_IS_EXPIRED";
|
|
export const INVALID_ACCESS_TOKEN = "Invalid Access Token.";
|
|
export const CONFLICT = "CONFLICT";
|
|
|
|
// Server Errors (5xx)
|
|
export const INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR";
|
|
|
|
// Custom Errors
|
|
export const INVALID_PARAMETER = "INVALID_PARAMETER";
|
|
export const MISSING_PARAMETER = "MISSING_PARAMETER";
|
|
export const INVALID_API_KEY = "INVALID_API_KEY";
|
|
export const RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND";
|
|
export const DUPLICATE_RESOURCE = "DUPLICATE_RESOURCE";
|
|
|
|
export const API_ERROR_CODES = [
|
|
BAD_REQUEST,
|
|
UNAUTHORIZED,
|
|
FORBIDDEN,
|
|
NOT_FOUND,
|
|
METHOD_NOT_ALLOWED,
|
|
UNPROCESSABLE_ENTITY,
|
|
INTERNAL_SERVER_ERROR,
|
|
INVALID_PARAMETER,
|
|
MISSING_PARAMETER,
|
|
INVALID_API_KEY,
|
|
RESOURCE_NOT_FOUND,
|
|
DUPLICATE_RESOURCE,
|
|
] as const;
|
|
|
|
// Request headers
|
|
export const X_CAL_SECRET_KEY = "x-cal-secret-key";
|
|
export const X_CAL_CLIENT_ID = "x-cal-client-id";
|
|
export const X_CAL_PLATFORM_EMBED = "x-cal-platform-embed";
|
|
|
|
// HTTP status codes
|
|
export const HTTP_CODE_TOKEN_EXPIRED = 498;
|
|
|
|
export const VERSION_2024_06_14 = "2024-06-14";
|
|
export const VERSION_2024_06_11 = "2024-06-11";
|
|
export const VERSION_2024_04_15 = "2024-04-15";
|
|
export const VERSION_2024_08_13 = "2024-08-13";
|
|
export const VERSION_2024_09_04 = "2024-09-04";
|
|
|
|
export const API_VERSIONS = [
|
|
VERSION_2024_06_14,
|
|
VERSION_2024_06_11,
|
|
VERSION_2024_04_15,
|
|
VERSION_2024_08_13,
|
|
VERSION_2024_09_04,
|
|
] as const;
|
|
|
|
export type API_VERSIONS_ENUM = (typeof API_VERSIONS)[number];
|
|
export type API_VERSIONS_TYPE = typeof API_VERSIONS;
|
|
export const CAL_API_VERSION_HEADER = "cal-api-version";
|
|
export const MAX_SEATS_PER_TIME_SLOT = 1000;
|
|
|
|
// Keep in sync with i18n.json locale.targets
|
|
export const SUPPORTED_LOCALES = [
|
|
"",
|
|
"en",
|
|
"ar",
|
|
"az",
|
|
"bg",
|
|
"bn",
|
|
"ca",
|
|
"cs",
|
|
"da",
|
|
"de",
|
|
"el",
|
|
"es",
|
|
"es-419",
|
|
"eu",
|
|
"et",
|
|
"fi",
|
|
"fr",
|
|
"he",
|
|
"hu",
|
|
"it",
|
|
"ja",
|
|
"km",
|
|
"ko",
|
|
"nl",
|
|
"no",
|
|
"pl",
|
|
"pt-BR",
|
|
"pt",
|
|
"ro",
|
|
"ru",
|
|
"sk-SK",
|
|
"sr",
|
|
"sv",
|
|
"tr",
|
|
"uk",
|
|
"vi",
|
|
"zh-CN",
|
|
"zh-TW",
|
|
] as const;
|
|
|
|
export type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];
|