@agent-native/scheduling 0.1.1
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.
- package/README.md +58 -0
- package/dist/actions/_helpers.d.ts +12 -0
- package/dist/actions/_helpers.d.ts.map +1 -0
- package/dist/actions/_helpers.js +49 -0
- package/dist/actions/_helpers.js.map +1 -0
- package/dist/actions/accept-team-invite.d.ts +3 -0
- package/dist/actions/accept-team-invite.d.ts.map +1 -0
- package/dist/actions/accept-team-invite.js +27 -0
- package/dist/actions/accept-team-invite.js.map +1 -0
- package/dist/actions/add-booking-attendee.d.ts +3 -0
- package/dist/actions/add-booking-attendee.d.ts.map +1 -0
- package/dist/actions/add-booking-attendee.js +33 -0
- package/dist/actions/add-booking-attendee.js.map +1 -0
- package/dist/actions/add-booking-note.d.ts +3 -0
- package/dist/actions/add-booking-note.d.ts.map +1 -0
- package/dist/actions/add-booking-note.js +26 -0
- package/dist/actions/add-booking-note.js.map +1 -0
- package/dist/actions/add-date-override.d.ts +3 -0
- package/dist/actions/add-date-override.d.ts.map +1 -0
- package/dist/actions/add-date-override.js +16 -0
- package/dist/actions/add-date-override.js.map +1 -0
- package/dist/actions/add-private-link.d.ts +3 -0
- package/dist/actions/add-private-link.d.ts.map +1 -0
- package/dist/actions/add-private-link.js +31 -0
- package/dist/actions/add-private-link.js.map +1 -0
- package/dist/actions/assign-round-robin-host.d.ts +3 -0
- package/dist/actions/assign-round-robin-host.d.ts.map +1 -0
- package/dist/actions/assign-round-robin-host.js +48 -0
- package/dist/actions/assign-round-robin-host.js.map +1 -0
- package/dist/actions/cancel-booking.d.ts +3 -0
- package/dist/actions/cancel-booking.d.ts.map +1 -0
- package/dist/actions/cancel-booking.js +34 -0
- package/dist/actions/cancel-booking.js.map +1 -0
- package/dist/actions/check-availability.d.ts +3 -0
- package/dist/actions/check-availability.d.ts.map +1 -0
- package/dist/actions/check-availability.js +43 -0
- package/dist/actions/check-availability.js.map +1 -0
- package/dist/actions/confirm-booking.d.ts +3 -0
- package/dist/actions/confirm-booking.d.ts.map +1 -0
- package/dist/actions/confirm-booking.js +12 -0
- package/dist/actions/confirm-booking.js.map +1 -0
- package/dist/actions/connect-calendar.d.ts +3 -0
- package/dist/actions/connect-calendar.d.ts.map +1 -0
- package/dist/actions/connect-calendar.js +26 -0
- package/dist/actions/connect-calendar.js.map +1 -0
- package/dist/actions/connect-video.d.ts +3 -0
- package/dist/actions/connect-video.d.ts.map +1 -0
- package/dist/actions/connect-video.js +54 -0
- package/dist/actions/connect-video.js.map +1 -0
- package/dist/actions/create-booking.d.ts +3 -0
- package/dist/actions/create-booking.d.ts.map +1 -0
- package/dist/actions/create-booking.js +60 -0
- package/dist/actions/create-booking.js.map +1 -0
- package/dist/actions/create-event-type.d.ts +3 -0
- package/dist/actions/create-event-type.d.ts.map +1 -0
- package/dist/actions/create-event-type.js +45 -0
- package/dist/actions/create-event-type.js.map +1 -0
- package/dist/actions/create-host-group.d.ts +3 -0
- package/dist/actions/create-host-group.d.ts.map +1 -0
- package/dist/actions/create-host-group.js +25 -0
- package/dist/actions/create-host-group.js.map +1 -0
- package/dist/actions/create-routing-form.d.ts +3 -0
- package/dist/actions/create-routing-form.d.ts.map +1 -0
- package/dist/actions/create-routing-form.js +39 -0
- package/dist/actions/create-routing-form.js.map +1 -0
- package/dist/actions/create-schedule.d.ts +3 -0
- package/dist/actions/create-schedule.d.ts.map +1 -0
- package/dist/actions/create-schedule.js +32 -0
- package/dist/actions/create-schedule.js.map +1 -0
- package/dist/actions/create-team.d.ts +3 -0
- package/dist/actions/create-team.d.ts.map +1 -0
- package/dist/actions/create-team.js +44 -0
- package/dist/actions/create-team.js.map +1 -0
- package/dist/actions/create-workflow.d.ts +3 -0
- package/dist/actions/create-workflow.d.ts.map +1 -0
- package/dist/actions/create-workflow.js +81 -0
- package/dist/actions/create-workflow.js.map +1 -0
- package/dist/actions/delete-event-type.d.ts +3 -0
- package/dist/actions/delete-event-type.d.ts.map +1 -0
- package/dist/actions/delete-event-type.js +14 -0
- package/dist/actions/delete-event-type.js.map +1 -0
- package/dist/actions/delete-routing-form.d.ts +3 -0
- package/dist/actions/delete-routing-form.d.ts.map +1 -0
- package/dist/actions/delete-routing-form.js +21 -0
- package/dist/actions/delete-routing-form.js.map +1 -0
- package/dist/actions/delete-schedule.d.ts +3 -0
- package/dist/actions/delete-schedule.d.ts.map +1 -0
- package/dist/actions/delete-schedule.js +14 -0
- package/dist/actions/delete-schedule.js.map +1 -0
- package/dist/actions/delete-workflow.d.ts +3 -0
- package/dist/actions/delete-workflow.d.ts.map +1 -0
- package/dist/actions/delete-workflow.js +21 -0
- package/dist/actions/delete-workflow.js.map +1 -0
- package/dist/actions/disconnect-calendar.d.ts +3 -0
- package/dist/actions/disconnect-calendar.d.ts.map +1 -0
- package/dist/actions/disconnect-calendar.js +22 -0
- package/dist/actions/disconnect-calendar.js.map +1 -0
- package/dist/actions/duplicate-event-type.d.ts +3 -0
- package/dist/actions/duplicate-event-type.d.ts.map +1 -0
- package/dist/actions/duplicate-event-type.js +34 -0
- package/dist/actions/duplicate-event-type.js.map +1 -0
- package/dist/actions/export-bookings-csv.d.ts +3 -0
- package/dist/actions/export-bookings-csv.d.ts.map +1 -0
- package/dist/actions/export-bookings-csv.js +53 -0
- package/dist/actions/export-bookings-csv.js.map +1 -0
- package/dist/actions/find-available-slot.d.ts +3 -0
- package/dist/actions/find-available-slot.d.ts.map +1 -0
- package/dist/actions/find-available-slot.js +39 -0
- package/dist/actions/find-available-slot.js.map +1 -0
- package/dist/actions/get-availability.d.ts +3 -0
- package/dist/actions/get-availability.d.ts.map +1 -0
- package/dist/actions/get-availability.js +20 -0
- package/dist/actions/get-availability.js.map +1 -0
- package/dist/actions/get-booking.d.ts +3 -0
- package/dist/actions/get-booking.d.ts.map +1 -0
- package/dist/actions/get-booking.js +9 -0
- package/dist/actions/get-booking.js.map +1 -0
- package/dist/actions/get-event-type.d.ts +3 -0
- package/dist/actions/get-event-type.d.ts.map +1 -0
- package/dist/actions/get-event-type.js +27 -0
- package/dist/actions/get-event-type.js.map +1 -0
- package/dist/actions/install-conferencing-app.d.ts +3 -0
- package/dist/actions/install-conferencing-app.d.ts.map +1 -0
- package/dist/actions/install-conferencing-app.js +28 -0
- package/dist/actions/install-conferencing-app.js.map +1 -0
- package/dist/actions/invite-team-member.d.ts +3 -0
- package/dist/actions/invite-team-member.d.ts.map +1 -0
- package/dist/actions/invite-team-member.js +30 -0
- package/dist/actions/invite-team-member.js.map +1 -0
- package/dist/actions/list-bookings.d.ts +3 -0
- package/dist/actions/list-bookings.d.ts.map +1 -0
- package/dist/actions/list-bookings.js +35 -0
- package/dist/actions/list-bookings.js.map +1 -0
- package/dist/actions/list-calendar-integrations.d.ts +3 -0
- package/dist/actions/list-calendar-integrations.d.ts.map +1 -0
- package/dist/actions/list-calendar-integrations.js +26 -0
- package/dist/actions/list-calendar-integrations.js.map +1 -0
- package/dist/actions/list-event-types.d.ts +3 -0
- package/dist/actions/list-event-types.d.ts.map +1 -0
- package/dist/actions/list-event-types.js +31 -0
- package/dist/actions/list-event-types.js.map +1 -0
- package/dist/actions/list-routing-form-responses.d.ts +3 -0
- package/dist/actions/list-routing-form-responses.d.ts.map +1 -0
- package/dist/actions/list-routing-form-responses.js +24 -0
- package/dist/actions/list-routing-form-responses.js.map +1 -0
- package/dist/actions/list-routing-forms.d.ts +3 -0
- package/dist/actions/list-routing-forms.d.ts.map +1 -0
- package/dist/actions/list-routing-forms.js +29 -0
- package/dist/actions/list-routing-forms.js.map +1 -0
- package/dist/actions/list-schedules.d.ts +3 -0
- package/dist/actions/list-schedules.d.ts.map +1 -0
- package/dist/actions/list-schedules.js +16 -0
- package/dist/actions/list-schedules.js.map +1 -0
- package/dist/actions/list-selected-calendars.d.ts +3 -0
- package/dist/actions/list-selected-calendars.d.ts.map +1 -0
- package/dist/actions/list-selected-calendars.js +42 -0
- package/dist/actions/list-selected-calendars.js.map +1 -0
- package/dist/actions/list-workflows.d.ts +3 -0
- package/dist/actions/list-workflows.d.ts.map +1 -0
- package/dist/actions/list-workflows.js +29 -0
- package/dist/actions/list-workflows.js.map +1 -0
- package/dist/actions/mark-no-show.d.ts +3 -0
- package/dist/actions/mark-no-show.d.ts.map +1 -0
- package/dist/actions/mark-no-show.js +15 -0
- package/dist/actions/mark-no-show.js.map +1 -0
- package/dist/actions/refresh-busy-times.d.ts +3 -0
- package/dist/actions/refresh-busy-times.d.ts.map +1 -0
- package/dist/actions/refresh-busy-times.js +25 -0
- package/dist/actions/refresh-busy-times.js.map +1 -0
- package/dist/actions/remove-booking-attendee.d.ts +3 -0
- package/dist/actions/remove-booking-attendee.d.ts.map +1 -0
- package/dist/actions/remove-booking-attendee.js +20 -0
- package/dist/actions/remove-booking-attendee.js.map +1 -0
- package/dist/actions/remove-date-override.d.ts +3 -0
- package/dist/actions/remove-date-override.d.ts.map +1 -0
- package/dist/actions/remove-date-override.js +15 -0
- package/dist/actions/remove-date-override.js.map +1 -0
- package/dist/actions/remove-team-member.d.ts +3 -0
- package/dist/actions/remove-team-member.d.ts.map +1 -0
- package/dist/actions/remove-team-member.js +18 -0
- package/dist/actions/remove-team-member.js.map +1 -0
- package/dist/actions/reorder-event-types.d.ts +3 -0
- package/dist/actions/reorder-event-types.d.ts.map +1 -0
- package/dist/actions/reorder-event-types.js +18 -0
- package/dist/actions/reorder-event-types.js.map +1 -0
- package/dist/actions/reschedule-booking.d.ts +3 -0
- package/dist/actions/reschedule-booking.d.ts.map +1 -0
- package/dist/actions/reschedule-booking.js +38 -0
- package/dist/actions/reschedule-booking.js.map +1 -0
- package/dist/actions/revoke-private-link.d.ts +3 -0
- package/dist/actions/revoke-private-link.d.ts.map +1 -0
- package/dist/actions/revoke-private-link.js +16 -0
- package/dist/actions/revoke-private-link.js.map +1 -0
- package/dist/actions/send-reschedule-link.d.ts +3 -0
- package/dist/actions/send-reschedule-link.d.ts.map +1 -0
- package/dist/actions/send-reschedule-link.js +18 -0
- package/dist/actions/send-reschedule-link.js.map +1 -0
- package/dist/actions/set-appearance.d.ts +3 -0
- package/dist/actions/set-appearance.d.ts.map +1 -0
- package/dist/actions/set-appearance.js +23 -0
- package/dist/actions/set-appearance.js.map +1 -0
- package/dist/actions/set-default-conferencing-app.d.ts +3 -0
- package/dist/actions/set-default-conferencing-app.d.ts.map +1 -0
- package/dist/actions/set-default-conferencing-app.js +25 -0
- package/dist/actions/set-default-conferencing-app.js.map +1 -0
- package/dist/actions/set-default-schedule.d.ts +3 -0
- package/dist/actions/set-default-schedule.d.ts.map +1 -0
- package/dist/actions/set-default-schedule.js +15 -0
- package/dist/actions/set-default-schedule.js.map +1 -0
- package/dist/actions/set-destination-calendar.d.ts +3 -0
- package/dist/actions/set-destination-calendar.d.ts.map +1 -0
- package/dist/actions/set-destination-calendar.js +39 -0
- package/dist/actions/set-destination-calendar.js.map +1 -0
- package/dist/actions/set-event-type-hosts.d.ts +3 -0
- package/dist/actions/set-event-type-hosts.d.ts.map +1 -0
- package/dist/actions/set-event-type-hosts.js +41 -0
- package/dist/actions/set-event-type-hosts.js.map +1 -0
- package/dist/actions/set-event-type-location.d.ts +3 -0
- package/dist/actions/set-event-type-location.d.ts.map +1 -0
- package/dist/actions/set-event-type-location.js +18 -0
- package/dist/actions/set-event-type-location.js.map +1 -0
- package/dist/actions/set-host-availability-override.d.ts +3 -0
- package/dist/actions/set-host-availability-override.d.ts.map +1 -0
- package/dist/actions/set-host-availability-override.js +21 -0
- package/dist/actions/set-host-availability-override.js.map +1 -0
- package/dist/actions/set-team-branding.d.ts +3 -0
- package/dist/actions/set-team-branding.d.ts.map +1 -0
- package/dist/actions/set-team-branding.js +28 -0
- package/dist/actions/set-team-branding.js.map +1 -0
- package/dist/actions/submit-routing-form-response.d.ts +3 -0
- package/dist/actions/submit-routing-form-response.d.ts.map +1 -0
- package/dist/actions/submit-routing-form-response.js +46 -0
- package/dist/actions/submit-routing-form-response.js.map +1 -0
- package/dist/actions/toggle-event-type-hidden.d.ts +3 -0
- package/dist/actions/toggle-event-type-hidden.d.ts.map +1 -0
- package/dist/actions/toggle-event-type-hidden.js +19 -0
- package/dist/actions/toggle-event-type-hidden.js.map +1 -0
- package/dist/actions/toggle-selected-calendar.d.ts +3 -0
- package/dist/actions/toggle-selected-calendar.d.ts.map +1 -0
- package/dist/actions/toggle-selected-calendar.js +40 -0
- package/dist/actions/toggle-selected-calendar.js.map +1 -0
- package/dist/actions/toggle-workflow.d.ts +3 -0
- package/dist/actions/toggle-workflow.d.ts.map +1 -0
- package/dist/actions/toggle-workflow.js +26 -0
- package/dist/actions/toggle-workflow.js.map +1 -0
- package/dist/actions/update-event-type.d.ts +3 -0
- package/dist/actions/update-event-type.d.ts.map +1 -0
- package/dist/actions/update-event-type.js +54 -0
- package/dist/actions/update-event-type.js.map +1 -0
- package/dist/actions/update-member-role.d.ts +3 -0
- package/dist/actions/update-member-role.d.ts.map +1 -0
- package/dist/actions/update-member-role.js +23 -0
- package/dist/actions/update-member-role.js.map +1 -0
- package/dist/actions/update-profile.d.ts +3 -0
- package/dist/actions/update-profile.d.ts.map +1 -0
- package/dist/actions/update-profile.js +34 -0
- package/dist/actions/update-profile.js.map +1 -0
- package/dist/actions/update-routing-form.d.ts +3 -0
- package/dist/actions/update-routing-form.d.ts.map +1 -0
- package/dist/actions/update-routing-form.js +40 -0
- package/dist/actions/update-routing-form.js.map +1 -0
- package/dist/actions/update-schedule.d.ts +3 -0
- package/dist/actions/update-schedule.d.ts.map +1 -0
- package/dist/actions/update-schedule.js +44 -0
- package/dist/actions/update-schedule.js.map +1 -0
- package/dist/actions/update-workflow.d.ts +3 -0
- package/dist/actions/update-workflow.d.ts.map +1 -0
- package/dist/actions/update-workflow.js +89 -0
- package/dist/actions/update-workflow.js.map +1 -0
- package/dist/core/buffers.d.ts +25 -0
- package/dist/core/buffers.d.ts.map +1 -0
- package/dist/core/buffers.js +21 -0
- package/dist/core/buffers.js.map +1 -0
- package/dist/core/conflicts.d.ts +11 -0
- package/dist/core/conflicts.d.ts.map +1 -0
- package/dist/core/conflicts.js +42 -0
- package/dist/core/conflicts.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/limits.d.ts +23 -0
- package/dist/core/limits.d.ts.map +1 -0
- package/dist/core/limits.js +28 -0
- package/dist/core/limits.js.map +1 -0
- package/dist/core/round-robin.d.ts +31 -0
- package/dist/core/round-robin.d.ts.map +1 -0
- package/dist/core/round-robin.js +57 -0
- package/dist/core/round-robin.js.map +1 -0
- package/dist/core/rrule.d.ts +2 -0
- package/dist/core/rrule.d.ts.map +1 -0
- package/dist/core/rrule.js +14 -0
- package/dist/core/rrule.js.map +1 -0
- package/dist/core/rules.d.ts +26 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +40 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/slots.d.ts +58 -0
- package/dist/core/slots.d.ts.map +1 -0
- package/dist/core/slots.js +98 -0
- package/dist/core/slots.js.map +1 -0
- package/dist/core/time.d.ts +52 -0
- package/dist/core/time.d.ts.map +1 -0
- package/dist/core/time.js +109 -0
- package/dist/core/time.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +28 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +160 -0
- package/dist/manifest.js.map +1 -0
- package/dist/react/components/SlotPicker.d.ts +21 -0
- package/dist/react/components/SlotPicker.d.ts.map +1 -0
- package/dist/react/components/SlotPicker.js +15 -0
- package/dist/react/components/SlotPicker.js.map +1 -0
- package/dist/react/components/TimezoneSelect.d.ts +7 -0
- package/dist/react/components/TimezoneSelect.d.ts.map +1 -0
- package/dist/react/components/TimezoneSelect.js +31 -0
- package/dist/react/components/TimezoneSelect.js.map +1 -0
- package/dist/react/components/booking-links/AvailabilityEditor.d.ts +21 -0
- package/dist/react/components/booking-links/AvailabilityEditor.d.ts.map +1 -0
- package/dist/react/components/booking-links/AvailabilityEditor.js +102 -0
- package/dist/react/components/booking-links/AvailabilityEditor.js.map +1 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.d.ts +22 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.d.ts.map +1 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.js +75 -0
- package/dist/react/components/booking-links/BookingLinkCreateDialog.js.map +1 -0
- package/dist/react/components/booking-links/ConferencingSelector.d.ts +19 -0
- package/dist/react/components/booking-links/ConferencingSelector.d.ts.map +1 -0
- package/dist/react/components/booking-links/ConferencingSelector.js +87 -0
- package/dist/react/components/booking-links/ConferencingSelector.js.map +1 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.d.ts +19 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.d.ts.map +1 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.js +117 -0
- package/dist/react/components/booking-links/CustomFieldsEditor.js.map +1 -0
- package/dist/react/components/booking-links/DurationPicker.d.ts +9 -0
- package/dist/react/components/booking-links/DurationPicker.d.ts.map +1 -0
- package/dist/react/components/booking-links/DurationPicker.js +56 -0
- package/dist/react/components/booking-links/DurationPicker.js.map +1 -0
- package/dist/react/components/booking-links/SlugEditor.d.ts +15 -0
- package/dist/react/components/booking-links/SlugEditor.d.ts.map +1 -0
- package/dist/react/components/booking-links/SlugEditor.js +64 -0
- package/dist/react/components/booking-links/SlugEditor.js.map +1 -0
- package/dist/react/components/booking-links/index.d.ts +16 -0
- package/dist/react/components/booking-links/index.d.ts.map +1 -0
- package/dist/react/components/booking-links/index.js +16 -0
- package/dist/react/components/booking-links/index.js.map +1 -0
- package/dist/react/components/index.d.ts +14 -0
- package/dist/react/components/index.d.ts.map +1 -0
- package/dist/react/components/index.js +14 -0
- package/dist/react/components/index.js.map +1 -0
- package/dist/react/hooks/useBookingFlow.d.ts +33 -0
- package/dist/react/hooks/useBookingFlow.d.ts.map +1 -0
- package/dist/react/hooks/useBookingFlow.js +51 -0
- package/dist/react/hooks/useBookingFlow.js.map +1 -0
- package/dist/react/hooks/useEventType.d.ts +21 -0
- package/dist/react/hooks/useEventType.d.ts.map +1 -0
- package/dist/react/hooks/useEventType.js +38 -0
- package/dist/react/hooks/useEventType.js.map +1 -0
- package/dist/react/hooks/useReschedule.d.ts +13 -0
- package/dist/react/hooks/useReschedule.d.ts.map +1 -0
- package/dist/react/hooks/useReschedule.js +33 -0
- package/dist/react/hooks/useReschedule.js.map +1 -0
- package/dist/react/hooks/useSlots.d.ts +32 -0
- package/dist/react/hooks/useSlots.d.ts.map +1 -0
- package/dist/react/hooks/useSlots.js +59 -0
- package/dist/react/hooks/useSlots.js.map +1 -0
- package/dist/react/hooks/useTimezone.d.ts +3 -0
- package/dist/react/hooks/useTimezone.d.ts.map +1 -0
- package/dist/react/hooks/useTimezone.js +30 -0
- package/dist/react/hooks/useTimezone.js.map +1 -0
- package/dist/react/index.d.ts +11 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +11 -0
- package/dist/react/index.js.map +1 -0
- package/dist/schema/bookings.d.ts +1201 -0
- package/dist/schema/bookings.d.ts.map +1 -0
- package/dist/schema/bookings.js +100 -0
- package/dist/schema/bookings.js.map +1 -0
- package/dist/schema/calendar-cache.d.ts +160 -0
- package/dist/schema/calendar-cache.d.ts.map +1 -0
- package/dist/schema/calendar-cache.js +23 -0
- package/dist/schema/calendar-cache.js.map +1 -0
- package/dist/schema/credentials.d.ts +743 -0
- package/dist/schema/credentials.d.ts.map +1 -0
- package/dist/schema/credentials.js +79 -0
- package/dist/schema/credentials.js.map +1 -0
- package/dist/schema/event-types.d.ts +1292 -0
- package/dist/schema/event-types.d.ts.map +1 -0
- package/dist/schema/event-types.js +131 -0
- package/dist/schema/event-types.js.map +1 -0
- package/dist/schema/index.d.ts +20 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +20 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/routing-forms.d.ts +571 -0
- package/dist/schema/routing-forms.d.ts.map +1 -0
- package/dist/schema/routing-forms.js +44 -0
- package/dist/schema/routing-forms.js.map +1 -0
- package/dist/schema/schedules.d.ts +830 -0
- package/dist/schema/schedules.d.ts.map +1 -0
- package/dist/schema/schedules.js +72 -0
- package/dist/schema/schedules.js.map +1 -0
- package/dist/schema/teams.d.ts +569 -0
- package/dist/schema/teams.d.ts.map +1 -0
- package/dist/schema/teams.js +38 -0
- package/dist/schema/teams.js.map +1 -0
- package/dist/schema/workflows.d.ts +1367 -0
- package/dist/schema/workflows.d.ts.map +1 -0
- package/dist/schema/workflows.js +116 -0
- package/dist/schema/workflows.js.map +1 -0
- package/dist/server/availability-engine.d.ts +21 -0
- package/dist/server/availability-engine.d.ts.map +1 -0
- package/dist/server/availability-engine.js +135 -0
- package/dist/server/availability-engine.js.map +1 -0
- package/dist/server/booking-service.d.ts +46 -0
- package/dist/server/booking-service.d.ts.map +1 -0
- package/dist/server/booking-service.js +198 -0
- package/dist/server/booking-service.js.map +1 -0
- package/dist/server/bookings-repo.d.ts +48 -0
- package/dist/server/bookings-repo.d.ts.map +1 -0
- package/dist/server/bookings-repo.js +244 -0
- package/dist/server/bookings-repo.js.map +1 -0
- package/dist/server/context.d.ts +33 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +11 -0
- package/dist/server/context.js.map +1 -0
- package/dist/server/db-types.d.ts +15 -0
- package/dist/server/db-types.d.ts.map +1 -0
- package/dist/server/db-types.js +2 -0
- package/dist/server/db-types.js.map +1 -0
- package/dist/server/event-types-repo.d.ts +46 -0
- package/dist/server/event-types-repo.d.ts.map +1 -0
- package/dist/server/event-types-repo.js +320 -0
- package/dist/server/event-types-repo.js.map +1 -0
- package/dist/server/hooks.d.ts +6 -0
- package/dist/server/hooks.d.ts.map +1 -0
- package/dist/server/hooks.js +173 -0
- package/dist/server/hooks.js.map +1 -0
- package/dist/server/ics.d.ts +12 -0
- package/dist/server/ics.d.ts.map +1 -0
- package/dist/server/ics.js +81 -0
- package/dist/server/ics.js.map +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +12 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/providers/builtin-video.d.ts +12 -0
- package/dist/server/providers/builtin-video.d.ts.map +1 -0
- package/dist/server/providers/builtin-video.js +50 -0
- package/dist/server/providers/builtin-video.js.map +1 -0
- package/dist/server/providers/cal-video.d.ts +12 -0
- package/dist/server/providers/cal-video.d.ts.map +1 -0
- package/dist/server/providers/cal-video.js +50 -0
- package/dist/server/providers/cal-video.js.map +1 -0
- package/dist/server/providers/google-calendar.d.ts +28 -0
- package/dist/server/providers/google-calendar.d.ts.map +1 -0
- package/dist/server/providers/google-calendar.js +163 -0
- package/dist/server/providers/google-calendar.js.map +1 -0
- package/dist/server/providers/google-meet.d.ts +10 -0
- package/dist/server/providers/google-meet.d.ts.map +1 -0
- package/dist/server/providers/google-meet.js +14 -0
- package/dist/server/providers/google-meet.js.map +1 -0
- package/dist/server/providers/index.d.ts +8 -0
- package/dist/server/providers/index.d.ts.map +1 -0
- package/dist/server/providers/index.js +8 -0
- package/dist/server/providers/index.js.map +1 -0
- package/dist/server/providers/office365.d.ts +21 -0
- package/dist/server/providers/office365.d.ts.map +1 -0
- package/dist/server/providers/office365.js +146 -0
- package/dist/server/providers/office365.js.map +1 -0
- package/dist/server/providers/registry.d.ts +14 -0
- package/dist/server/providers/registry.d.ts.map +1 -0
- package/dist/server/providers/registry.js +28 -0
- package/dist/server/providers/registry.js.map +1 -0
- package/dist/server/providers/types.d.ts +133 -0
- package/dist/server/providers/types.d.ts.map +1 -0
- package/dist/server/providers/types.js +2 -0
- package/dist/server/providers/types.js.map +1 -0
- package/dist/server/providers/zoom.d.ts +34 -0
- package/dist/server/providers/zoom.d.ts.map +1 -0
- package/dist/server/providers/zoom.js +111 -0
- package/dist/server/providers/zoom.js.map +1 -0
- package/dist/server/schedules-repo.d.ts +26 -0
- package/dist/server/schedules-repo.d.ts.map +1 -0
- package/dist/server/schedules-repo.js +223 -0
- package/dist/server/schedules-repo.js.map +1 -0
- package/dist/server/video-oauth-state.d.ts +28 -0
- package/dist/server/video-oauth-state.d.ts.map +1 -0
- package/dist/server/video-oauth-state.js +101 -0
- package/dist/server/video-oauth-state.js.map +1 -0
- package/dist/server/video-oauth.d.ts +18 -0
- package/dist/server/video-oauth.d.ts.map +1 -0
- package/dist/server/video-oauth.js +82 -0
- package/dist/server/video-oauth.js.map +1 -0
- package/dist/shared/index.d.ts +298 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +6 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/docs/UI_UNIFICATION.md +78 -0
- package/docs/actions.md +64 -0
- package/docs/eject.md +18 -0
- package/docs/llms-full.txt +1022 -0
- package/docs/llms.txt +89 -0
- package/docs/providers.md +68 -0
- package/docs/schema.md +86 -0
- package/docs/skills/availability/SKILL.md +44 -0
- package/docs/skills/booker/SKILL.md +51 -0
- package/docs/skills/bookings/SKILL.md +43 -0
- package/docs/skills/embeds/SKILL.md +49 -0
- package/docs/skills/event-types/SKILL.md +40 -0
- package/docs/skills/integrations/SKILL.md +52 -0
- package/docs/skills/routing-forms/SKILL.md +39 -0
- package/docs/skills/scheduling-basics/SKILL.md +51 -0
- package/docs/skills/slot-engine/SKILL.md +52 -0
- package/docs/skills/team-scheduling/SKILL.md +54 -0
- package/docs/skills/workflows/SKILL.md +55 -0
- package/package.json +87 -0
- package/src/actions/_helpers.ts +62 -0
- package/src/actions/accept-team-invite.ts +26 -0
- package/src/actions/add-booking-attendee.ts +32 -0
- package/src/actions/add-booking-note.ts +25 -0
- package/src/actions/add-date-override.ts +23 -0
- package/src/actions/add-private-link.ts +31 -0
- package/src/actions/assign-round-robin-host.ts +54 -0
- package/src/actions/cancel-booking.ts +39 -0
- package/src/actions/check-availability.ts +46 -0
- package/src/actions/confirm-booking.ts +15 -0
- package/src/actions/connect-calendar.ts +27 -0
- package/src/actions/connect-video.ts +57 -0
- package/src/actions/create-booking.ts +62 -0
- package/src/actions/create-event-type.ts +45 -0
- package/src/actions/create-host-group.ts +25 -0
- package/src/actions/create-routing-form.ts +39 -0
- package/src/actions/create-schedule.ts +36 -0
- package/src/actions/create-team.ts +44 -0
- package/src/actions/create-workflow.ts +83 -0
- package/src/actions/delete-event-type.ts +14 -0
- package/src/actions/delete-routing-form.ts +21 -0
- package/src/actions/delete-schedule.ts +14 -0
- package/src/actions/delete-workflow.ts +21 -0
- package/src/actions/disconnect-calendar.ts +22 -0
- package/src/actions/duplicate-event-type.ts +36 -0
- package/src/actions/export-bookings-csv.ts +54 -0
- package/src/actions/find-available-slot.ts +40 -0
- package/src/actions/get-availability.ts +20 -0
- package/src/actions/get-booking.ts +9 -0
- package/src/actions/get-event-type.ts +29 -0
- package/src/actions/install-conferencing-app.ts +29 -0
- package/src/actions/invite-team-member.ts +30 -0
- package/src/actions/list-bookings.ts +36 -0
- package/src/actions/list-calendar-integrations.ts +26 -0
- package/src/actions/list-event-types.ts +31 -0
- package/src/actions/list-routing-form-responses.ts +24 -0
- package/src/actions/list-routing-forms.ts +34 -0
- package/src/actions/list-schedules.ts +16 -0
- package/src/actions/list-selected-calendars.ts +41 -0
- package/src/actions/list-workflows.ts +34 -0
- package/src/actions/mark-no-show.ts +15 -0
- package/src/actions/refresh-busy-times.ts +26 -0
- package/src/actions/remove-booking-attendee.ts +24 -0
- package/src/actions/remove-date-override.ts +15 -0
- package/src/actions/remove-team-member.ts +23 -0
- package/src/actions/reorder-event-types.ts +18 -0
- package/src/actions/reschedule-booking.ts +45 -0
- package/src/actions/revoke-private-link.ts +16 -0
- package/src/actions/send-reschedule-link.ts +18 -0
- package/src/actions/set-appearance.ts +24 -0
- package/src/actions/set-default-conferencing-app.ts +25 -0
- package/src/actions/set-default-schedule.ts +15 -0
- package/src/actions/set-destination-calendar.ts +39 -0
- package/src/actions/set-event-type-hosts.ts +43 -0
- package/src/actions/set-event-type-location.ts +18 -0
- package/src/actions/set-host-availability-override.ts +27 -0
- package/src/actions/set-team-branding.ts +28 -0
- package/src/actions/submit-routing-form-response.ts +47 -0
- package/src/actions/toggle-event-type-hidden.ts +21 -0
- package/src/actions/toggle-selected-calendar.ts +43 -0
- package/src/actions/toggle-workflow.ts +25 -0
- package/src/actions/update-event-type.ts +54 -0
- package/src/actions/update-member-role.ts +28 -0
- package/src/actions/update-profile.ts +36 -0
- package/src/actions/update-routing-form.ts +36 -0
- package/src/actions/update-schedule.ts +53 -0
- package/src/actions/update-workflow.ts +89 -0
- package/src/core/buffers.ts +46 -0
- package/src/core/conflicts.ts +49 -0
- package/src/core/index.ts +8 -0
- package/src/core/limits.ts +60 -0
- package/src/core/round-robin.test.ts +95 -0
- package/src/core/round-robin.ts +103 -0
- package/src/core/rrule.ts +20 -0
- package/src/core/rules.ts +66 -0
- package/src/core/slots.test.ts +246 -0
- package/src/core/slots.ts +223 -0
- package/src/core/time.ts +136 -0
- package/src/index.ts +14 -0
- package/src/manifest.ts +174 -0
- package/src/react/components/SlotPicker.tsx +72 -0
- package/src/react/components/TimezoneSelect.tsx +55 -0
- package/src/react/components/_shadcn-shims.d.ts +251 -0
- package/src/react/components/booking-links/AvailabilityEditor.tsx +177 -0
- package/src/react/components/booking-links/BookingLinkCreateDialog.tsx +189 -0
- package/src/react/components/booking-links/ConferencingSelector.tsx +255 -0
- package/src/react/components/booking-links/CustomFieldsEditor.tsx +420 -0
- package/src/react/components/booking-links/DurationPicker.tsx +115 -0
- package/src/react/components/booking-links/SlugEditor.tsx +149 -0
- package/src/react/components/booking-links/index.ts +15 -0
- package/src/react/components/index.ts +13 -0
- package/src/react/hooks/useBookingFlow.ts +113 -0
- package/src/react/hooks/useEventType.ts +52 -0
- package/src/react/hooks/useReschedule.ts +39 -0
- package/src/react/hooks/useSlots.ts +88 -0
- package/src/react/hooks/useTimezone.ts +29 -0
- package/src/react/index.ts +10 -0
- package/src/schema/bookings.ts +124 -0
- package/src/schema/calendar-cache.ts +23 -0
- package/src/schema/credentials.ts +83 -0
- package/src/schema/event-types.ts +154 -0
- package/src/schema/index.ts +19 -0
- package/src/schema/routing-forms.ts +52 -0
- package/src/schema/schedules.ts +83 -0
- package/src/schema/teams.ts +46 -0
- package/src/schema/workflows.ts +128 -0
- package/src/server/availability-engine.ts +193 -0
- package/src/server/booking-service.ts +264 -0
- package/src/server/bookings-repo.ts +330 -0
- package/src/server/context.ts +49 -0
- package/src/server/db-types.ts +16 -0
- package/src/server/event-types-repo.ts +385 -0
- package/src/server/hooks.ts +213 -0
- package/src/server/ics.ts +99 -0
- package/src/server/index.ts +11 -0
- package/src/server/providers/builtin-video.ts +62 -0
- package/src/server/providers/google-calendar.ts +237 -0
- package/src/server/providers/google-meet.ts +22 -0
- package/src/server/providers/index.ts +7 -0
- package/src/server/providers/office365.ts +208 -0
- package/src/server/providers/registry.ts +43 -0
- package/src/server/providers/types.ts +126 -0
- package/src/server/providers/zoom.ts +173 -0
- package/src/server/schedules-repo.ts +279 -0
- package/src/server/video-oauth-state.test.ts +120 -0
- package/src/server/video-oauth-state.ts +116 -0
- package/src/server/video-oauth.ts +99 -0
- package/src/shared/index.ts +366 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflows — trigger-based automations ("email attendee 1h before event").
|
|
3
|
+
*
|
|
4
|
+
* Each workflow has a trigger + ordered steps. Steps run on a schedule via
|
|
5
|
+
* the framework's recurring-jobs mechanism: when a booking fires a trigger,
|
|
6
|
+
* we materialize scheduled reminders; a job processes them when due.
|
|
7
|
+
*/
|
|
8
|
+
import {
|
|
9
|
+
table,
|
|
10
|
+
text,
|
|
11
|
+
integer,
|
|
12
|
+
ownableColumns,
|
|
13
|
+
createSharesTable,
|
|
14
|
+
} from "@agent-native/core/db/schema";
|
|
15
|
+
|
|
16
|
+
export const workflows = table("workflows", {
|
|
17
|
+
id: text("id").primaryKey(),
|
|
18
|
+
name: text("name").notNull(),
|
|
19
|
+
trigger: text("trigger", {
|
|
20
|
+
enum: [
|
|
21
|
+
"new-booking",
|
|
22
|
+
"before-event",
|
|
23
|
+
"after-event",
|
|
24
|
+
"reschedule",
|
|
25
|
+
"cancellation",
|
|
26
|
+
"no-show",
|
|
27
|
+
],
|
|
28
|
+
}).notNull(),
|
|
29
|
+
teamId: text("team_id"),
|
|
30
|
+
disabled: integer("disabled", { mode: "boolean" }).notNull().default(false),
|
|
31
|
+
/** JSON array of eventTypeIds this workflow runs on. Empty = none. */
|
|
32
|
+
activeOnEventTypeIds: text("active_on_event_type_ids")
|
|
33
|
+
.notNull()
|
|
34
|
+
.default("[]"),
|
|
35
|
+
createdAt: text("created_at").notNull(),
|
|
36
|
+
updatedAt: text("updated_at").notNull(),
|
|
37
|
+
...ownableColumns(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const workflowSteps = table("workflow_steps", {
|
|
41
|
+
id: text("id").primaryKey(),
|
|
42
|
+
workflowId: text("workflow_id").notNull(),
|
|
43
|
+
order: integer("order").notNull().default(0),
|
|
44
|
+
action: text("action", {
|
|
45
|
+
enum: [
|
|
46
|
+
"email-host",
|
|
47
|
+
"email-attendee",
|
|
48
|
+
"email-address",
|
|
49
|
+
"sms-attendee",
|
|
50
|
+
"sms-host",
|
|
51
|
+
"sms-number",
|
|
52
|
+
"webhook",
|
|
53
|
+
],
|
|
54
|
+
}).notNull(),
|
|
55
|
+
/** Offset in minutes from the trigger. Negative = before (for before-event). */
|
|
56
|
+
offsetMinutes: integer("offset_minutes").notNull().default(0),
|
|
57
|
+
/** Target email / phone / url depending on action */
|
|
58
|
+
sendTo: text("send_to"),
|
|
59
|
+
emailSubject: text("email_subject"),
|
|
60
|
+
emailBody: text("email_body"),
|
|
61
|
+
smsBody: text("sms_body"),
|
|
62
|
+
webhookUrl: text("webhook_url"),
|
|
63
|
+
/** Named template key (e.g. "default-reminder") */
|
|
64
|
+
template: text("template"),
|
|
65
|
+
createdAt: text("created_at").notNull(),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Materialized reminders waiting to fire.
|
|
70
|
+
* Written by the booking-service hook when a trigger occurs.
|
|
71
|
+
* Drained by a recurring job that processes due rows.
|
|
72
|
+
*/
|
|
73
|
+
export const scheduledReminders = table("scheduled_reminders", {
|
|
74
|
+
id: text("id").primaryKey(),
|
|
75
|
+
bookingId: text("booking_id").notNull(),
|
|
76
|
+
workflowStepId: text("workflow_step_id").notNull(),
|
|
77
|
+
method: text("method", {
|
|
78
|
+
enum: ["email", "sms", "webhook"],
|
|
79
|
+
}).notNull(),
|
|
80
|
+
scheduledFor: text("scheduled_for").notNull(),
|
|
81
|
+
sent: integer("sent", { mode: "boolean" }).notNull().default(false),
|
|
82
|
+
sentAt: text("sent_at"),
|
|
83
|
+
failed: integer("failed", { mode: "boolean" }).notNull().default(false),
|
|
84
|
+
failureReason: text("failure_reason"),
|
|
85
|
+
attempts: integer("attempts").notNull().default(0),
|
|
86
|
+
createdAt: text("created_at").notNull(),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/** Outgoing webhook subscriptions. */
|
|
90
|
+
export const webhooks = table("webhooks", {
|
|
91
|
+
id: text("id").primaryKey(),
|
|
92
|
+
name: text("name"),
|
|
93
|
+
subscriberUrl: text("subscriber_url").notNull(),
|
|
94
|
+
secret: text("secret"),
|
|
95
|
+
active: integer("active", { mode: "boolean" }).notNull().default(true),
|
|
96
|
+
/** JSON array of trigger keys */
|
|
97
|
+
eventTriggers: text("event_triggers").notNull().default("[]"),
|
|
98
|
+
teamId: text("team_id"),
|
|
99
|
+
eventTypeId: text("event_type_id"),
|
|
100
|
+
createdAt: text("created_at").notNull(),
|
|
101
|
+
updatedAt: text("updated_at").notNull(),
|
|
102
|
+
...ownableColumns(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const webhookDeliveries = table("webhook_deliveries", {
|
|
106
|
+
id: text("id").primaryKey(),
|
|
107
|
+
webhookId: text("webhook_id").notNull(),
|
|
108
|
+
triggeredAt: text("triggered_at").notNull(),
|
|
109
|
+
payload: text("payload").notNull(),
|
|
110
|
+
responseStatus: integer("response_status"),
|
|
111
|
+
responseBody: text("response_body"),
|
|
112
|
+
success: integer("success", { mode: "boolean" }).notNull().default(false),
|
|
113
|
+
attempts: integer("attempts").notNull().default(0),
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
/** API keys for programmatic access. */
|
|
117
|
+
export const apiKeys = table("api_keys", {
|
|
118
|
+
id: text("id").primaryKey(),
|
|
119
|
+
hashedKey: text("hashed_key").notNull().unique(),
|
|
120
|
+
note: text("note"),
|
|
121
|
+
userEmail: text("user_email"),
|
|
122
|
+
teamId: text("team_id"),
|
|
123
|
+
expiresAt: text("expires_at"),
|
|
124
|
+
lastUsedAt: text("last_used_at"),
|
|
125
|
+
createdAt: text("created_at").notNull(),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const workflowShares = createSharesTable("workflow_shares");
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Availability engine — combines an event type, schedule, and calendar busy
|
|
3
|
+
* intervals into the slot list shown to the Booker.
|
|
4
|
+
*
|
|
5
|
+
* This is where the pure `computeAvailableSlots` gets plugged into the real
|
|
6
|
+
* world: it fetches the schedule, merges busy times from the selected
|
|
7
|
+
* calendars + existing bookings, and applies booking limits.
|
|
8
|
+
*/
|
|
9
|
+
import { inArray, eq, gte, lt, and } from "drizzle-orm";
|
|
10
|
+
import type {
|
|
11
|
+
EventType,
|
|
12
|
+
Schedule,
|
|
13
|
+
BusyInterval,
|
|
14
|
+
Slot,
|
|
15
|
+
} from "../shared/index.js";
|
|
16
|
+
import type { BookingCounts } from "../core/limits.js";
|
|
17
|
+
import { computeAvailableSlots } from "../core/slots.js";
|
|
18
|
+
import { bucketKeysForSlot } from "../core/limits.js";
|
|
19
|
+
import { getScheduleById } from "./schedules-repo.js";
|
|
20
|
+
import { getSchedulingContext } from "./context.js";
|
|
21
|
+
import { getCalendarProvider } from "./providers/registry.js";
|
|
22
|
+
import { TZDate } from "@date-fns/tz";
|
|
23
|
+
import { format, startOfWeek, startOfMonth, startOfYear } from "date-fns";
|
|
24
|
+
|
|
25
|
+
export interface GetSlotsInput {
|
|
26
|
+
eventType: EventType;
|
|
27
|
+
/** The user we're finding availability for — their schedule + calendars. */
|
|
28
|
+
forUserEmail: string;
|
|
29
|
+
rangeStart: Date;
|
|
30
|
+
rangeEnd: Date;
|
|
31
|
+
viewerTimezone?: string;
|
|
32
|
+
now?: Date;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function getAvailableSlots(input: GetSlotsInput): Promise<Slot[]> {
|
|
36
|
+
const schedule = input.eventType.scheduleId
|
|
37
|
+
? await getScheduleById(input.eventType.scheduleId)
|
|
38
|
+
: await resolveDefaultSchedule(input.forUserEmail);
|
|
39
|
+
if (!schedule) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
const busy = await aggregateBusy({
|
|
43
|
+
userEmail: input.forUserEmail,
|
|
44
|
+
rangeStart: input.rangeStart,
|
|
45
|
+
rangeEnd: input.rangeEnd,
|
|
46
|
+
});
|
|
47
|
+
const counts = await bookingCountsFor(
|
|
48
|
+
input.forUserEmail,
|
|
49
|
+
input.eventType.id,
|
|
50
|
+
input.viewerTimezone ?? schedule.timezone,
|
|
51
|
+
);
|
|
52
|
+
return computeAvailableSlots({
|
|
53
|
+
duration: input.eventType.length,
|
|
54
|
+
minimumBookingNotice: input.eventType.minimumBookingNotice,
|
|
55
|
+
beforeEventBuffer: input.eventType.beforeEventBuffer,
|
|
56
|
+
afterEventBuffer: input.eventType.afterEventBuffer,
|
|
57
|
+
slotInterval: input.eventType.slotInterval,
|
|
58
|
+
periodType: input.eventType.periodType,
|
|
59
|
+
periodDays: input.eventType.periodDays,
|
|
60
|
+
periodStartDate: input.eventType.periodStartDate,
|
|
61
|
+
periodEndDate: input.eventType.periodEndDate,
|
|
62
|
+
bookingLimits: input.eventType.bookingLimits,
|
|
63
|
+
schedule: {
|
|
64
|
+
timezone: schedule.timezone,
|
|
65
|
+
weeklyAvailability: schedule.weeklyAvailability,
|
|
66
|
+
dateOverrides: schedule.dateOverrides,
|
|
67
|
+
},
|
|
68
|
+
busy,
|
|
69
|
+
bookingCounts: counts,
|
|
70
|
+
rangeStart: input.rangeStart,
|
|
71
|
+
rangeEnd: input.rangeEnd,
|
|
72
|
+
now: input.now,
|
|
73
|
+
seatsPerTimeSlot: input.eventType.seatsPerTimeSlot,
|
|
74
|
+
viewerTimezone: input.viewerTimezone ?? schedule.timezone,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function resolveDefaultSchedule(
|
|
79
|
+
ownerEmail: string,
|
|
80
|
+
): Promise<Schedule | null> {
|
|
81
|
+
const { getDb, schema } = getSchedulingContext();
|
|
82
|
+
const rows = await getDb()
|
|
83
|
+
.select()
|
|
84
|
+
.from(schema.schedules)
|
|
85
|
+
.where(
|
|
86
|
+
and(
|
|
87
|
+
eq(schema.schedules.ownerEmail, ownerEmail),
|
|
88
|
+
eq(schema.schedules.isDefault, true),
|
|
89
|
+
),
|
|
90
|
+
);
|
|
91
|
+
if (!rows[0]) return null;
|
|
92
|
+
return getScheduleById(rows[0].id);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Merge busy intervals from: (a) existing bookings for the user, (b) selected
|
|
97
|
+
* external calendars (via providers), (c) the calendar cache.
|
|
98
|
+
*/
|
|
99
|
+
export async function aggregateBusy(input: {
|
|
100
|
+
userEmail: string;
|
|
101
|
+
rangeStart: Date;
|
|
102
|
+
rangeEnd: Date;
|
|
103
|
+
}): Promise<BusyInterval[]> {
|
|
104
|
+
const { getDb, schema } = getSchedulingContext();
|
|
105
|
+
const db = getDb();
|
|
106
|
+
const busy: BusyInterval[] = [];
|
|
107
|
+
|
|
108
|
+
// Existing bookings where this user is the host
|
|
109
|
+
const bookings = await db
|
|
110
|
+
.select()
|
|
111
|
+
.from(schema.bookings)
|
|
112
|
+
.where(
|
|
113
|
+
and(
|
|
114
|
+
eq(schema.bookings.hostEmail, input.userEmail),
|
|
115
|
+
eq(schema.bookings.status, "confirmed"),
|
|
116
|
+
gte(schema.bookings.endTime, input.rangeStart.toISOString()),
|
|
117
|
+
lt(schema.bookings.startTime, input.rangeEnd.toISOString()),
|
|
118
|
+
),
|
|
119
|
+
);
|
|
120
|
+
for (const b of bookings) {
|
|
121
|
+
busy.push({
|
|
122
|
+
start: b.startTime,
|
|
123
|
+
end: b.endTime,
|
|
124
|
+
source: `booking:${b.uid}`,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// External calendars via registered providers
|
|
129
|
+
const creds = await db
|
|
130
|
+
.select()
|
|
131
|
+
.from(schema.schedulingCredentials)
|
|
132
|
+
.where(
|
|
133
|
+
and(
|
|
134
|
+
eq(schema.schedulingCredentials.userEmail, input.userEmail),
|
|
135
|
+
eq(schema.schedulingCredentials.invalid, false),
|
|
136
|
+
),
|
|
137
|
+
);
|
|
138
|
+
for (const cred of creds) {
|
|
139
|
+
const selected = await db
|
|
140
|
+
.select()
|
|
141
|
+
.from(schema.selectedCalendars)
|
|
142
|
+
.where(eq(schema.selectedCalendars.credentialId, cred.id));
|
|
143
|
+
if (selected.length === 0) continue;
|
|
144
|
+
const provider = getCalendarProvider(cred.type);
|
|
145
|
+
if (!provider) continue;
|
|
146
|
+
try {
|
|
147
|
+
const result = await provider.getBusy({
|
|
148
|
+
credentialId: cred.id,
|
|
149
|
+
calendarExternalIds: selected.map((s: any) => s.externalId),
|
|
150
|
+
start: input.rangeStart,
|
|
151
|
+
end: input.rangeEnd,
|
|
152
|
+
});
|
|
153
|
+
busy.push(...result);
|
|
154
|
+
} catch (err) {
|
|
155
|
+
// Silently degrade — booking UI shows "couldn't verify availability" banner
|
|
156
|
+
// Consumer logs via their own error handler
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return busy;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async function bookingCountsFor(
|
|
164
|
+
userEmail: string,
|
|
165
|
+
eventTypeId: string,
|
|
166
|
+
timezone: string,
|
|
167
|
+
): Promise<BookingCounts> {
|
|
168
|
+
const { getDb, schema } = getSchedulingContext();
|
|
169
|
+
const rows = await getDb()
|
|
170
|
+
.select()
|
|
171
|
+
.from(schema.bookings)
|
|
172
|
+
.where(
|
|
173
|
+
and(
|
|
174
|
+
eq(schema.bookings.hostEmail, userEmail),
|
|
175
|
+
eq(schema.bookings.eventTypeId, eventTypeId),
|
|
176
|
+
eq(schema.bookings.status, "confirmed"),
|
|
177
|
+
),
|
|
178
|
+
);
|
|
179
|
+
const counts: BookingCounts = {
|
|
180
|
+
perDay: {},
|
|
181
|
+
perWeek: {},
|
|
182
|
+
perMonth: {},
|
|
183
|
+
perYear: {},
|
|
184
|
+
};
|
|
185
|
+
for (const r of rows) {
|
|
186
|
+
const keys = bucketKeysForSlot(new Date(r.startTime), timezone);
|
|
187
|
+
counts.perDay[keys.day] = (counts.perDay[keys.day] ?? 0) + 1;
|
|
188
|
+
counts.perWeek[keys.week] = (counts.perWeek[keys.week] ?? 0) + 1;
|
|
189
|
+
counts.perMonth[keys.month] = (counts.perMonth[keys.month] ?? 0) + 1;
|
|
190
|
+
counts.perYear[keys.year] = (counts.perYear[keys.year] ?? 0) + 1;
|
|
191
|
+
}
|
|
192
|
+
return counts;
|
|
193
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Booking lifecycle — create, reschedule, cancel — wired to providers and
|
|
3
|
+
* workflow hooks.
|
|
4
|
+
*
|
|
5
|
+
* The booking flow:
|
|
6
|
+
* 1. Load event type and resolve host (1:1, round-robin).
|
|
7
|
+
* 2. Validate requested slot against availability engine.
|
|
8
|
+
* 3. Insert the booking row + attendees.
|
|
9
|
+
* 4. For each video/calendar provider, create external events and attach
|
|
10
|
+
* references to the booking.
|
|
11
|
+
* 5. Emit lifecycle event → workflows materialize scheduled reminders.
|
|
12
|
+
*/
|
|
13
|
+
import type {
|
|
14
|
+
Booking,
|
|
15
|
+
Attendee,
|
|
16
|
+
Location,
|
|
17
|
+
EventType,
|
|
18
|
+
} from "../shared/index.js";
|
|
19
|
+
import {
|
|
20
|
+
insertBooking,
|
|
21
|
+
getBookingByUid,
|
|
22
|
+
updateBookingStatus,
|
|
23
|
+
markAttendeeNoShow,
|
|
24
|
+
addBookingReference,
|
|
25
|
+
} from "./bookings-repo.js";
|
|
26
|
+
import { getEventTypeById } from "./event-types-repo.js";
|
|
27
|
+
import { getCalendarProvider, getVideoProvider } from "./providers/registry.js";
|
|
28
|
+
import {
|
|
29
|
+
onBookingCreated,
|
|
30
|
+
onBookingCancelled,
|
|
31
|
+
onBookingRescheduled,
|
|
32
|
+
} from "./hooks.js";
|
|
33
|
+
import { getSchedulingContext } from "./context.js";
|
|
34
|
+
import { eq } from "drizzle-orm";
|
|
35
|
+
|
|
36
|
+
export interface CreateBookingInput {
|
|
37
|
+
eventType: EventType;
|
|
38
|
+
hostEmail: string;
|
|
39
|
+
startTime: string;
|
|
40
|
+
endTime: string;
|
|
41
|
+
timezone: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
location?: Location;
|
|
45
|
+
attendee: Attendee;
|
|
46
|
+
guests?: Attendee[];
|
|
47
|
+
customResponses?: Record<string, any>;
|
|
48
|
+
iCalUid?: string;
|
|
49
|
+
iCalSequence?: number;
|
|
50
|
+
orgId?: string;
|
|
51
|
+
/** If set, we're rescheduling from this booking uid */
|
|
52
|
+
fromReschedule?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function createBooking(
|
|
56
|
+
input: CreateBookingInput,
|
|
57
|
+
): Promise<Booking> {
|
|
58
|
+
const eventType = input.eventType;
|
|
59
|
+
const title =
|
|
60
|
+
input.title ??
|
|
61
|
+
eventType.eventName?.replace("{attendeeName}", input.attendee.name) ??
|
|
62
|
+
`${eventType.title} with ${input.attendee.name}`;
|
|
63
|
+
const attendees: Attendee[] = [input.attendee, ...(input.guests ?? [])];
|
|
64
|
+
const booking = await insertBooking({
|
|
65
|
+
eventTypeId: eventType.id,
|
|
66
|
+
hostEmail: input.hostEmail,
|
|
67
|
+
title,
|
|
68
|
+
description: input.description,
|
|
69
|
+
startTime: input.startTime,
|
|
70
|
+
endTime: input.endTime,
|
|
71
|
+
timezone: input.timezone,
|
|
72
|
+
status: eventType.requiresConfirmation ? "pending" : "confirmed",
|
|
73
|
+
location: input.location ?? eventType.locations[0],
|
|
74
|
+
attendees,
|
|
75
|
+
customResponses: input.customResponses,
|
|
76
|
+
iCalUid: input.iCalUid,
|
|
77
|
+
iCalSequence: input.iCalSequence,
|
|
78
|
+
fromReschedule: input.fromReschedule,
|
|
79
|
+
ownerEmail: input.hostEmail,
|
|
80
|
+
orgId: input.orgId,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Create video meeting if location is a video kind
|
|
84
|
+
if (booking.location && isVideoKind(booking.location.kind)) {
|
|
85
|
+
const provider = getVideoProvider(
|
|
86
|
+
videoProviderKindFor(booking.location.kind),
|
|
87
|
+
);
|
|
88
|
+
if (provider) {
|
|
89
|
+
try {
|
|
90
|
+
const meeting = await provider.createMeeting({
|
|
91
|
+
credentialId: booking.location.credentialId,
|
|
92
|
+
booking,
|
|
93
|
+
});
|
|
94
|
+
if (meeting.meetingUrl) {
|
|
95
|
+
await addBookingReference(booking.id, {
|
|
96
|
+
type: provider.kind,
|
|
97
|
+
externalId: meeting.meetingId,
|
|
98
|
+
meetingUrl: meeting.meetingUrl,
|
|
99
|
+
meetingPassword: meeting.meetingPassword,
|
|
100
|
+
credentialId: booking.location.credentialId,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
// Continue without the video link; the host can fix on the booking detail page
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Write to destination calendar
|
|
110
|
+
await writeToDestinationCalendars(booking);
|
|
111
|
+
|
|
112
|
+
// Fire workflow hooks
|
|
113
|
+
await onBookingCreated(booking);
|
|
114
|
+
|
|
115
|
+
const final = await getBookingByUid(booking.uid);
|
|
116
|
+
if (!final) throw new Error("Booking disappeared after creation");
|
|
117
|
+
return final;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export async function rescheduleBooking(input: {
|
|
121
|
+
uid: string;
|
|
122
|
+
newStartTime: string;
|
|
123
|
+
newEndTime: string;
|
|
124
|
+
reason?: string;
|
|
125
|
+
rescheduledBy?: "attendee" | "host";
|
|
126
|
+
}): Promise<Booking> {
|
|
127
|
+
const original = await getBookingByUid(input.uid);
|
|
128
|
+
if (!original) throw new Error(`Booking ${input.uid} not found`);
|
|
129
|
+
const eventType = await getEventTypeById(original.eventTypeId);
|
|
130
|
+
if (!eventType) throw new Error("Event type missing");
|
|
131
|
+
|
|
132
|
+
// Mark old as rescheduled
|
|
133
|
+
await updateBookingStatus(input.uid, "rescheduled", {
|
|
134
|
+
reschedulingReason: input.reason,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Create new booking linked back to the original
|
|
138
|
+
const attendee = original.attendees[0];
|
|
139
|
+
const guests = original.attendees.slice(1);
|
|
140
|
+
const newBooking = await createBooking({
|
|
141
|
+
eventType,
|
|
142
|
+
hostEmail: original.hostEmail,
|
|
143
|
+
startTime: input.newStartTime,
|
|
144
|
+
endTime: input.newEndTime,
|
|
145
|
+
timezone: original.timezone,
|
|
146
|
+
title: original.title,
|
|
147
|
+
description: original.description,
|
|
148
|
+
location: original.location,
|
|
149
|
+
attendee,
|
|
150
|
+
guests,
|
|
151
|
+
customResponses: original.customResponses,
|
|
152
|
+
iCalUid: original.iCalUid,
|
|
153
|
+
iCalSequence: original.iCalSequence + 1,
|
|
154
|
+
fromReschedule: input.uid,
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Update external calendar events (PATCH, not delete+create)
|
|
158
|
+
for (const ref of original.references) {
|
|
159
|
+
const provider = getCalendarProvider(ref.type);
|
|
160
|
+
if (provider?.updateEvent && ref.credentialId) {
|
|
161
|
+
try {
|
|
162
|
+
await provider.updateEvent({
|
|
163
|
+
credentialId: ref.credentialId,
|
|
164
|
+
externalId: ref.externalId,
|
|
165
|
+
booking: newBooking,
|
|
166
|
+
});
|
|
167
|
+
} catch {
|
|
168
|
+
// Event may have been deleted manually; fall through
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
await onBookingRescheduled(original, newBooking);
|
|
174
|
+
return newBooking;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export async function cancelBooking(input: {
|
|
178
|
+
uid: string;
|
|
179
|
+
reason?: string;
|
|
180
|
+
cancelledBy?: "attendee" | "host";
|
|
181
|
+
}): Promise<Booking> {
|
|
182
|
+
const booking = await getBookingByUid(input.uid);
|
|
183
|
+
if (!booking) throw new Error(`Booking ${input.uid} not found`);
|
|
184
|
+
await updateBookingStatus(input.uid, "cancelled", {
|
|
185
|
+
cancellationReason: input.reason,
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
for (const ref of booking.references) {
|
|
189
|
+
const calProvider = getCalendarProvider(ref.type);
|
|
190
|
+
if (calProvider?.deleteEvent && ref.credentialId) {
|
|
191
|
+
try {
|
|
192
|
+
await calProvider.deleteEvent({
|
|
193
|
+
credentialId: ref.credentialId,
|
|
194
|
+
externalId: ref.externalId,
|
|
195
|
+
});
|
|
196
|
+
} catch {}
|
|
197
|
+
}
|
|
198
|
+
const videoProvider = getVideoProvider(ref.type);
|
|
199
|
+
if (videoProvider?.deleteMeeting) {
|
|
200
|
+
try {
|
|
201
|
+
await videoProvider.deleteMeeting({
|
|
202
|
+
credentialId: ref.credentialId,
|
|
203
|
+
meetingId: ref.externalId,
|
|
204
|
+
});
|
|
205
|
+
} catch {}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
await onBookingCancelled(booking);
|
|
210
|
+
return (await getBookingByUid(input.uid))!;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export async function markNoShow(
|
|
214
|
+
uid: string,
|
|
215
|
+
attendeeEmail: string,
|
|
216
|
+
): Promise<void> {
|
|
217
|
+
const booking = await getBookingByUid(uid);
|
|
218
|
+
if (!booking) throw new Error(`Booking ${uid} not found`);
|
|
219
|
+
await markAttendeeNoShow(booking.id, attendeeEmail);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function isVideoKind(kind: string): boolean {
|
|
223
|
+
return ["builtin-video", "zoom", "google-meet", "teams"].includes(kind);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function videoProviderKindFor(kind: string): string {
|
|
227
|
+
if (kind === "builtin-video") return "builtin_video";
|
|
228
|
+
if (kind === "zoom") return "zoom_video";
|
|
229
|
+
if (kind === "google-meet") return "google_meet";
|
|
230
|
+
if (kind === "teams") return "teams_video";
|
|
231
|
+
return kind;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
async function writeToDestinationCalendars(booking: Booking): Promise<void> {
|
|
235
|
+
const { getDb, schema } = getSchedulingContext();
|
|
236
|
+
const db = getDb();
|
|
237
|
+
const destinations = await db
|
|
238
|
+
.select()
|
|
239
|
+
.from(schema.destinationCalendars)
|
|
240
|
+
.where(eq(schema.destinationCalendars.userEmail, booking.hostEmail));
|
|
241
|
+
for (const dest of destinations) {
|
|
242
|
+
if (dest.eventTypeId && dest.eventTypeId !== booking.eventTypeId) continue;
|
|
243
|
+
const provider = getCalendarProvider(dest.integration);
|
|
244
|
+
if (!provider) continue;
|
|
245
|
+
try {
|
|
246
|
+
const result = await provider.createEvent({
|
|
247
|
+
credentialId: dest.credentialId,
|
|
248
|
+
calendarExternalId: dest.externalId,
|
|
249
|
+
booking,
|
|
250
|
+
includeConference:
|
|
251
|
+
booking.location?.kind === "google-meet" &&
|
|
252
|
+
dest.integration === "google_calendar",
|
|
253
|
+
});
|
|
254
|
+
await addBookingReference(booking.id, {
|
|
255
|
+
type: dest.integration,
|
|
256
|
+
externalId: result.externalId,
|
|
257
|
+
meetingUrl: result.meetingUrl,
|
|
258
|
+
credentialId: dest.credentialId,
|
|
259
|
+
});
|
|
260
|
+
} catch {
|
|
261
|
+
// Calendar write failed; booking still exists locally
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|