@ordinatio/scheduling-api 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,553 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/schemas/index.ts
21
- var schemas_exports = {};
22
- __export(schemas_exports, {
23
- ApiKeySchema: () => ApiKeySchema,
24
- BookingPageConfigSchema: () => BookingPageConfigSchema,
25
- BookingPageThemeSchema: () => BookingPageThemeSchema,
26
- BrandSchema: () => BrandSchema,
27
- CancelRecurringScopeSchema: () => CancelRecurringScopeSchema,
28
- CancelRecurringSeriesSchema: () => CancelRecurringSeriesSchema,
29
- CreateAppointmentCategorySchema: () => CreateAppointmentCategorySchema,
30
- CreateAppointmentTypeSchema: () => CreateAppointmentTypeSchema,
31
- CreateAvailabilityRuleSchema: () => CreateAvailabilityRuleSchema,
32
- CreateCalendarSchema: () => CreateCalendarSchema,
33
- CreateCouponCodeSchema: () => CreateCouponCodeSchema,
34
- CreateNotificationTemplateSchema: () => CreateNotificationTemplateSchema,
35
- CreatePackagePurchaseSchema: () => CreatePackagePurchaseSchema,
36
- CreateRecurringSeriesSchema: () => CreateRecurringSeriesSchema,
37
- CreateRoutingFormSchema: () => CreateRoutingFormSchema,
38
- CreateServicePackageSchema: () => CreateServicePackageSchema,
39
- CreateWebhookEndpointSchema: () => CreateWebhookEndpointSchema,
40
- DEFAULT_CANCELLATION_POLICY: () => DEFAULT_CANCELLATION_POLICY,
41
- IntakeFormFieldSchema: () => IntakeFormFieldSchema,
42
- NoShowPreventionActionSchema: () => NoShowPreventionActionSchema,
43
- NotificationChannelSchema: () => NotificationChannelSchema,
44
- NotificationTriggerSchema: () => NotificationTriggerSchema,
45
- OrgCancellationPolicySchema: () => OrgCancellationPolicySchema,
46
- PrivacyEraseSchema: () => PrivacyEraseSchema,
47
- PrivacySubjectSchema: () => PrivacySubjectSchema,
48
- RecurringFrequencySchema: () => RecurringFrequencySchema,
49
- RouteClientSchema: () => RouteClientSchema,
50
- SLOT_GRANULARITY_DEFAULT: () => SLOT_GRANULARITY_DEFAULT,
51
- SLOT_GRANULARITY_OPTIONS: () => SLOT_GRANULARITY_OPTIONS,
52
- TestRoutingFormSchema: () => TestRoutingFormSchema,
53
- TextSettingsSchema: () => TextSettingsSchema,
54
- UpdateAppointmentCategorySchema: () => UpdateAppointmentCategorySchema,
55
- UpdateAppointmentTypeSchema: () => UpdateAppointmentTypeSchema,
56
- UpdateBookingPageSchema: () => UpdateBookingPageSchema,
57
- UpdateCalendarSchema: () => UpdateCalendarSchema,
58
- UpdateCouponCodeSchema: () => UpdateCouponCodeSchema,
59
- UpdateNotificationTemplateSchema: () => UpdateNotificationTemplateSchema,
60
- UpdatePackagePurchaseSchema: () => UpdatePackagePurchaseSchema,
61
- UpdateRoutingFormSchema: () => UpdateRoutingFormSchema,
62
- UpdateServicePackageSchema: () => UpdateServicePackageSchema
63
- });
64
- module.exports = __toCommonJS(schemas_exports);
65
-
66
- // src/schemas/types-calendars.schema.ts
67
- var import_zod2 = require("zod");
68
-
69
- // src/schemas/helpers.ts
70
- var import_zod = require("zod");
71
- var optionalString = (maxLength, fieldName) => import_zod.z.string().optional().nullable().transform((val) => val?.trim() || null).refine((val) => val === null || val.length <= maxLength, {
72
- message: `${fieldName} must be less than ${maxLength} characters`
73
- });
74
- var optionalStringKeptWhenOmitted = (maxLength, fieldName) => import_zod.z.string().nullable().optional().transform((val) => val === void 0 ? void 0 : val?.trim() || null).refine((val) => val == null || val.length <= maxLength, {
75
- message: `${fieldName} must be less than ${maxLength} characters`
76
- });
77
- var optionalPrice = import_zod.z.number().min(0, { message: "Cannot be negative" }).optional().nullable();
78
- function partialWithoutDefaults(shape) {
79
- const stripped = {};
80
- for (const key of Object.keys(shape)) {
81
- const field = shape[key];
82
- stripped[key] = field instanceof import_zod.z.ZodDefault ? field.unwrap() : field;
83
- }
84
- return import_zod.z.object(stripped).partial();
85
- }
86
-
87
- // src/schemas/types-calendars.schema.ts
88
- var OPTION_TYPES = ["select", "radio", "checkbox"];
89
- var ShowIfSchema = import_zod2.z.object({
90
- fieldId: import_zod2.z.string().min(1).max(100),
91
- operator: import_zod2.z.enum(["equals", "not_equals", "contains", "is_empty", "is_not_empty"]),
92
- value: import_zod2.z.string().max(500)
93
- });
94
- var IntakeFormFieldSchema = import_zod2.z.object({
95
- id: import_zod2.z.string().min(1).max(100),
96
- type: import_zod2.z.enum([
97
- "text",
98
- "email",
99
- "phone",
100
- "textarea",
101
- "select",
102
- "checkbox",
103
- "radio",
104
- "date",
105
- "number"
106
- ]),
107
- label: import_zod2.z.string().min(1).max(255),
108
- placeholder: import_zod2.z.string().max(255).optional(),
109
- required: import_zod2.z.boolean(),
110
- options: import_zod2.z.array(import_zod2.z.string().min(1).max(100)).max(50).optional(),
111
- showIf: ShowIfSchema.optional()
112
- }).superRefine((field, ctx) => {
113
- if (OPTION_TYPES.includes(field.type)) {
114
- if (!field.options || field.options.length === 0) {
115
- ctx.addIssue({
116
- code: import_zod2.z.ZodIssueCode.custom,
117
- path: ["options"],
118
- message: `${field.type} fields must have at least one option`
119
- });
120
- }
121
- }
122
- });
123
- var AppointmentTypeBaseSchema = import_zod2.z.object({
124
- name: import_zod2.z.string().transform((val) => val.trim()).refine((val) => val.length >= 1, { message: "Name is required" }).refine((val) => val.length <= 100, { message: "Name must be less than 100 characters" }),
125
- description: optionalString(500, "Description"),
126
- location: import_zod2.z.string().max(500).optional().nullable(),
127
- locationType: import_zod2.z.enum(["IN_PERSON", "TRAVEL_TO_CLIENT", "VIRTUAL", "PHONE"]).optional().default("IN_PERSON"),
128
- duration: import_zod2.z.number().int({ message: "Duration must be a whole number" }).min(5, { message: "Duration must be at least 5 minutes" }).max(480, { message: "Duration cannot exceed 8 hours" }),
129
- color: import_zod2.z.string().regex(/^#[0-9A-Fa-f]{6}$/, { message: "Color must be a valid hex code" }).optional().default("#3B82F6"),
130
- categoryId: import_zod2.z.string().optional().nullable(),
131
- price: optionalPrice,
132
- deposit: optionalPrice,
133
- requiresPayment: import_zod2.z.boolean().optional().default(false),
134
- requiresApproval: import_zod2.z.boolean().optional().default(false),
135
- allowReschedule: import_zod2.z.boolean().optional().default(true),
136
- allowCancel: import_zod2.z.boolean().optional().default(true),
137
- cancelDeadlineHrs: import_zod2.z.number().int().min(0, { message: "Cancel deadline cannot be negative" }).max(720, { message: "Cancel deadline cannot exceed 30 days" }).optional().default(24),
138
- reminder1MinsBefore: import_zod2.z.number().int().min(0, { message: "Cannot be negative" }).max(10080, { message: "Cannot exceed 7 days" }).optional().default(1440),
139
- reminder2MinsBefore: import_zod2.z.number().int().min(0, { message: "Cannot be negative" }).max(10080, { message: "Cannot exceed 7 days" }).optional().default(60),
140
- followupMinsAfter: import_zod2.z.number().int().min(0, { message: "Cannot be negative" }).max(10080, { message: "Cannot exceed 7 days" }).optional().default(120),
141
- isGroup: import_zod2.z.boolean().optional().default(false),
142
- maxSeats: import_zod2.z.number().int().min(2, { message: "Group must have at least 2 seats" }).optional().nullable(),
143
- intakeForm: import_zod2.z.array(IntakeFormFieldSchema).optional().nullable(),
144
- calendarIds: import_zod2.z.array(import_zod2.z.string()).optional(),
145
- // Left unset on create, the package stores 'NONE'. On update, an omitted value keeps the stored one.
146
- assignmentStrategy: import_zod2.z.enum(["NONE", "ROUND_ROBIN", "LOAD_BALANCED"]).optional(),
147
- sortOrder: import_zod2.z.number().int().optional().default(0)
148
- });
149
- function validateReminderTiming(data, ctx) {
150
- const r1 = data.reminder1MinsBefore ?? 0;
151
- const r2 = data.reminder2MinsBefore ?? 0;
152
- if (r1 > 0 && r2 > 0 && r1 === r2) {
153
- ctx.addIssue({
154
- code: import_zod2.z.ZodIssueCode.custom,
155
- path: ["reminder2MinsBefore"],
156
- message: "Second reminder must be at a different time than the first reminder"
157
- });
158
- }
159
- }
160
- var GROUP_SEATS_REQUIRED = "Group appointments must specify a maximum number of seats";
161
- var CreateAppointmentTypeSchema = AppointmentTypeBaseSchema.superRefine((data, ctx) => {
162
- if (data.isGroup && !data.maxSeats) {
163
- ctx.addIssue({
164
- code: import_zod2.z.ZodIssueCode.custom,
165
- path: ["maxSeats"],
166
- message: GROUP_SEATS_REQUIRED
167
- });
168
- }
169
- validateReminderTiming(data, ctx);
170
- });
171
- var UpdateAppointmentTypeSchema = partialWithoutDefaults(AppointmentTypeBaseSchema.shape).extend({
172
- description: optionalStringKeptWhenOmitted(500, "Description"),
173
- isActive: import_zod2.z.boolean().optional()
174
- }).superRefine((data, ctx) => {
175
- if (data.isGroup === true && data.maxSeats === null) {
176
- ctx.addIssue({ code: import_zod2.z.ZodIssueCode.custom, path: ["maxSeats"], message: GROUP_SEATS_REQUIRED });
177
- }
178
- validateReminderTiming(data, ctx);
179
- });
180
- var SLOT_GRANULARITY_OPTIONS = [5, 10, 15, 30, 60];
181
- var SLOT_GRANULARITY_DEFAULT = 15;
182
- var CreateCalendarSchema = import_zod2.z.object({
183
- name: import_zod2.z.string().transform((v) => v.trim()).refine((v) => v.length >= 1, { message: "Name is required" }).refine((v) => v.length <= 100, { message: "Name must be less than 100 characters" }),
184
- type: import_zod2.z.enum(["STAFF", "LOCATION", "RESOURCE"]).default("STAFF"),
185
- // The same fallback zone is written separately in several places in the scheduling code.
186
- timezone: import_zod2.z.string().min(1, { message: "Timezone is required" }).max(100, { message: "Timezone must be less than 100 characters" }).default("America/New_York"),
187
- staffName: import_zod2.z.string().max(100).optional().nullable(),
188
- staffEmail: import_zod2.z.string().email({ message: "Invalid email address" }).optional().nullable(),
189
- staffAvatar: import_zod2.z.string().url({ message: "Invalid URL" }).max(500).optional().nullable(),
190
- // Explicit staff link — validated against a real OrganizationMembership by
191
- // validateCalendarStaffUserId() at the route layer (this schema only
192
- // checks shape, not cross-org membership). No .default() — must flow
193
- // through UpdateCalendarSchema's partialWithoutDefaults() unchanged so an
194
- // omitted key means "leave unchanged," not "reset to undefined-as-null".
195
- userId: import_zod2.z.string().cuid({ message: "Invalid user id" }).optional().nullable(),
196
- location: import_zod2.z.string().max(200).optional().nullable(),
197
- slotGranularityMinutes: import_zod2.z.union(
198
- SLOT_GRANULARITY_OPTIONS.map((v) => import_zod2.z.literal(v))
199
- ).optional().default(SLOT_GRANULARITY_DEFAULT)
200
- });
201
- var UpdateCalendarSchema = partialWithoutDefaults(CreateCalendarSchema.shape).extend({
202
- isActive: import_zod2.z.boolean().optional(),
203
- syncDirection: import_zod2.z.enum(["one-way", "two-way"]).optional()
204
- });
205
- var UNSAFE_CSS_VALUE = /[;{}`@\\\n\r]|url\s*\(|expression\s*\(|(?:^|[^\w-])(?:-[a-z]+-)?(?:image-set|image|src|cross-fade|element|paint)\s*\(/i;
206
- var themeValue = (max) => import_zod2.z.string().max(max).refine((v) => !UNSAFE_CSS_VALUE.test(v), { message: "Contains characters that are not allowed in a theme value" });
207
- var BookingPageThemeSchema = import_zod2.z.object({
208
- primaryColor: themeValue(50).optional(),
209
- accentColor: themeValue(50).optional(),
210
- backgroundColor: themeValue(50).optional(),
211
- textColor: themeValue(50).optional(),
212
- mutedTextColor: themeValue(50).optional(),
213
- borderColor: themeValue(50).optional(),
214
- borderRadius: themeValue(20).optional(),
215
- fontFamily: themeValue(200).optional()
216
- });
217
- var BookingPageConfigSchema = import_zod2.z.object({
218
- title: import_zod2.z.string().max(100).optional().nullable(),
219
- description: import_zod2.z.string().max(500).optional().nullable(),
220
- logoUrl: import_zod2.z.string().url().max(500).refine(
221
- (v) => /^https:\/\//i.test(v),
222
- { message: "Logo URL must use https://" }
223
- ).optional().nullable(),
224
- confirmationMessage: import_zod2.z.string().max(500).optional().nullable(),
225
- redirectUrl: import_zod2.z.string().url().max(500).refine(
226
- (v) => /^https:\/\//i.test(v),
227
- { message: "Redirect URL must use https://" }
228
- ).optional().nullable(),
229
- redirectDelay: import_zod2.z.number().int().min(0).max(30).optional().default(5),
230
- showContactInfo: import_zod2.z.boolean().optional().default(true)
231
- });
232
- var UpdateBookingPageSchema = import_zod2.z.object({
233
- theme: BookingPageThemeSchema.optional().nullable(),
234
- config: BookingPageConfigSchema.optional().nullable()
235
- });
236
-
237
- // src/schemas/billing.schema.ts
238
- var import_zod3 = require("zod");
239
- var CreateServicePackageSchema = import_zod3.z.object({
240
- name: import_zod3.z.string().transform((v) => v.trim()).refine((v) => v.length >= 1, { message: "Name is required" }).refine((v) => v.length <= 100, { message: "Name must be less than 100 characters" }),
241
- description: optionalString(500, "Description"),
242
- price: import_zod3.z.number().min(0.01, { message: "Price must be greater than zero" }).max(99999, { message: "Price is unreasonably large" }),
243
- sessions: import_zod3.z.number().int().min(1, { message: "Must include at least 1 session" }).max(1e3, { message: "Cannot exceed 1000 sessions" }),
244
- validDays: import_zod3.z.number().int().min(1).max(3650, { message: "Cannot exceed 10 years" }).default(365),
245
- typeId: import_zod3.z.string().optional().nullable()
246
- });
247
- var UpdateServicePackageSchema = partialWithoutDefaults(CreateServicePackageSchema.shape).extend({
248
- description: optionalStringKeptWhenOmitted(500, "Description"),
249
- isActive: import_zod3.z.boolean().optional()
250
- });
251
- var CreatePackagePurchaseSchema = import_zod3.z.object({
252
- packageId: import_zod3.z.string().min(1),
253
- clientEmail: import_zod3.z.string().email(),
254
- clientName: import_zod3.z.string().trim().max(200).optional(),
255
- notes: import_zod3.z.string().max(1e3).optional(),
256
- // ISO string for expiry override — defaults to purchasedAt + package.validDays if absent
257
- expiresAt: import_zod3.z.string().datetime().optional()
258
- }).superRefine((data, ctx) => {
259
- if (data.expiresAt && new Date(data.expiresAt) <= /* @__PURE__ */ new Date()) {
260
- ctx.addIssue({
261
- code: import_zod3.z.ZodIssueCode.custom,
262
- path: ["expiresAt"],
263
- message: "Expiry date must be in the future"
264
- });
265
- }
266
- });
267
- var UpdatePackagePurchaseSchema = import_zod3.z.object({
268
- clientName: import_zod3.z.string().trim().max(200).optional(),
269
- clientEmail: import_zod3.z.string().trim().email().optional(),
270
- notes: import_zod3.z.string().max(1e3).optional(),
271
- status: import_zod3.z.enum(["ACTIVE", "CANCELLED"]).optional()
272
- });
273
- var CouponCodeBaseSchema = import_zod3.z.object({
274
- code: import_zod3.z.string().transform((v) => v.trim().toUpperCase()).refine((v) => v.length >= 3, { message: "Code must be at least 3 characters" }).refine((v) => v.length <= 50, { message: "Code must be less than 50 characters" }).refine(
275
- (v) => /^[A-Z0-9_-]+$/.test(v),
276
- { message: "Code can only contain letters, numbers, hyphens, and underscores" }
277
- ),
278
- discountType: import_zod3.z.enum(["PERCENTAGE", "FLAT"], {
279
- message: "Discount type must be PERCENTAGE or FLAT"
280
- }),
281
- discountValue: import_zod3.z.number().min(0.01, { message: "Discount value must be greater than 0" }).max(1e5, { message: "Discount value is unreasonably large" }),
282
- maxUses: import_zod3.z.number().int().min(1).optional().nullable(),
283
- expiresAt: import_zod3.z.string().datetime().optional().nullable()
284
- });
285
- var CreateCouponCodeSchema = CouponCodeBaseSchema.superRefine((data, ctx) => {
286
- if (data.discountType === "PERCENTAGE" && data.discountValue > 100) {
287
- ctx.addIssue({
288
- code: import_zod3.z.ZodIssueCode.custom,
289
- path: ["discountValue"],
290
- message: "Percentage discount cannot exceed 100%"
291
- });
292
- }
293
- });
294
- var UpdateCouponCodeSchema = CouponCodeBaseSchema.partial().extend({
295
- isActive: import_zod3.z.boolean().optional()
296
- });
297
-
298
- // src/schemas/policy-templates.schema.ts
299
- var import_zod4 = require("zod");
300
- var CancellationFeeBaseSchema = import_zod4.z.object({
301
- enabled: import_zod4.z.boolean().default(false),
302
- amount: import_zod4.z.number().min(0).max(1e4).optional().nullable(),
303
- feeType: import_zod4.z.enum(["FLAT", "PERCENTAGE"]).default("FLAT")
304
- });
305
- var NoShowPreventionActionSchema = import_zod4.z.enum(["REQUIRE_APPROVAL", "BLOCK_BOOKING"]);
306
- var NoShowPreventionSchema = import_zod4.z.object({
307
- enabled: import_zod4.z.boolean().default(false),
308
- threshold: import_zod4.z.number().int().min(1).max(20).default(2),
309
- action: NoShowPreventionActionSchema.default("REQUIRE_APPROVAL")
310
- });
311
- var OrgCancellationPolicySchema = import_zod4.z.object({
312
- defaultAllowCancel: import_zod4.z.boolean().default(true),
313
- defaultCancelDeadlineHrs: import_zod4.z.number().int().min(0).max(720).default(24),
314
- noShowFee: CancellationFeeBaseSchema,
315
- lateCancelFee: CancellationFeeBaseSchema,
316
- requireCardOnFile: import_zod4.z.boolean().default(false),
317
- noShowPrevention: NoShowPreventionSchema.default({ enabled: false, threshold: 2, action: "REQUIRE_APPROVAL" }),
318
- // Transport field for optimistic locking — destructured out before DB write, never stored.
319
- clientUpdatedAt: import_zod4.z.string().datetime().optional()
320
- }).superRefine((data, ctx) => {
321
- if (data.noShowFee.enabled && !data.noShowFee.amount) {
322
- ctx.addIssue({
323
- code: import_zod4.z.ZodIssueCode.custom,
324
- path: ["noShowFee", "amount"],
325
- message: "No-show fee amount is required when no-show fee is enabled"
326
- });
327
- }
328
- if (data.lateCancelFee.enabled && !data.lateCancelFee.amount) {
329
- ctx.addIssue({
330
- code: import_zod4.z.ZodIssueCode.custom,
331
- path: ["lateCancelFee", "amount"],
332
- message: "Late cancel fee amount is required when late cancel fee is enabled"
333
- });
334
- }
335
- if (data.noShowFee.feeType === "PERCENTAGE" && (data.noShowFee.amount ?? 0) > 100) {
336
- ctx.addIssue({
337
- code: import_zod4.z.ZodIssueCode.custom,
338
- path: ["noShowFee", "amount"],
339
- message: "Percentage fee cannot exceed 100%"
340
- });
341
- }
342
- if (data.lateCancelFee.feeType === "PERCENTAGE" && (data.lateCancelFee.amount ?? 0) > 100) {
343
- ctx.addIssue({
344
- code: import_zod4.z.ZodIssueCode.custom,
345
- path: ["lateCancelFee", "amount"],
346
- message: "Percentage fee cannot exceed 100%"
347
- });
348
- }
349
- });
350
- var DEFAULT_CANCELLATION_POLICY = {
351
- defaultAllowCancel: true,
352
- defaultCancelDeadlineHrs: 24,
353
- noShowFee: { enabled: false, amount: null, feeType: "FLAT" },
354
- lateCancelFee: { enabled: false, amount: null, feeType: "FLAT" },
355
- requireCardOnFile: false,
356
- noShowPrevention: { enabled: false, threshold: 2, action: "REQUIRE_APPROVAL" }
357
- };
358
- var CreateAppointmentCategorySchema = import_zod4.z.object({
359
- name: import_zod4.z.string().transform((val) => val.trim()).refine((val) => val.length >= 1, { message: "Category name is required" }).refine((val) => val.length <= 50, { message: "Category name must be less than 50 characters" })
360
- });
361
- var UpdateAppointmentCategorySchema = import_zod4.z.object({
362
- name: import_zod4.z.string().transform((val) => val.trim()).refine((val) => val.length >= 1, { message: "Category name is required" }).refine((val) => val.length <= 50, { message: "Category name must be less than 50 characters" }).optional(),
363
- sortOrder: import_zod4.z.number().int({ message: "Sort order must be a whole number" }).min(0, { message: "Sort order cannot be negative" }).optional()
364
- });
365
- var NotificationChannelSchema = import_zod4.z.enum(["EMAIL", "SMS"]);
366
- var NotificationTriggerSchema = import_zod4.z.enum([
367
- "CONFIRMATION",
368
- "REMINDER_24H",
369
- "REMINDER_1H",
370
- "FOLLOWUP",
371
- "CANCELLATION",
372
- "RESCHEDULE"
373
- ]);
374
- var CreateNotificationTemplateSchema = import_zod4.z.object({
375
- name: import_zod4.z.string().transform((val) => val.trim()).refine((val) => val.length >= 1, { message: "Name is required" }).refine((val) => val.length <= 100, { message: "Name must be less than 100 characters" }),
376
- channel: NotificationChannelSchema,
377
- trigger: NotificationTriggerSchema,
378
- recipientType: import_zod4.z.enum(["CLIENT", "STAFF"]).default("CLIENT"),
379
- subject: optionalString(200, "Subject"),
380
- body: import_zod4.z.string().transform((val) => val.trim()).refine((val) => val.length >= 1, { message: "Template body is required" }).refine((val) => val.length <= 5e3, { message: "Template body must be less than 5000 characters" }),
381
- isActive: import_zod4.z.boolean().optional().default(true)
382
- });
383
- var UpdateNotificationTemplateSchema = import_zod4.z.object({
384
- name: import_zod4.z.string().transform((val) => val.trim()).refine((val) => val.length >= 1, { message: "Name is required" }).refine((val) => val.length <= 100, { message: "Name must be less than 100 characters" }).optional(),
385
- subject: import_zod4.z.string().max(200, { message: "Subject must be less than 200 characters" }).nullable().optional(),
386
- body: import_zod4.z.string().transform((val) => val.trim()).refine((val) => val.length >= 1, { message: "Template body is required" }).refine((val) => val.length <= 5e3, { message: "Template body must be less than 5000 characters" }).optional(),
387
- isActive: import_zod4.z.boolean().optional()
388
- });
389
- var CreateAvailabilityRuleSchema = import_zod4.z.object({
390
- dayOfWeek: import_zod4.z.number().int().min(0).max(6).optional().nullable(),
391
- startTime: import_zod4.z.string().regex(/^\d{2}:\d{2}$/, { message: "Start time must be in HH:MM format" }),
392
- endTime: import_zod4.z.string().regex(/^\d{2}:\d{2}$/, { message: "End time must be in HH:MM format" }),
393
- specificDate: import_zod4.z.string().datetime().optional().nullable(),
394
- isBlocked: import_zod4.z.boolean().optional().default(false),
395
- blockReason: optionalString(200, "Block reason"),
396
- bufferBefore: import_zod4.z.number().int().min(0).max(120).optional().default(0),
397
- bufferAfter: import_zod4.z.number().int().min(0).max(120).optional().default(15),
398
- minNotice: import_zod4.z.number().int().min(0).max(10080).optional().default(60),
399
- maxAdvanceBooking: import_zod4.z.number().int().min(1).max(365).optional().default(60),
400
- maxPerDay: import_zod4.z.number().int().min(1).optional().nullable()
401
- });
402
- var RecurringFrequencySchema = import_zod4.z.enum(["DAILY", "WEEKLY", "BIWEEKLY", "MONTHLY"]);
403
- var CreateRecurringSeriesSchema = import_zod4.z.object({
404
- calendarId: import_zod4.z.string().min(1),
405
- typeId: import_zod4.z.string().min(1),
406
- frequency: RecurringFrequencySchema,
407
- // Must match the pure function constraint: 1..104
408
- occurrences: import_zod4.z.number().int().min(1, { message: "Must have at least 1 occurrence" }).max(104, { message: "Cannot exceed 104 occurrences (~2 years weekly)" }),
409
- // "HH:MM" 24-hour local time — validated by parseTimeLocal in the pure module
410
- startTimeLocal: import_zod4.z.string().regex(/^\d{2}:\d{2}$/, { message: "startTimeLocal must be in HH:MM format" }),
411
- // ISO-8601 date string for the first occurrence (YYYY-MM-DD accepted)
412
- firstDate: import_zod4.z.string().min(1, { message: "firstDate is required" }),
413
- // Same fallback zone as CreateCalendarSchema.timezone.
414
- timezone: import_zod4.z.string().min(1).max(100).default("America/New_York"),
415
- // Optional hard upper-bound; occurrences falling after this are dropped
416
- endsAt: import_zod4.z.string().datetime().optional().nullable(),
417
- clientEmail: import_zod4.z.string().email(),
418
- clientName: import_zod4.z.string().trim().min(1).max(200),
419
- clientPhone: import_zod4.z.string().max(30).optional().nullable(),
420
- clientId: import_zod4.z.string().optional().nullable(),
421
- notes: import_zod4.z.string().max(1e3).optional().nullable()
422
- });
423
- var CancelRecurringScopeSchema = import_zod4.z.enum(["ONE", "THIS_AND_FOLLOWING", "ALL"]);
424
- var CancelRecurringSeriesSchema = import_zod4.z.object({
425
- scope: CancelRecurringScopeSchema,
426
- // Required for ONE and THIS_AND_FOLLOWING — which appointment is the pivot
427
- fromAppointmentId: import_zod4.z.string().optional()
428
- }).superRefine((data, ctx) => {
429
- if ((data.scope === "ONE" || data.scope === "THIS_AND_FOLLOWING") && !data.fromAppointmentId) {
430
- ctx.addIssue({
431
- code: import_zod4.z.ZodIssueCode.custom,
432
- path: ["fromAppointmentId"],
433
- message: "fromAppointmentId is required for ONE and THIS_AND_FOLLOWING scope"
434
- });
435
- }
436
- });
437
-
438
- // src/schemas/webhooks.schema.ts
439
- var import_zod5 = require("zod");
440
- var CreateWebhookEndpointSchema = import_zod5.z.object({
441
- url: import_zod5.z.string().trim().min(1, { message: "Address is required" }).max(2e3, { message: "Address is too long" }),
442
- eventTypes: import_zod5.z.array(import_zod5.z.string().max(64)).min(1, { message: "Choose at least one event" }).max(20),
443
- description: optionalString(200, "Description")
444
- });
445
-
446
- // src/schemas/routing.schema.ts
447
- var import_zod6 = require("zod");
448
- var bounded = {
449
- name: import_zod6.z.string().max(200),
450
- slug: import_zod6.z.string().max(100),
451
- description: import_zod6.z.string().max(1e3).nullable().optional(),
452
- isActive: import_zod6.z.boolean().optional(),
453
- questions: import_zod6.z.array(import_zod6.z.unknown()).max(30),
454
- rules: import_zod6.z.array(import_zod6.z.unknown()).max(60),
455
- fallback: import_zod6.z.unknown()
456
- };
457
- var CreateRoutingFormSchema = import_zod6.z.object({
458
- ...bounded,
459
- fallback: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown())
460
- });
461
- var UpdateRoutingFormSchema = import_zod6.z.object({ ...bounded, fallback: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()) }).partial().refine((value) => Object.keys(value).length > 0, { message: "Send at least one field to change" });
462
- var RouteClientSchema = import_zod6.z.object({
463
- slug: import_zod6.z.string().min(1).max(100),
464
- orgSlug: import_zod6.z.string().min(1).max(100).optional(),
465
- answers: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown())
466
- });
467
- var TestRoutingFormSchema = import_zod6.z.object({ answers: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()) });
468
-
469
- // src/schemas/privacy.schema.ts
470
- var import_zod7 = require("zod");
471
- var subject = {
472
- email: import_zod7.z.string().max(320).optional(),
473
- clientId: import_zod7.z.string().max(200).optional()
474
- };
475
- var namesSomeone = (value) => Boolean(value.email?.trim() || value.clientId?.trim());
476
- var namesSomeoneMessage = { message: "Send an email address, a client id, or both" };
477
- var PrivacySubjectSchema = import_zod7.z.object(subject).strict().refine(namesSomeone, namesSomeoneMessage);
478
- var PrivacyEraseSchema = import_zod7.z.object({ ...subject, confirm: import_zod7.z.boolean().optional() }).strict().refine(namesSomeone, namesSomeoneMessage);
479
-
480
- // src/schemas/brand.schema.ts
481
- var import_zod8 = require("zod");
482
- var optionalText = (max) => import_zod8.z.string().max(max).nullable().optional();
483
- var BrandSchema = import_zod8.z.object({
484
- displayName: import_zod8.z.string().max(200),
485
- logoUrl: optionalText(1e3),
486
- primaryColor: optionalText(20),
487
- accentColor: optionalText(20),
488
- backgroundColor: optionalText(20),
489
- textColor: optionalText(20),
490
- fontFamily: optionalText(200),
491
- footerText: optionalText(1e3),
492
- replyToEmail: optionalText(400),
493
- fromName: optionalText(200),
494
- fromEmail: optionalText(400)
495
- }).strict();
496
-
497
- // src/schemas/text-settings.schema.ts
498
- var import_zod9 = require("zod");
499
- var TextSettingsSchema = import_zod9.z.object({
500
- provider: import_zod9.z.string().max(40),
501
- fromNumber: import_zod9.z.string().max(40),
502
- enabled: import_zod9.z.boolean().optional()
503
- }).strict();
504
-
505
- // src/schemas/api-key.schema.ts
506
- var import_zod10 = require("zod");
507
- var ApiKeySchema = import_zod10.z.object({
508
- name: import_zod10.z.string().max(200),
509
- access: import_zod10.z.string().max(20)
510
- }).strict();
511
- // Annotate the CommonJS export names for ESM import in node:
512
- 0 && (module.exports = {
513
- ApiKeySchema,
514
- BookingPageConfigSchema,
515
- BookingPageThemeSchema,
516
- BrandSchema,
517
- CancelRecurringScopeSchema,
518
- CancelRecurringSeriesSchema,
519
- CreateAppointmentCategorySchema,
520
- CreateAppointmentTypeSchema,
521
- CreateAvailabilityRuleSchema,
522
- CreateCalendarSchema,
523
- CreateCouponCodeSchema,
524
- CreateNotificationTemplateSchema,
525
- CreatePackagePurchaseSchema,
526
- CreateRecurringSeriesSchema,
527
- CreateRoutingFormSchema,
528
- CreateServicePackageSchema,
529
- CreateWebhookEndpointSchema,
530
- DEFAULT_CANCELLATION_POLICY,
531
- IntakeFormFieldSchema,
532
- NoShowPreventionActionSchema,
533
- NotificationChannelSchema,
534
- NotificationTriggerSchema,
535
- OrgCancellationPolicySchema,
536
- PrivacyEraseSchema,
537
- PrivacySubjectSchema,
538
- RecurringFrequencySchema,
539
- RouteClientSchema,
540
- SLOT_GRANULARITY_DEFAULT,
541
- SLOT_GRANULARITY_OPTIONS,
542
- TestRoutingFormSchema,
543
- TextSettingsSchema,
544
- UpdateAppointmentCategorySchema,
545
- UpdateAppointmentTypeSchema,
546
- UpdateBookingPageSchema,
547
- UpdateCalendarSchema,
548
- UpdateCouponCodeSchema,
549
- UpdateNotificationTemplateSchema,
550
- UpdatePackagePurchaseSchema,
551
- UpdateRoutingFormSchema,
552
- UpdateServicePackageSchema
553
- });
@@ -1,84 +0,0 @@
1
- import {
2
- ApiKeySchema,
3
- BookingPageConfigSchema,
4
- BookingPageThemeSchema,
5
- BrandSchema,
6
- CancelRecurringScopeSchema,
7
- CancelRecurringSeriesSchema,
8
- CreateAppointmentCategorySchema,
9
- CreateAppointmentTypeSchema,
10
- CreateAvailabilityRuleSchema,
11
- CreateCalendarSchema,
12
- CreateCouponCodeSchema,
13
- CreateNotificationTemplateSchema,
14
- CreatePackagePurchaseSchema,
15
- CreateRecurringSeriesSchema,
16
- CreateRoutingFormSchema,
17
- CreateServicePackageSchema,
18
- CreateWebhookEndpointSchema,
19
- DEFAULT_CANCELLATION_POLICY,
20
- IntakeFormFieldSchema,
21
- NoShowPreventionActionSchema,
22
- NotificationChannelSchema,
23
- NotificationTriggerSchema,
24
- OrgCancellationPolicySchema,
25
- PrivacyEraseSchema,
26
- PrivacySubjectSchema,
27
- RecurringFrequencySchema,
28
- RouteClientSchema,
29
- SLOT_GRANULARITY_DEFAULT,
30
- SLOT_GRANULARITY_OPTIONS,
31
- TestRoutingFormSchema,
32
- TextSettingsSchema,
33
- UpdateAppointmentCategorySchema,
34
- UpdateAppointmentTypeSchema,
35
- UpdateBookingPageSchema,
36
- UpdateCalendarSchema,
37
- UpdateCouponCodeSchema,
38
- UpdateNotificationTemplateSchema,
39
- UpdatePackagePurchaseSchema,
40
- UpdateRoutingFormSchema,
41
- UpdateServicePackageSchema
42
- } from "../chunk-X5BVCLX6.mjs";
43
- export {
44
- ApiKeySchema,
45
- BookingPageConfigSchema,
46
- BookingPageThemeSchema,
47
- BrandSchema,
48
- CancelRecurringScopeSchema,
49
- CancelRecurringSeriesSchema,
50
- CreateAppointmentCategorySchema,
51
- CreateAppointmentTypeSchema,
52
- CreateAvailabilityRuleSchema,
53
- CreateCalendarSchema,
54
- CreateCouponCodeSchema,
55
- CreateNotificationTemplateSchema,
56
- CreatePackagePurchaseSchema,
57
- CreateRecurringSeriesSchema,
58
- CreateRoutingFormSchema,
59
- CreateServicePackageSchema,
60
- CreateWebhookEndpointSchema,
61
- DEFAULT_CANCELLATION_POLICY,
62
- IntakeFormFieldSchema,
63
- NoShowPreventionActionSchema,
64
- NotificationChannelSchema,
65
- NotificationTriggerSchema,
66
- OrgCancellationPolicySchema,
67
- PrivacyEraseSchema,
68
- PrivacySubjectSchema,
69
- RecurringFrequencySchema,
70
- RouteClientSchema,
71
- SLOT_GRANULARITY_DEFAULT,
72
- SLOT_GRANULARITY_OPTIONS,
73
- TestRoutingFormSchema,
74
- TextSettingsSchema,
75
- UpdateAppointmentCategorySchema,
76
- UpdateAppointmentTypeSchema,
77
- UpdateBookingPageSchema,
78
- UpdateCalendarSchema,
79
- UpdateCouponCodeSchema,
80
- UpdateNotificationTemplateSchema,
81
- UpdatePackagePurchaseSchema,
82
- UpdateRoutingFormSchema,
83
- UpdateServicePackageSchema
84
- };