Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/_shared/rate-limit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IncomingHttpHeaders } from 'http';

import type { ApiResponse } from './http-types';
import type { ApiResponse } from './http-types.js';
import recaptcha from './recaptcha.js';

const { extractClientIp } = recaptcha;
Expand Down
2 changes: 1 addition & 1 deletion api/booking/_lib/d1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getRuntimeEnv } from './config';
import { getRuntimeEnv } from './config.js';

// We're on Vercel, not on Cloudflare, so we hit D1's HTTP query API rather
// than binding the database. The API accepts a single SQL statement plus an
Expand Down
2 changes: 1 addition & 1 deletion api/booking/_lib/google-calendar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getRuntimeEnv } from './config';
import { getRuntimeEnv } from './config.js';

// Thin wrapper around the Google Calendar v3 REST API. We avoid pulling the
// `googleapis` package (heavy, slow cold-start) and stay on direct `fetch`
Expand Down
2 changes: 1 addition & 1 deletion api/booking/_lib/mailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
MAIL_FROM,
NOTIFICATION_EMAIL,
getRuntimeEnv,
} from './config';
} from './config.js';

// Render-side helpers are kept lean and inline: no template engine, no
// per-locale dispatch table, just two functions per email kind (subject + html)
Expand Down
2 changes: 1 addition & 1 deletion api/booking/_lib/slots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
buildAvailableSlots,
isSlotValid,
type BusyInterval,
} from './slots';
} from './slots.js';

// All test inputs are anchored in UTC. The slots module renders them against
// Europe/Zurich (UTC+1 in winter, UTC+2 in summer), so the expected wall-clock
Expand Down
2 changes: 1 addition & 1 deletion api/booking/_lib/slots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
MEETING_DURATION_MIN,
MIN_NOTICE_MS,
SLOT_GRANULARITY_MIN,
} from './config';
} from './config.js';

// All timestamps in this module are UTC. The "9-18 Europe/Zurich" window is
// resolved per-day using Intl.DateTimeFormat in BOOKING_TIMEZONE because that
Expand Down
2 changes: 1 addition & 1 deletion api/booking/_lib/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createHmac, randomUUID, timingSafeEqual } from 'crypto';

import { getRuntimeEnv } from './config';
import { getRuntimeEnv } from './config.js';
Comment on lines 1 to +3

// Cancellation / reschedule links are stateless-ish: each booking gets a token
// derived from `HMAC(secret, bookingId + ":" + purpose + ":" + exp + ":" + version)`.
Expand Down
10 changes: 5 additions & 5 deletions api/booking/availability.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { ApiRequest, ApiResponse } from '../_shared/http-types';
import type { ApiRequest, ApiResponse } from '../_shared/http-types.js';
import {
applyRateLimitHeaders,
checkRateLimit,
getRateLimitIdentifier,
} from '../_shared/rate-limit';
} from '../_shared/rate-limit.js';

import { getBusyIntervals } from './_lib/google-calendar';
import { buildAvailableSlots } from './_lib/slots';
import { parseAvailabilityRange } from './_lib/validators';
import { getBusyIntervals } from './_lib/google-calendar.js';
import { buildAvailableSlots } from './_lib/slots.js';
import { parseAvailabilityRange } from './_lib/validators.js';

const AVAILABILITY_RATE_LIMIT = {
limit: 60,
Expand Down
14 changes: 7 additions & 7 deletions api/booking/cancel.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { ApiRequest, ApiResponse } from '../_shared/http-types';
import type { ApiRequest, ApiResponse } from '../_shared/http-types.js';
import {
applyRateLimitHeaders,
checkRateLimit,
getRateLimitIdentifier,
} from '../_shared/rate-limit';
} from '../_shared/rate-limit.js';

import { getRuntimeEnv } from './_lib/config';
import { exec, queryFirst } from './_lib/d1';
import { deleteEvent } from './_lib/google-calendar';
import { sendBookingCancellation } from './_lib/mailer';
import { verifyToken } from './_lib/tokens';
import { getRuntimeEnv } from './_lib/config.js';
import { exec, queryFirst } from './_lib/d1.js';
import { deleteEvent } from './_lib/google-calendar.js';
import { sendBookingCancellation } from './_lib/mailer.js';
import { verifyToken } from './_lib/tokens.js';

const CANCEL_RATE_LIMIT = {
limit: 10,
Expand Down
18 changes: 9 additions & 9 deletions api/booking/create.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import type { ApiRequest, ApiResponse } from '../_shared/http-types';
import type { ApiRequest, ApiResponse } from '../_shared/http-types.js';
import {
applyRateLimitHeaders,
checkRateLimit,
getRateLimitIdentifier,
} from '../_shared/rate-limit';
} from '../_shared/rate-limit.js';
import recaptcha from '../_shared/recaptcha.js';

