Regenerates zod files (#1896)

This commit is contained in:
Omar López 2022-02-17 11:26:53 -07:00 committed by GitHub
parent 2194b92fdf
commit d702bcf0a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 236 additions and 334 deletions

View File

@ -1,6 +1,6 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteBooking, BookingModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteBooking, BookingModel } from "./index"
export const _AttendeeModel = z.object({
id: z.number().int(),
@ -9,10 +9,10 @@ export const _AttendeeModel = z.object({
timeZone: z.string(),
locale: z.string().nullish(),
bookingId: z.number().int().nullish(),
});
})
export interface CompleteAttendee extends z.infer<typeof _AttendeeModel> {
booking?: CompleteBooking | null;
booking?: CompleteBooking | null
}
/**
@ -20,8 +20,6 @@ export interface CompleteAttendee extends z.infer<typeof _AttendeeModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const AttendeeModel: z.ZodSchema<CompleteAttendee> = z.lazy(() =>
_AttendeeModel.extend({
booking: BookingModel.nullish(),
})
);
export const AttendeeModel: z.ZodSchema<CompleteAttendee> = z.lazy(() => _AttendeeModel.extend({
booking: BookingModel.nullish(),
}))

View File

@ -1,6 +1,6 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteUser, UserModel, CompleteEventType, EventTypeModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteUser, UserModel, CompleteEventType, EventTypeModel } from "./index"
export const _AvailabilityModel = z.object({
id: z.number().int(),
@ -11,11 +11,11 @@ export const _AvailabilityModel = z.object({
startTime: z.date(),
endTime: z.date(),
date: z.date().nullish(),
});
})
export interface CompleteAvailability extends z.infer<typeof _AvailabilityModel> {
user?: CompleteUser | null;
eventType?: CompleteEventType | null;
user?: CompleteUser | null
eventType?: CompleteEventType | null
}
/**
@ -23,9 +23,7 @@ export interface CompleteAvailability extends z.infer<typeof _AvailabilityModel>
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const AvailabilityModel: z.ZodSchema<CompleteAvailability> = z.lazy(() =>
_AvailabilityModel.extend({
user: UserModel.nullish(),
eventType: EventTypeModel.nullish(),
})
);
export const AvailabilityModel: z.ZodSchema<CompleteAvailability> = z.lazy(() => _AvailabilityModel.extend({
user: UserModel.nullish(),
eventType: EventTypeModel.nullish(),
}))

View File

@ -1,22 +1,7 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { BookingStatus } from "@prisma/client";
import {
CompleteUser,
UserModel,
CompleteBookingReference,
BookingReferenceModel,
CompleteEventType,
EventTypeModel,
CompleteAttendee,
AttendeeModel,
CompleteDailyEventReference,
DailyEventReferenceModel,
CompletePayment,
PaymentModel,
CompleteDestinationCalendar,
DestinationCalendarModel,
} from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { BookingStatus } from "@prisma/client"
import { CompleteUser, UserModel, CompleteBookingReference, BookingReferenceModel, CompleteEventType, EventTypeModel, CompleteAttendee, AttendeeModel, CompleteDailyEventReference, DailyEventReferenceModel, CompletePayment, PaymentModel, CompleteDestinationCalendar, DestinationCalendarModel } from "./index"
export const _BookingModel = z.object({
id: z.number().int(),
@ -36,16 +21,16 @@ export const _BookingModel = z.object({
paid: z.boolean(),
cancellationReason: z.string().nullish(),
rejectionReason: z.string().nullish(),
});
})
export interface CompleteBooking extends z.infer<typeof _BookingModel> {
user?: CompleteUser | null;
references: CompleteBookingReference[];
eventType?: CompleteEventType | null;
attendees: CompleteAttendee[];
dailyRef?: CompleteDailyEventReference | null;
payment: CompletePayment[];
destinationCalendar?: CompleteDestinationCalendar | null;
user?: CompleteUser | null
references: CompleteBookingReference[]
eventType?: CompleteEventType | null
attendees: CompleteAttendee[]
dailyRef?: CompleteDailyEventReference | null
payment: CompletePayment[]
destinationCalendar?: CompleteDestinationCalendar | null
}
/**
@ -53,14 +38,12 @@ export interface CompleteBooking extends z.infer<typeof _BookingModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const BookingModel: z.ZodSchema<CompleteBooking> = z.lazy(() =>
_BookingModel.extend({
user: UserModel.nullish(),
references: BookingReferenceModel.array(),
eventType: EventTypeModel.nullish(),
attendees: AttendeeModel.array(),
dailyRef: DailyEventReferenceModel.nullish(),
payment: PaymentModel.array(),
destinationCalendar: DestinationCalendarModel.nullish(),
})
);
export const BookingModel: z.ZodSchema<CompleteBooking> = z.lazy(() => _BookingModel.extend({
user: UserModel.nullish(),
references: BookingReferenceModel.array(),
eventType: EventTypeModel.nullish(),
attendees: AttendeeModel.array(),
dailyRef: DailyEventReferenceModel.nullish(),
payment: PaymentModel.array(),
destinationCalendar: DestinationCalendarModel.nullish(),
}))

View File

@ -1,6 +1,6 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteBooking, BookingModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteBooking, BookingModel } from "./index"
export const _BookingReferenceModel = z.object({
id: z.number().int(),
@ -10,10 +10,10 @@ export const _BookingReferenceModel = z.object({
meetingPassword: z.string().nullish(),
meetingUrl: z.string().nullish(),
bookingId: z.number().int().nullish(),
});
})
export interface CompleteBookingReference extends z.infer<typeof _BookingReferenceModel> {
booking?: CompleteBooking | null;
booking?: CompleteBooking | null
}
/**
@ -21,8 +21,6 @@ export interface CompleteBookingReference extends z.infer<typeof _BookingReferen
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const BookingReferenceModel: z.ZodSchema<CompleteBookingReference> = z.lazy(() =>
_BookingReferenceModel.extend({
booking: BookingModel.nullish(),
})
);
export const BookingReferenceModel: z.ZodSchema<CompleteBookingReference> = z.lazy(() => _BookingReferenceModel.extend({
booking: BookingModel.nullish(),
}))

View File

@ -1,24 +1,22 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteUser, UserModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteUser, UserModel } from "./index"
// Helper schema for JSON fields
type Literal = boolean | number | string;
type Json = Literal | { [key: string]: Json } | Json[];
const literalSchema = z.union([z.string(), z.number(), z.boolean()]);
const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)])
);
type Literal = boolean | number | string
type Json = Literal | { [key: string]: Json } | Json[]
const literalSchema = z.union([z.string(), z.number(), z.boolean()])
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
export const _CredentialModel = z.object({
id: z.number().int(),
type: z.string(),
key: jsonSchema,
userId: z.number().int().nullish(),
});
})
export interface CompleteCredential extends z.infer<typeof _CredentialModel> {
user?: CompleteUser | null;
user?: CompleteUser | null
}
/**
@ -26,8 +24,6 @@ export interface CompleteCredential extends z.infer<typeof _CredentialModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const CredentialModel: z.ZodSchema<CompleteCredential> = z.lazy(() =>
_CredentialModel.extend({
user: UserModel.nullish(),
})
);
export const CredentialModel: z.ZodSchema<CompleteCredential> = z.lazy(() => _CredentialModel.extend({
user: UserModel.nullish(),
}))

View File

@ -1,16 +1,16 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteBooking, BookingModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteBooking, BookingModel } from "./index"
export const _DailyEventReferenceModel = z.object({
id: z.number().int(),
dailyurl: z.string(),
dailytoken: z.string(),
bookingId: z.number().int().nullish(),
});
})
export interface CompleteDailyEventReference extends z.infer<typeof _DailyEventReferenceModel> {
booking?: CompleteBooking | null;
booking?: CompleteBooking | null
}
/**
@ -18,8 +18,6 @@ export interface CompleteDailyEventReference extends z.infer<typeof _DailyEventR
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const DailyEventReferenceModel: z.ZodSchema<CompleteDailyEventReference> = z.lazy(() =>
_DailyEventReferenceModel.extend({
booking: BookingModel.nullish(),
})
);
export const DailyEventReferenceModel: z.ZodSchema<CompleteDailyEventReference> = z.lazy(() => _DailyEventReferenceModel.extend({
booking: BookingModel.nullish(),
}))

View File

@ -1,13 +1,6 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import {
CompleteUser,
UserModel,
CompleteBooking,
BookingModel,
CompleteEventType,
EventTypeModel,
} from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteUser, UserModel, CompleteBooking, BookingModel, CompleteEventType, EventTypeModel } from "./index"
export const _DestinationCalendarModel = z.object({
id: z.number().int(),
@ -16,12 +9,12 @@ export const _DestinationCalendarModel = z.object({
userId: z.number().int().nullish(),
bookingId: z.number().int().nullish(),
eventTypeId: z.number().int().nullish(),
});
})
export interface CompleteDestinationCalendar extends z.infer<typeof _DestinationCalendarModel> {
user?: CompleteUser | null;
booking?: CompleteBooking | null;
eventType?: CompleteEventType | null;
user?: CompleteUser | null
booking?: CompleteBooking | null
eventType?: CompleteEventType | null
}
/**
@ -29,10 +22,8 @@ export interface CompleteDestinationCalendar extends z.infer<typeof _Destination
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const DestinationCalendarModel: z.ZodSchema<CompleteDestinationCalendar> = z.lazy(() =>
_DestinationCalendarModel.extend({
user: UserModel.nullish(),
booking: BookingModel.nullish(),
eventType: EventTypeModel.nullish(),
})
);
export const DestinationCalendarModel: z.ZodSchema<CompleteDestinationCalendar> = z.lazy(() => _DestinationCalendarModel.extend({
user: UserModel.nullish(),
booking: BookingModel.nullish(),
eventType: EventTypeModel.nullish(),
}))

View File

@ -1,30 +1,13 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { PeriodType, SchedulingType } from "@prisma/client";
import {
CompleteUser,
UserModel,
CompleteTeam,
TeamModel,
CompleteBooking,
BookingModel,
CompleteAvailability,
AvailabilityModel,
CompleteDestinationCalendar,
DestinationCalendarModel,
CompleteEventTypeCustomInput,
EventTypeCustomInputModel,
CompleteSchedule,
ScheduleModel,
} from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { PeriodType, SchedulingType } from "@prisma/client"
import { CompleteUser, UserModel, CompleteTeam, TeamModel, CompleteBooking, BookingModel, CompleteAvailability, AvailabilityModel, CompleteDestinationCalendar, DestinationCalendarModel, CompleteEventTypeCustomInput, EventTypeCustomInputModel, CompleteSchedule, ScheduleModel } from "./index"
// Helper schema for JSON fields
type Literal = boolean | number | string;
type Json = Literal | { [key: string]: Json } | Json[];
const literalSchema = z.union([z.string(), z.number(), z.boolean()]);
const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)])
);
type Literal = boolean | number | string
type Json = Literal | { [key: string]: Json } | Json[]
const literalSchema = z.union([z.string(), z.number(), z.boolean()])
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
export const _EventTypeModel = z.object({
id: z.number().int(),
@ -52,16 +35,16 @@ export const _EventTypeModel = z.object({
currency: z.string(),
slotInterval: z.number().int().nullish(),
metadata: jsonSchema,
});
})
export interface CompleteEventType extends z.infer<typeof _EventTypeModel> {
users: CompleteUser[];
team?: CompleteTeam | null;
bookings: CompleteBooking[];
availability: CompleteAvailability[];
destinationCalendar?: CompleteDestinationCalendar | null;
customInputs: CompleteEventTypeCustomInput[];
Schedule: CompleteSchedule[];
users: CompleteUser[]
team?: CompleteTeam | null
bookings: CompleteBooking[]
availability: CompleteAvailability[]
destinationCalendar?: CompleteDestinationCalendar | null
customInputs: CompleteEventTypeCustomInput[]
Schedule: CompleteSchedule[]
}
/**
@ -69,14 +52,12 @@ export interface CompleteEventType extends z.infer<typeof _EventTypeModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const EventTypeModel: z.ZodSchema<CompleteEventType> = z.lazy(() =>
_EventTypeModel.extend({
users: UserModel.array(),
team: TeamModel.nullish(),
bookings: BookingModel.array(),
availability: AvailabilityModel.array(),
destinationCalendar: DestinationCalendarModel.nullish(),
customInputs: EventTypeCustomInputModel.array(),
Schedule: ScheduleModel.array(),
})
);
export const EventTypeModel: z.ZodSchema<CompleteEventType> = z.lazy(() => _EventTypeModel.extend({
users: UserModel.array(),
team: TeamModel.nullish(),
bookings: BookingModel.array(),
availability: AvailabilityModel.array(),
destinationCalendar: DestinationCalendarModel.nullish(),
customInputs: EventTypeCustomInputModel.array(),
Schedule: ScheduleModel.array(),
}))

View File

@ -1,7 +1,7 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { EventTypeCustomInputType } from "@prisma/client";
import { CompleteEventType, EventTypeModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { EventTypeCustomInputType } from "@prisma/client"
import { CompleteEventType, EventTypeModel } from "./index"
export const _EventTypeCustomInputModel = z.object({
id: z.number().int(),
@ -10,10 +10,10 @@ export const _EventTypeCustomInputModel = z.object({
type: z.nativeEnum(EventTypeCustomInputType),
required: z.boolean(),
placeholder: z.string(),
});
})
export interface CompleteEventTypeCustomInput extends z.infer<typeof _EventTypeCustomInputModel> {
eventType: CompleteEventType;
eventType: CompleteEventType
}
/**
@ -21,8 +21,6 @@ export interface CompleteEventTypeCustomInput extends z.infer<typeof _EventTypeC
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const EventTypeCustomInputModel: z.ZodSchema<CompleteEventTypeCustomInput> = z.lazy(() =>
_EventTypeCustomInputModel.extend({
eventType: EventTypeModel,
})
);
export const EventTypeCustomInputModel: z.ZodSchema<CompleteEventTypeCustomInput> = z.lazy(() => _EventTypeCustomInputModel.extend({
eventType: EventTypeModel,
}))

View File

@ -1,19 +1,19 @@
export * from "./eventtype";
export * from "./credential";
export * from "./destinationcalendar";
export * from "./user";
export * from "./team";
export * from "./membership";
export * from "./verificationrequest";
export * from "./bookingreference";
export * from "./attendee";
export * from "./dailyeventreference";
export * from "./booking";
export * from "./schedule";
export * from "./availability";
export * from "./selectedcalendar";
export * from "./eventtypecustominput";
export * from "./resetpasswordrequest";
export * from "./remindermail";
export * from "./payment";
export * from "./webhook";
export * from "./eventtype"
export * from "./credential"
export * from "./destinationcalendar"
export * from "./user"
export * from "./team"
export * from "./membership"
export * from "./verificationrequest"
export * from "./bookingreference"
export * from "./attendee"
export * from "./dailyeventreference"
export * from "./booking"
export * from "./schedule"
export * from "./availability"
export * from "./selectedcalendar"
export * from "./eventtypecustominput"
export * from "./resetpasswordrequest"
export * from "./remindermail"
export * from "./payment"
export * from "./webhook"

View File

@ -1,18 +1,18 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { MembershipRole } from "@prisma/client";
import { CompleteTeam, TeamModel, CompleteUser, UserModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { MembershipRole } from "@prisma/client"
import { CompleteTeam, TeamModel, CompleteUser, UserModel } from "./index"
export const _MembershipModel = z.object({
teamId: z.number().int(),
userId: z.number().int(),
accepted: z.boolean(),
role: z.nativeEnum(MembershipRole),
});
})
export interface CompleteMembership extends z.infer<typeof _MembershipModel> {
team: CompleteTeam;
user: CompleteUser;
team: CompleteTeam
user: CompleteUser
}
/**
@ -20,9 +20,7 @@ export interface CompleteMembership extends z.infer<typeof _MembershipModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const MembershipModel: z.ZodSchema<CompleteMembership> = z.lazy(() =>
_MembershipModel.extend({
team: TeamModel,
user: UserModel,
})
);
export const MembershipModel: z.ZodSchema<CompleteMembership> = z.lazy(() => _MembershipModel.extend({
team: TeamModel,
user: UserModel,
}))

View File

@ -1,15 +1,13 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { PaymentType } from "@prisma/client";
import { CompleteBooking, BookingModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { PaymentType } from "@prisma/client"
import { CompleteBooking, BookingModel } from "./index"
// Helper schema for JSON fields
type Literal = boolean | number | string;
type Json = Literal | { [key: string]: Json } | Json[];
const literalSchema = z.union([z.string(), z.number(), z.boolean()]);
const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)])
);
type Literal = boolean | number | string
type Json = Literal | { [key: string]: Json } | Json[]
const literalSchema = z.union([z.string(), z.number(), z.boolean()])
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
export const _PaymentModel = z.object({
id: z.number().int(),
@ -23,10 +21,10 @@ export const _PaymentModel = z.object({
refunded: z.boolean(),
data: jsonSchema,
externalId: z.string(),
});
})
export interface CompletePayment extends z.infer<typeof _PaymentModel> {
booking?: CompleteBooking | null;
booking?: CompleteBooking | null
}
/**
@ -34,8 +32,6 @@ export interface CompletePayment extends z.infer<typeof _PaymentModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const PaymentModel: z.ZodSchema<CompletePayment> = z.lazy(() =>
_PaymentModel.extend({
booking: BookingModel.nullish(),
})
);
export const PaymentModel: z.ZodSchema<CompletePayment> = z.lazy(() => _PaymentModel.extend({
booking: BookingModel.nullish(),
}))

View File

@ -1,6 +1,6 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { ReminderType } from "@prisma/client";
import * as z from "zod"
import * as imports from "../zod-utils"
import { ReminderType } from "@prisma/client"
export const _ReminderMailModel = z.object({
id: z.number().int(),
@ -8,4 +8,4 @@ export const _ReminderMailModel = z.object({
reminderType: z.nativeEnum(ReminderType),
elapsedMinutes: z.number().int(),
createdAt: z.date(),
});
})

View File

@ -1,5 +1,5 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import * as z from "zod"
import * as imports from "../zod-utils"
export const _ResetPasswordRequestModel = z.object({
id: z.string(),
@ -7,4 +7,4 @@ export const _ResetPasswordRequestModel = z.object({
updatedAt: z.date(),
email: z.string(),
expires: z.date(),
});
})

View File

@ -1,14 +1,12 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteUser, UserModel, CompleteEventType, EventTypeModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteUser, UserModel, CompleteEventType, EventTypeModel } from "./index"
// Helper schema for JSON fields
type Literal = boolean | number | string;
type Json = Literal | { [key: string]: Json } | Json[];
const literalSchema = z.union([z.string(), z.number(), z.boolean()]);
const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)])
);
type Literal = boolean | number | string
type Json = Literal | { [key: string]: Json } | Json[]
const literalSchema = z.union([z.string(), z.number(), z.boolean()])
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
export const _ScheduleModel = z.object({
id: z.number().int(),
@ -16,11 +14,11 @@ export const _ScheduleModel = z.object({
eventTypeId: z.number().int().nullish(),
title: z.string().nullish(),
freeBusyTimes: jsonSchema,
});
})
export interface CompleteSchedule extends z.infer<typeof _ScheduleModel> {
user?: CompleteUser | null;
eventType?: CompleteEventType | null;
user?: CompleteUser | null
eventType?: CompleteEventType | null
}
/**
@ -28,9 +26,7 @@ export interface CompleteSchedule extends z.infer<typeof _ScheduleModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const ScheduleModel: z.ZodSchema<CompleteSchedule> = z.lazy(() =>
_ScheduleModel.extend({
user: UserModel.nullish(),
eventType: EventTypeModel.nullish(),
})
);
export const ScheduleModel: z.ZodSchema<CompleteSchedule> = z.lazy(() => _ScheduleModel.extend({
user: UserModel.nullish(),
eventType: EventTypeModel.nullish(),
}))

View File

@ -1,15 +1,15 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteUser, UserModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteUser, UserModel } from "./index"
export const _SelectedCalendarModel = z.object({
userId: z.number().int(),
integration: z.string(),
externalId: z.string(),
});
})
export interface CompleteSelectedCalendar extends z.infer<typeof _SelectedCalendarModel> {
user: CompleteUser;
user: CompleteUser
}
/**
@ -17,8 +17,6 @@ export interface CompleteSelectedCalendar extends z.infer<typeof _SelectedCalend
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const SelectedCalendarModel: z.ZodSchema<CompleteSelectedCalendar> = z.lazy(() =>
_SelectedCalendarModel.extend({
user: UserModel,
})
);
export const SelectedCalendarModel: z.ZodSchema<CompleteSelectedCalendar> = z.lazy(() => _SelectedCalendarModel.extend({
user: UserModel,
}))

View File

@ -1,6 +1,6 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { CompleteMembership, MembershipModel, CompleteEventType, EventTypeModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { CompleteMembership, MembershipModel, CompleteEventType, EventTypeModel } from "./index"
export const _TeamModel = z.object({
id: z.number().int(),
@ -9,11 +9,11 @@ export const _TeamModel = z.object({
logo: z.string().nullish(),
bio: z.string().nullish(),
hideBranding: z.boolean(),
});
})
export interface CompleteTeam extends z.infer<typeof _TeamModel> {
members: CompleteMembership[];
eventTypes: CompleteEventType[];
members: CompleteMembership[]
eventTypes: CompleteEventType[]
}
/**
@ -21,9 +21,7 @@ export interface CompleteTeam extends z.infer<typeof _TeamModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const TeamModel: z.ZodSchema<CompleteTeam> = z.lazy(() =>
_TeamModel.extend({
members: MembershipModel.array(),
eventTypes: EventTypeModel.array(),
})
);
export const TeamModel: z.ZodSchema<CompleteTeam> = z.lazy(() => _TeamModel.extend({
members: MembershipModel.array(),
eventTypes: EventTypeModel.array(),
}))

View File

@ -1,34 +1,13 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { IdentityProvider, UserPlan } from "@prisma/client";
import {
CompleteEventType,
EventTypeModel,
CompleteCredential,
CredentialModel,
CompleteMembership,
MembershipModel,
CompleteBooking,
BookingModel,
CompleteAvailability,
AvailabilityModel,
CompleteSelectedCalendar,
SelectedCalendarModel,
CompleteSchedule,
ScheduleModel,
CompleteWebhook,
WebhookModel,
CompleteDestinationCalendar,
DestinationCalendarModel,
} from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { IdentityProvider, UserPlan } from "@prisma/client"
import { CompleteEventType, EventTypeModel, CompleteCredential, CredentialModel, CompleteMembership, MembershipModel, CompleteBooking, BookingModel, CompleteAvailability, AvailabilityModel, CompleteSelectedCalendar, SelectedCalendarModel, CompleteSchedule, ScheduleModel, CompleteWebhook, WebhookModel, CompleteDestinationCalendar, DestinationCalendarModel } from "./index"
// Helper schema for JSON fields
type Literal = boolean | number | string;
type Json = Literal | { [key: string]: Json } | Json[];
const literalSchema = z.union([z.string(), z.number(), z.boolean()]);
const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)])
);
type Literal = boolean | number | string
type Json = Literal | { [key: string]: Json } | Json[]
const literalSchema = z.union([z.string(), z.number(), z.boolean()])
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
export const _UserModel = z.object({
id: z.number().int(),
@ -59,18 +38,18 @@ export const _UserModel = z.object({
away: z.boolean(),
metadata: jsonSchema,
verified: z.boolean().nullish(),
});
})
export interface CompleteUser extends z.infer<typeof _UserModel> {
eventTypes: CompleteEventType[];
credentials: CompleteCredential[];
teams: CompleteMembership[];
bookings: CompleteBooking[];
availability: CompleteAvailability[];
selectedCalendars: CompleteSelectedCalendar[];
Schedule: CompleteSchedule[];
webhooks: CompleteWebhook[];
destinationCalendar?: CompleteDestinationCalendar | null;
eventTypes: CompleteEventType[]
credentials: CompleteCredential[]
teams: CompleteMembership[]
bookings: CompleteBooking[]
availability: CompleteAvailability[]
selectedCalendars: CompleteSelectedCalendar[]
Schedule: CompleteSchedule[]
webhooks: CompleteWebhook[]
destinationCalendar?: CompleteDestinationCalendar | null
}
/**
@ -78,16 +57,14 @@ export interface CompleteUser extends z.infer<typeof _UserModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const UserModel: z.ZodSchema<CompleteUser> = z.lazy(() =>
_UserModel.extend({
eventTypes: EventTypeModel.array(),
credentials: CredentialModel.array(),
teams: MembershipModel.array(),
bookings: BookingModel.array(),
availability: AvailabilityModel.array(),
selectedCalendars: SelectedCalendarModel.array(),
Schedule: ScheduleModel.array(),
webhooks: WebhookModel.array(),
destinationCalendar: DestinationCalendarModel.nullish(),
})
);
export const UserModel: z.ZodSchema<CompleteUser> = z.lazy(() => _UserModel.extend({
eventTypes: EventTypeModel.array(),
credentials: CredentialModel.array(),
teams: MembershipModel.array(),
bookings: BookingModel.array(),
availability: AvailabilityModel.array(),
selectedCalendars: SelectedCalendarModel.array(),
Schedule: ScheduleModel.array(),
webhooks: WebhookModel.array(),
destinationCalendar: DestinationCalendarModel.nullish(),
}))

View File

@ -1,5 +1,5 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import * as z from "zod"
import * as imports from "../zod-utils"
export const _VerificationRequestModel = z.object({
id: z.number().int(),
@ -8,4 +8,4 @@ export const _VerificationRequestModel = z.object({
expires: z.date(),
createdAt: z.date(),
updatedAt: z.date(),
});
})

View File

@ -1,7 +1,7 @@
import * as z from "zod";
import * as imports from "../zod-utils";
import { WebhookTriggerEvents } from "@prisma/client";
import { CompleteUser, UserModel } from "./index";
import * as z from "zod"
import * as imports from "../zod-utils"
import { WebhookTriggerEvents } from "@prisma/client"
import { CompleteUser, UserModel } from "./index"
export const _WebhookModel = z.object({
id: z.string(),
@ -11,10 +11,10 @@ export const _WebhookModel = z.object({
createdAt: z.date(),
active: z.boolean(),
eventTriggers: z.nativeEnum(WebhookTriggerEvents).array(),
});
})
export interface CompleteWebhook extends z.infer<typeof _WebhookModel> {
user: CompleteUser;
user: CompleteUser
}
/**
@ -22,8 +22,6 @@ export interface CompleteWebhook extends z.infer<typeof _WebhookModel> {
*
* NOTE: Lazy required in case of potential circular dependencies within schema
*/
export const WebhookModel: z.ZodSchema<CompleteWebhook> = z.lazy(() =>
_WebhookModel.extend({
user: UserModel,
})
);
export const WebhookModel: z.ZodSchema<CompleteWebhook> = z.lazy(() => _WebhookModel.extend({
user: UserModel,
}))