import {
BOOKING_TIMEZONE,
MEETING_DURATION_MIN,
getRuntimeEnv,
} from './_lib/config';
import { exec, isUniqueConstraintError, queryFirst } from './_lib/d1';
import { createEvent, deleteEvent, getBusyIntervals } from './_lib/google-calendar';
import { sendBookingConfirmation } from './_lib/mailer';
import { isSlotValid } from './_lib/slots';
import { generateToken, newBookingId } from './_lib/tokens';
import { validateCreatePayload } from './_lib/validators';
} from './_lib/config.js';
import { exec, isUniqueConstraintError, queryFirst } from './_lib/d1.js';
import { createEvent, deleteEvent, getBusyIntervals } from './_lib/google-calendar.js';
import { sendBookingConfirmation } from './_lib/mailer.js';
import { isSlotValid } from './_lib/slots.js';
Comment on lines +13 to +17
import { generateToken, newBookingId } from './_lib/tokens.js';
import { validateCreatePayload } from './_lib/validators.js';

const { extractClientIp, verifyRecaptcha } = recaptcha;

Expand Down
8 changes: 4 additions & 4 deletions api/booking/lookup.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { ApiRequest, ApiResponse } from '../_shared/http-types';
import type { ApiRequest, ApiResponse } from '../_shared/http-types.js';
import {
applyRateLimitHeaders,
checkRateLimit,
getRateLimitIdentifier,
} from '../_shared/rate-limit';
} from '../_shared/rate-limit.js';

import { queryFirst } from './_lib/d1';
import { verifyToken } from './_lib/tokens';
import { queryFirst } from './_lib/d1.js';
import { verifyToken } from './_lib/tokens.js';

const LOOKUP_RATE_LIMIT = {
limit: 30,
Expand Down
16 changes: 8 additions & 8 deletions api/booking/reschedule.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { ApiRequest, ApiResponse } from '../_shared/http-types';
import type { ApiRequest, ApiResponse } from '../_shared/http-types.js';
import {
applyRateLimitHeaders,
checkRateLimit,
getRateLimitIdentifier,
} from '../_shared/rate-limit';
} from '../_shared/rate-limit.js';

import {
BOOKING_TIMEZONE,
MEETING_DURATION_MIN,
getRuntimeEnv,
} from './_lib/config';
import { exec, isUniqueConstraintError, queryFirst } from './_lib/d1';
import { getBusyIntervals, updateEventTime } from './_lib/google-calendar';
import { sendBookingConfirmation } from './_lib/mailer';
import { isSlotValid } from './_lib/slots';
import { generateToken, verifyToken } from './_lib/tokens';
} from './_lib/config.js';
import { exec, isUniqueConstraintError, queryFirst } from './_lib/d1.js';
import { getBusyIntervals, updateEventTime } from './_lib/google-calendar.js';
import { sendBookingConfirmation } from './_lib/mailer.js';
import { isSlotValid } from './_lib/slots.js';
import { generateToken, verifyToken } from './_lib/tokens.js';

const RESCHEDULE_RATE_LIMIT = {
limit: 5,
Expand Down
4 changes: 2 additions & 2 deletions api/newsletter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Resend } from 'resend';
import type { ApiRequest, ApiResponse } from './_shared/http-types';
import type { ApiRequest, ApiResponse } from './_shared/http-types.js';
import newsletterMailer from './_shared/newsletter-mailer.js';
import {
applyRateLimitHeaders,
checkRateLimit,
getRateLimitIdentifier,
} from './_shared/rate-limit';
} from './_shared/rate-limit.js';
import recaptcha from './_shared/recaptcha.js';

const { newsletterApiErrors, sendNewsletterEmail, validateNewsletterPayload } = newsletterMailer;
Expand Down
4 changes: 2 additions & 2 deletions api/send.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Resend } from 'resend';
import type { ApiRequest, ApiResponse } from './_shared/http-types';
import type { ApiRequest, ApiResponse } from './_shared/http-types.js';
import contactMailer from './_shared/contact-mailer.js';
import {
applyRateLimitHeaders,
checkRateLimit,
getRateLimitIdentifier,
} from './_shared/rate-limit';
} from './_shared/rate-limit.js';
Comment on lines 4 to +8
import recaptcha from './_shared/recaptcha.js';

const { contactApiErrors, sendContactEmails, validateContactPayload } = contactMailer;
Expand Down
Loading