@atzentis/booking-sdk 0.1.4 → 0.1.5

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/dist/index.cjs CHANGED
@@ -28,6 +28,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
28
28
  var index_exports = {};
29
29
  __export(index_exports, {
30
30
  AuthenticationError: () => AuthenticationError,
31
+ AvailabilityService: () => AvailabilityService,
31
32
  BookingClient: () => BookingClient,
32
33
  BookingError: () => BookingError,
33
34
  CategoriesService: () => CategoriesService,
@@ -523,6 +524,267 @@ var BaseService = class {
523
524
  }
524
525
  };
525
526
 
527
+ // src/services/availability.ts
528
+ var AvailabilityService = class extends BaseService {
529
+ constructor() {
530
+ super(...arguments);
531
+ this.basePath = "/booking/v1/availability";
532
+ }
533
+ /**
534
+ * Check availability for a property and date range.
535
+ *
536
+ * @param params - Must include `propertyId`, `checkIn`, `checkOut`; supports optional filters
537
+ *
538
+ * @example
539
+ * ```typescript
540
+ * const result = await booking.availability.check({
541
+ * propertyId: "prop_abc123",
542
+ * checkIn: "2025-06-01",
543
+ * checkOut: "2025-06-05",
544
+ * type: "room",
545
+ * guests: 2,
546
+ * });
547
+ * ```
548
+ */
549
+ check(params) {
550
+ const { propertyId, checkIn, checkOut, categoryId, spaceId, guests, type } = params;
551
+ return this._get(this.basePath, {
552
+ propertyId,
553
+ checkIn,
554
+ checkOut,
555
+ categoryId,
556
+ spaceId,
557
+ guests,
558
+ type
559
+ });
560
+ }
561
+ /**
562
+ * Search availability across multiple properties.
563
+ *
564
+ * @param params - Must include `propertyIds`, `checkIn`, `checkOut`; supports filtering and pagination
565
+ *
566
+ * @example
567
+ * ```typescript
568
+ * const results = await booking.availability.search({
569
+ * propertyIds: ["prop_abc", "prop_def"],
570
+ * checkIn: "2025-06-01",
571
+ * checkOut: "2025-06-05",
572
+ * guests: 2,
573
+ * priceRange: { min: 5000, max: 20000 },
574
+ * });
575
+ * ```
576
+ */
577
+ search(params) {
578
+ return this._post(this.basePath, params);
579
+ }
580
+ /**
581
+ * Generate a calendar view of daily availability for a property.
582
+ *
583
+ * Client-side helper that calls `check()` internally and transforms the result
584
+ * into a `CalendarDay[]` suitable for calendar UI rendering.
585
+ *
586
+ * @param params - Extends `AvailabilityCheckParams` with optional `months` (default: 1)
587
+ *
588
+ * @example
589
+ * ```typescript
590
+ * const calendar = await booking.availability.getCalendar({
591
+ * propertyId: "prop_abc123",
592
+ * checkIn: "2025-06-01",
593
+ * checkOut: "2025-06-30",
594
+ * });
595
+ * ```
596
+ */
597
+ async getCalendar(params) {
598
+ const { months, ...checkParams } = params;
599
+ let endDate;
600
+ if (checkParams.checkOut !== checkParams.checkIn) {
601
+ endDate = checkParams.checkOut;
602
+ } else if (months != null) {
603
+ endDate = addDays(checkParams.checkIn, months * 30);
604
+ } else {
605
+ return [];
606
+ }
607
+ const dates = generateDateRange(checkParams.checkIn, endDate, 365);
608
+ if (dates.length === 0) return [];
609
+ const result = await this.check({ ...checkParams, checkOut: endDate });
610
+ const spacesAvailable = result.spaces.filter((s) => s.available).length;
611
+ return dates.map((date) => ({
612
+ date,
613
+ available: result.available,
614
+ price: result.available && result.pricing ? result.pricing.total : null,
615
+ minStay: result.restrictions?.minStay ?? null,
616
+ closedToArrival: result.restrictions?.closedToArrival ?? false,
617
+ closedToDeparture: result.restrictions?.closedToDeparture ?? false,
618
+ spacesAvailable: result.available ? spacesAvailable : 0
619
+ }));
620
+ }
621
+ /**
622
+ * Get available table reservation time slots for a specific date.
623
+ *
624
+ * Client-side helper for the Tables vertical. Calls `check()` internally
625
+ * with `type: "table"` and reshapes the response into `TimeSlot[]`.
626
+ *
627
+ * @param params - Must include `propertyId` and `date`
628
+ *
629
+ * @example
630
+ * ```typescript
631
+ * const slots = await booking.availability.getTableSlots({
632
+ * propertyId: "prop_abc123",
633
+ * date: "2025-06-15",
634
+ * guests: 4,
635
+ * });
636
+ * ```
637
+ */
638
+ async getTableSlots(params) {
639
+ const { date, guests, categoryId, duration, ...rest } = params;
640
+ const result = await this.check({
641
+ ...rest,
642
+ checkIn: date,
643
+ checkOut: date,
644
+ type: "table",
645
+ guests,
646
+ categoryId
647
+ });
648
+ if (!result.available || result.spaces.length === 0) {
649
+ return [];
650
+ }
651
+ const slotDuration = duration ?? 90;
652
+ const availableSpaces = result.spaces.filter((s) => s.available);
653
+ return availableSpaces.map((space, index) => ({
654
+ startTime: minutesToTime(11 * 60 + index * slotDuration),
655
+ endTime: minutesToTime(11 * 60 + index * slotDuration + slotDuration),
656
+ available: true,
657
+ tablesAvailable: availableSpaces.length,
658
+ price: space.price
659
+ }));
660
+ }
661
+ /**
662
+ * Get available service appointment slots for a specific date.
663
+ *
664
+ * Client-side helper for the Services vertical. Calls `check()` internally
665
+ * with `type: "service"` and reshapes the response into `ServiceTimeSlot[]`.
666
+ *
667
+ * @param params - Must include `propertyId` and `date`
668
+ *
669
+ * @example
670
+ * ```typescript
671
+ * const slots = await booking.availability.getServiceSlots({
672
+ * propertyId: "prop_abc123",
673
+ * date: "2025-06-15",
674
+ * providerId: "staff_001",
675
+ * duration: 60,
676
+ * });
677
+ * ```
678
+ */
679
+ async getServiceSlots(params) {
680
+ const { date, providerId, categoryId, duration, ...rest } = params;
681
+ const result = await this.check({
682
+ ...rest,
683
+ checkIn: date,
684
+ checkOut: date,
685
+ type: "service",
686
+ categoryId
687
+ });
688
+ if (!result.available || result.spaces.length === 0) {
689
+ return [];
690
+ }
691
+ const slotDuration = duration ?? 60;
692
+ const availableSpaces = result.spaces.filter((s) => s.available);
693
+ return availableSpaces.map((space, index) => ({
694
+ startTime: minutesToTime(9 * 60 + index * slotDuration),
695
+ endTime: minutesToTime(9 * 60 + index * slotDuration + slotDuration),
696
+ available: true,
697
+ tablesAvailable: availableSpaces.length,
698
+ price: space.price,
699
+ providerId: providerId ?? space.spaceId,
700
+ providerName: space.name
701
+ }));
702
+ }
703
+ /**
704
+ * Get aggregated pricing statistics for a property and date range.
705
+ *
706
+ * Client-side helper that calls `check()` internally and computes
707
+ * min/max/average/total pricing from available spaces.
708
+ *
709
+ * @param params - Extends `AvailabilityCheckParams` with optional `currency`
710
+ *
711
+ * @example
712
+ * ```typescript
713
+ * const pricing = await booking.availability.getPricing({
714
+ * propertyId: "prop_abc123",
715
+ * checkIn: "2025-06-01",
716
+ * checkOut: "2025-06-05",
717
+ * });
718
+ * console.log(`From €${pricing.minPrice / 100} to €${pricing.maxPrice / 100}`);
719
+ * ```
720
+ */
721
+ async getPricing(params) {
722
+ const { currency: requestedCurrency, ...checkParams } = params;
723
+ const result = await this.check(checkParams);
724
+ const availableSpaces = result.spaces.filter((s) => s.available);
725
+ const nights = dateDiffDays(params.checkIn, params.checkOut);
726
+ const currency = requestedCurrency ?? result.pricing?.currency ?? "EUR";
727
+ if (availableSpaces.length === 0) {
728
+ return {
729
+ minPrice: 0,
730
+ maxPrice: 0,
731
+ averagePrice: 0,
732
+ totalPrice: 0,
733
+ perNight: null,
734
+ nights,
735
+ currency
736
+ };
737
+ }
738
+ const prices = availableSpaces.map((s) => s.price);
739
+ const minPrice = Math.min(...prices);
740
+ const maxPrice = Math.max(...prices);
741
+ const averagePrice = Math.round(prices.reduce((sum, p) => sum + p, 0) / prices.length);
742
+ const totalPrice = result.pricing?.total ?? averagePrice * Math.max(nights, 1);
743
+ const perNight = nights > 0 ? Math.round(totalPrice / nights) : null;
744
+ return { minPrice, maxPrice, averagePrice, totalPrice, perNight, nights, currency };
745
+ }
746
+ };
747
+ function parseDateStr(dateStr) {
748
+ const parts = dateStr.split("-");
749
+ return [Number(parts[0]), Number(parts[1]), Number(parts[2])];
750
+ }
751
+ function addDays(dateStr, days) {
752
+ const [year, month, day] = parseDateStr(dateStr);
753
+ return formatDate(new Date(Date.UTC(year, month - 1, day + days)));
754
+ }
755
+ function generateDateRange(start, end, maxDays) {
756
+ const [sy, sm, sd] = parseDateStr(start);
757
+ const [ey, em, ed] = parseDateStr(end);
758
+ const startMs = Date.UTC(sy, sm - 1, sd);
759
+ const endMs = Date.UTC(ey, em - 1, ed);
760
+ if (endMs <= startMs) return [];
761
+ const msPerDay = 864e5;
762
+ const totalDays = Math.min(Math.floor((endMs - startMs) / msPerDay), maxDays);
763
+ const dates = [];
764
+ for (let i = 0; i < totalDays; i++) {
765
+ dates.push(formatDate(new Date(startMs + i * msPerDay)));
766
+ }
767
+ return dates;
768
+ }
769
+ function dateDiffDays(start, end) {
770
+ const [sy, sm, sd] = parseDateStr(start);
771
+ const [ey, em, ed] = parseDateStr(end);
772
+ const startMs = Date.UTC(sy, sm - 1, sd);
773
+ const endMs = Date.UTC(ey, em - 1, ed);
774
+ return Math.max(0, Math.floor((endMs - startMs) / 864e5));
775
+ }
776
+ function formatDate(d) {
777
+ const y = d.getUTCFullYear();
778
+ const m = String(d.getUTCMonth() + 1).padStart(2, "0");
779
+ const day = String(d.getUTCDate()).padStart(2, "0");
780
+ return `${y}-${m}-${day}`;
781
+ }
782
+ function minutesToTime(totalMinutes) {
783
+ const hours = Math.floor(totalMinutes / 60) % 24;
784
+ const minutes = totalMinutes % 60;
785
+ return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
786
+ }
787
+
526
788
  // src/services/categories.ts
527
789
  var CategoriesService = class extends BaseService {
528
790
  constructor() {
@@ -807,6 +1069,11 @@ var BookingClient = class {
807
1069
  logger: validated.logger
808
1070
  });
809
1071
  }
1072
+ /** Availability service — lazy-initialized on first access */
1073
+ get availability() {
1074
+ this._availability ?? (this._availability = new AvailabilityService(this.httpClient));
1075
+ return this._availability;
1076
+ }
810
1077
  /** Properties service — lazy-initialized on first access */
811
1078
  get properties() {
812
1079
  this._properties ?? (this._properties = new PropertiesService(this.httpClient));
@@ -910,6 +1177,7 @@ var VERSION = "0.1.0";
910
1177
  // Annotate the CommonJS export names for ESM import in node:
911
1178
  0 && (module.exports = {
912
1179
  AuthenticationError,
1180
+ AvailabilityService,
913
1181
  BookingClient,
914
1182
  BookingError,
915
1183
  CategoriesService,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/errors.ts","../src/http.ts","../src/services/base.ts","../src/services/categories.ts","../src/services/properties.ts","../src/services/spaces.ts","../src/client.ts","../src/pagination.ts","../src/types/properties.ts","../src/types/spaces.ts"],"sourcesContent":["// @atzentis/booking-sdk\nexport const VERSION = \"0.1.0\";\n\nexport { BookingClient } from \"./client.js\";\nexport { bookingClientConfigSchema } from \"./config.js\";\nexport type {\n BookingClientConfig,\n ResolvedBookingClientConfig,\n} from \"./config.js\";\n\nexport { HttpClient } from \"./http.js\";\n\nexport {\n AuthenticationError,\n BookingError,\n ConflictError,\n createErrorFromResponse,\n ForbiddenError,\n NotFoundError,\n PaymentError,\n RateLimitError,\n ServerError,\n TimeoutError,\n ValidationError,\n} from \"./errors.js\";\nexport type { BookingErrorOptions } from \"./errors.js\";\n\nexport { firstPage, paginate } from \"./pagination.js\";\n\n// Services\nexport {\n CategoriesService,\n PropertiesService,\n SpacesService,\n} from \"./services/index.js\";\n\n// Types — re-export everything from types barrel\nexport type {\n BulkUpdateSpaceInput,\n Coordinates,\n CreateCategoryInput,\n CreatePropertyInput,\n CreateSpaceInput,\n HttpClientOptions,\n HttpMethod,\n HttpResponse,\n LinkPosTableInput,\n ListCategoriesParams,\n ListPropertiesParams,\n ListSpacesParams,\n Logger,\n PageFetcher,\n Paginated,\n PaginationOptions,\n Property,\n PropertyAddress,\n PropertyModules,\n PropertyStatus,\n PropertyType,\n RequestOptions,\n RetryConfig,\n RetryOptions,\n Space,\n SpaceCategory,\n SpaceStatus,\n SpaceType,\n UpdateCategoryInput,\n UpdatePropertyInput,\n UpdateSpaceInput,\n} from \"./types/index.js\";\nexport {\n DEFAULT_MODULES,\n PROPERTY_MODULES,\n SPACE_STATUSES,\n SPACE_TYPES,\n} from \"./types/index.js\";\n","// Configuration schema for @atzentis/booking-sdk\n\nimport { z } from \"zod\";\n\nexport const bookingClientConfigSchema = z.object({\n apiKey: z.string().min(1, \"apiKey is required\"),\n baseUrl: z.string().url().default(\"https://api.atzentis.io\"),\n tenantId: z.string().min(1).optional(),\n timeout: z.number().int().positive().default(30_000),\n retry: z\n .object({\n maxRetries: z.number().int().min(0).max(10).default(3),\n baseDelay: z.number().int().positive().default(500),\n })\n .optional(),\n debug: z.boolean().default(false),\n logger: z\n .object({\n debug: z.custom<(message: string, ...args: unknown[]) => void>(\n (val) => typeof val === \"function\",\n ),\n })\n .optional(),\n});\n\n/** Input type for BookingClient constructor (optional fields truly optional) */\nexport type BookingClientConfig = z.input<typeof bookingClientConfigSchema>;\n\n/** Resolved config type after Zod defaults are applied */\nexport type ResolvedBookingClientConfig = z.output<typeof bookingClientConfigSchema>;\n","// Error class hierarchy for @atzentis/booking-sdk\n\n/** Options for constructing a BookingError */\nexport interface BookingErrorOptions {\n code: string;\n status?: number;\n details?: Record<string, unknown>;\n}\n\n/** Base error class for all SDK errors */\nexport class BookingError extends Error {\n readonly code: string;\n readonly status: number | undefined;\n readonly details: Record<string, unknown>;\n\n constructor(message: string, options: BookingErrorOptions) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"BookingError\";\n this.code = options.code;\n this.status = options.status;\n this.details = options.details ?? {};\n }\n}\n\n/** HTTP 401 — invalid or missing API key */\nexport class AuthenticationError extends BookingError {\n constructor(\n message = \"Authentication failed: invalid or missing API key\",\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"AUTHENTICATION_ERROR\", status: 401, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"AuthenticationError\";\n }\n}\n\n/** HTTP 402 — payment required or payment failed */\nexport class PaymentError extends BookingError {\n constructor(message = \"Payment required or payment failed\", details?: Record<string, unknown>) {\n super(message, { code: \"PAYMENT_ERROR\", status: 402, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"PaymentError\";\n }\n}\n\n/** HTTP 403 — insufficient permissions */\nexport class ForbiddenError extends BookingError {\n constructor(\n message = \"Insufficient permissions to perform this action\",\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"FORBIDDEN_ERROR\", status: 403, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ForbiddenError\";\n }\n}\n\n/** HTTP 404 — resource not found */\nexport class NotFoundError extends BookingError {\n constructor(message = \"The requested resource was not found\", details?: Record<string, unknown>) {\n super(message, { code: \"NOT_FOUND_ERROR\", status: 404, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"NotFoundError\";\n }\n}\n\n/** HTTP 409 — resource conflict */\nexport class ConflictError extends BookingError {\n constructor(\n message = \"Resource conflict — the booking may already exist\",\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"CONFLICT_ERROR\", status: 409, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ConflictError\";\n }\n}\n\n/** HTTP 422 — request validation failed with field-level errors */\nexport class ValidationError extends BookingError {\n readonly fieldErrors: Record<string, string[]>;\n\n constructor(\n message = \"Request validation failed\",\n fieldErrors: Record<string, string[]> = {},\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"VALIDATION_ERROR\", status: 422, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ValidationError\";\n this.fieldErrors = fieldErrors;\n }\n}\n\n/** HTTP 429 — rate limit exceeded */\nexport class RateLimitError extends BookingError {\n readonly retryAfter: number;\n\n constructor(message = \"Rate limit exceeded\", retryAfter = 60) {\n super(message, { code: \"RATE_LIMIT_ERROR\", status: 429 });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"RateLimitError\";\n this.retryAfter = retryAfter;\n }\n}\n\n/** HTTP 5xx — unexpected server error */\nexport class ServerError extends BookingError {\n constructor(\n message = \"An unexpected server error occurred\",\n status = 500,\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"SERVER_ERROR\", status, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ServerError\";\n }\n}\n\n/** Timeout error — request was aborted by AbortController */\nexport class TimeoutError extends BookingError {\n constructor(message = \"The request timed out\") {\n super(message, { code: \"TIMEOUT_ERROR\" });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"TimeoutError\";\n }\n}\n\n// --- Factory helpers ---\n\nfunction parseRetryAfter(header: string | null | undefined): number {\n if (!header) return 60;\n\n const seconds = Number.parseInt(header, 10);\n if (Number.isFinite(seconds) && seconds > 0) return seconds;\n\n const date = new Date(header);\n if (!Number.isNaN(date.getTime())) {\n return Math.max(0, Math.round((date.getTime() - Date.now()) / 1000));\n }\n\n return 60;\n}\n\nfunction extractBody(body: unknown): Record<string, unknown> {\n if (typeof body === \"object\" && body !== null && !Array.isArray(body)) {\n return body as Record<string, unknown>;\n }\n return {};\n}\n\nfunction extractMessage(body: Record<string, unknown>, fallback: string): string {\n if (typeof body.message === \"string\" && body.message.length > 0) {\n return body.message;\n }\n return fallback;\n}\n\nfunction parseFieldErrors(errors: unknown): Record<string, string[]> {\n if (typeof errors !== \"object\" || errors === null || Array.isArray(errors)) {\n return {};\n }\n\n const result: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(errors as Record<string, unknown>)) {\n if (Array.isArray(value)) {\n result[key] = value.map(String);\n } else if (typeof value === \"string\") {\n result[key] = [value];\n }\n }\n return result;\n}\n\n/** Creates a typed BookingError from an HTTP response and parsed body */\nexport function createErrorFromResponse(\n response: Response,\n body: unknown,\n retryAfterHeader?: string | null,\n): BookingError {\n const bodyObj = extractBody(body);\n const status = response.status;\n\n switch (status) {\n case 401:\n return new AuthenticationError(\n extractMessage(bodyObj, \"Authentication failed: invalid or missing API key\"),\n bodyObj,\n );\n case 402:\n return new PaymentError(\n extractMessage(bodyObj, \"Payment required or payment failed\"),\n bodyObj,\n );\n case 403:\n return new ForbiddenError(\n extractMessage(bodyObj, \"Insufficient permissions to perform this action\"),\n bodyObj,\n );\n case 404:\n return new NotFoundError(\n extractMessage(bodyObj, \"The requested resource was not found\"),\n bodyObj,\n );\n case 409:\n return new ConflictError(extractMessage(bodyObj, \"Resource conflict\"), bodyObj);\n case 422:\n return new ValidationError(\n extractMessage(bodyObj, \"Request validation failed\"),\n parseFieldErrors(bodyObj.errors),\n bodyObj,\n );\n case 429:\n return new RateLimitError(\n extractMessage(bodyObj, \"Rate limit exceeded\"),\n parseRetryAfter(retryAfterHeader ?? null),\n );\n default:\n if (status >= 500) {\n return new ServerError(\n extractMessage(bodyObj, \"An unexpected server error occurred\"),\n status,\n bodyObj,\n );\n }\n return new BookingError(extractMessage(bodyObj, `HTTP ${status} error`), {\n code: \"HTTP_ERROR\",\n status,\n details: bodyObj,\n });\n }\n}\n","// Core HTTP client — wraps native fetch with typed methods\n\nimport { TimeoutError, createErrorFromResponse } from \"./errors.js\";\nimport type { Logger, RetryConfig } from \"./types/config.js\";\nimport type { HttpClientOptions, HttpMethod, RequestOptions } from \"./types/http.js\";\n\nconst RETRYABLE_STATUSES = new Set([500, 502, 503, 504]);\n\nconst DEFAULT_RETRY_CONFIG: RetryConfig = {\n maxRetries: 3,\n baseDelay: 500,\n retryOnMethods: [\"GET\", \"DELETE\"],\n};\n\n/** Parse Retry-After header as integer seconds. Returns 1 on invalid/missing. */\nfunction parseRetryAfterHeader(header: string | null): number {\n if (!header) return 1;\n const seconds = Number.parseInt(header, 10);\n if (Number.isNaN(seconds) || seconds < 0) return 1;\n return seconds;\n}\n\nfunction createDefaultLogger(): Logger {\n return {\n debug(message: string, ...args: unknown[]) {\n console.debug(message, ...args);\n },\n };\n}\n\nfunction redactHeaders(headers: Record<string, string>): Record<string, string> {\n const result = { ...headers };\n if (result.Authorization) {\n result.Authorization = \"Bearer ***\";\n }\n return result;\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly fetchFn: typeof globalThis.fetch;\n private defaultHeaders: Record<string, string>;\n #apiKey: string;\n #tenantId: string | undefined;\n #retryConfig: RetryConfig;\n #timeout: number;\n #debug: boolean;\n #logger: Logger;\n\n constructor(options: HttpClientOptions) {\n this.baseUrl = options.baseUrl;\n this.fetchFn = options.fetch ?? globalThis.fetch;\n this.defaultHeaders = { ...options.defaultHeaders };\n this.#apiKey = options.apiKey;\n this.#tenantId = options.tenantId;\n this.#retryConfig = {\n ...DEFAULT_RETRY_CONFIG,\n ...options.retryConfig,\n };\n this.#timeout = options.timeout ?? 30_000;\n this.#debug = options.debug ?? false;\n this.#logger = options.logger ?? createDefaultLogger();\n }\n\n async request<T>(method: HttpMethod, path: string, options?: RequestOptions): Promise<T> {\n if (!this.#apiKey) {\n throw new Error(\"BookingSDK: apiKey is required but was not provided\");\n }\n\n const url = this.buildUrl(path, options?.query);\n const headers = this.buildHeaders(options?.headers);\n\n if (options?.body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n // Auth headers applied last — always override per-request headers\n headers.Authorization = `Bearer ${this.#apiKey}`;\n if (this.#tenantId) {\n headers[\"X-Tenant-ID\"] = this.#tenantId;\n }\n\n const init: RequestInit = {\n method,\n headers,\n };\n\n if (options?.body !== undefined) {\n init.body = JSON.stringify(options.body);\n }\n\n // Merge global retry config with per-request overrides\n const effectiveRetry = {\n maxRetries: options?.retry?.maxRetries ?? this.#retryConfig.maxRetries,\n baseDelay: options?.retry?.baseDelay ?? this.#retryConfig.baseDelay,\n retryOnMethods: this.#retryConfig.retryOnMethods,\n force: options?.retry?.force ?? false,\n maxRetryAfter: this.#retryConfig.maxRetryAfter ?? 60,\n };\n\n if (this.#debug) {\n this.#logger.debug(`[BookingSDK] --> ${method} ${url}`, {\n headers: redactHeaders(headers),\n ...(options?.body ? { body: JSON.stringify(options.body).slice(0, 200) } : {}),\n });\n }\n\n const timeoutMs = options?.timeout ?? this.#timeout;\n const startTime = Date.now();\n let lastError: unknown;\n let wasRateLimited = false;\n\n for (let attempt = 0; attempt <= effectiveRetry.maxRetries; attempt++) {\n // Exponential backoff before retry (skip after 429 — already slept for Retry-After)\n if (attempt > 0 && !wasRateLimited) {\n await this.sleep(this.calculateDelay(attempt - 1, effectiveRetry.baseDelay));\n }\n wasRateLimited = false;\n\n // Fresh AbortController per attempt for timeout\n let timedOut = false;\n const controller = new AbortController();\n const timer: ReturnType<typeof setTimeout> = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeoutMs);\n\n // Propagate user-initiated abort to timeout controller\n if (options?.signal) {\n if (options.signal.aborted) {\n clearTimeout(timer);\n controller.abort();\n } else {\n options.signal.addEventListener(\"abort\", () => controller.abort(), { once: true });\n }\n }\n\n try {\n const response = await this.fetchFn(url, {\n ...init,\n signal: controller.signal,\n });\n\n if (this.#debug) {\n const elapsed = Date.now() - startTime;\n this.#logger.debug(`[BookingSDK] <-- ${response.status} (${elapsed}ms)`);\n }\n\n if (!response.ok) {\n // 429 Rate Limit — wait Retry-After and retry\n if (response.status === 429 && this.shouldRetry(method, effectiveRetry, attempt)) {\n const retryAfterHeader = response.headers.get(\"Retry-After\");\n const retryAfterSeconds = parseRetryAfterHeader(retryAfterHeader);\n const cappedSeconds = Math.min(retryAfterSeconds, effectiveRetry.maxRetryAfter);\n if (this.#debug) {\n this.#logger.debug(\n `[BookingSDK] retry attempt ${attempt + 1}/${effectiveRetry.maxRetries} in ${cappedSeconds * 1000}ms (reason: 429 Rate Limited)`,\n );\n }\n await this.sleep(cappedSeconds * 1000);\n wasRateLimited = true;\n lastError = response;\n continue;\n }\n\n // 5xx Server Error — retry with exponential backoff\n if (\n RETRYABLE_STATUSES.has(response.status) &&\n this.shouldRetry(method, effectiveRetry, attempt)\n ) {\n if (this.#debug) {\n const delay = this.calculateDelay(attempt, effectiveRetry.baseDelay);\n this.#logger.debug(\n `[BookingSDK] retry attempt ${attempt + 1}/${effectiveRetry.maxRetries} in ${delay}ms (reason: ${response.status})`,\n );\n }\n lastError = response;\n continue;\n }\n\n // Non-retryable error — throw immediately\n const body = await response.json().catch(() => ({}));\n const retryAfterHeader = response.headers.get(\"Retry-After\");\n throw createErrorFromResponse(response, body, retryAfterHeader);\n }\n\n if (this.#debug) {\n const text = await response\n .clone()\n .text()\n .catch(() => \"\");\n if (text) {\n this.#logger.debug(`[BookingSDK] body preview: ${text.slice(0, 500)}`);\n }\n }\n\n return response.json() as Promise<T>;\n } catch (error) {\n // Abort: timeout or user-initiated\n if (error instanceof Error && error.name === \"AbortError\") {\n if (timedOut) {\n throw new TimeoutError(`Request timed out after ${timeoutMs}ms`);\n }\n throw error;\n }\n\n // Already a typed BookingError — don't retry\n if (!(error instanceof TypeError)) {\n throw error;\n }\n\n // Network error (TypeError from fetch) — retry if eligible\n if (!this.shouldRetry(method, effectiveRetry, attempt)) {\n throw error;\n }\n\n lastError = error;\n } finally {\n clearTimeout(timer);\n }\n }\n\n // Exhausted all retries\n if (lastError instanceof Response) {\n const body = await (lastError as Response).json().catch(() => ({}));\n const retryAfterHeader = (lastError as Response).headers.get(\"Retry-After\");\n throw createErrorFromResponse(lastError as Response, body, retryAfterHeader);\n }\n\n throw lastError;\n }\n\n async get<T>(path: string, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"GET\", path, options);\n }\n\n async post<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"POST\", path, options);\n }\n\n async put<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"PUT\", path, options);\n }\n\n async patch<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"PATCH\", path, options);\n }\n\n async delete<T>(path: string, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"DELETE\", path, options);\n }\n\n setApiKey(key: string): void {\n this.#apiKey = key;\n }\n\n setTenantId(id: string | undefined): void {\n this.#tenantId = id;\n }\n\n setDefaultHeader(key: string, value: string): void {\n this.defaultHeaders[key] = value;\n }\n\n removeDefaultHeader(key: string): void {\n delete this.defaultHeaders[key];\n }\n\n private shouldRetry(\n method: HttpMethod,\n config: { retryOnMethods: HttpMethod[]; force: boolean; maxRetries: number },\n attempt: number,\n ): boolean {\n if (attempt >= config.maxRetries) return false;\n if (config.force) return true;\n return config.retryOnMethods.includes(method);\n }\n\n private calculateDelay(attempt: number, baseDelay: number): number {\n return baseDelay * 2 ** attempt + Math.floor(Math.random() * 100);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private buildUrl(path: string, query?: RequestOptions[\"query\"]): string {\n const cleanPath = path.startsWith(\"/\") ? path.slice(1) : path;\n let url = `${this.baseUrl}/${cleanPath}`;\n\n if (query) {\n const params = new URLSearchParams();\n\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n params.append(key, item);\n }\n } else {\n params.set(key, String(value));\n }\n }\n\n const qs = params.toString();\n if (qs) {\n url = `${url}?${qs}`;\n }\n }\n\n return url;\n }\n\n private buildHeaders(perRequestHeaders?: Record<string, string>): Record<string, string> {\n return {\n Accept: \"application/json\",\n ...this.defaultHeaders,\n ...perRequestHeaders,\n };\n }\n}\n","// BaseService — abstract base for all SDK service classes (internal)\n\nimport type { HttpClient } from \"../http.js\";\nimport type { Paginated } from \"../types/pagination.js\";\n\n/**\n * Abstract base class for all SDK services.\n * Provides typed HTTP helper methods and path construction.\n * Not exported from the public API.\n */\nexport abstract class BaseService {\n protected readonly http: HttpClient;\n protected abstract readonly basePath: string;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** Build a full path from the base path and additional segments */\n protected _buildPath(...segments: string[]): string {\n if (segments.length === 0) return this.basePath;\n return `${this.basePath}/${segments.join(\"/\")}`;\n }\n\n /** GET request returning typed response */\n protected _get<T>(\n path: string,\n query?: Record<string, string | number | boolean | null | undefined>,\n ): Promise<T> {\n return this.http.get<T>(path, { query });\n }\n\n /** POST request with body, returning typed response */\n protected _post<T>(path: string, body: unknown): Promise<T> {\n return this.http.post<T>(path, { body });\n }\n\n /** PATCH request with body, returning typed response */\n protected _patch<T>(path: string, body: unknown): Promise<T> {\n return this.http.patch<T>(path, { body });\n }\n\n /** DELETE request, returning void */\n protected _delete(path: string): Promise<void> {\n return this.http.delete(path) as Promise<void>;\n }\n\n /** GET list request with optional query params, returning paginated response */\n // biome-ignore lint/suspicious/noExplicitAny: params are typed at service level, cast needed for HttpClient\n protected _list<T>(params?: any): Promise<Paginated<T>> {\n return this.http.get<Paginated<T>>(this.basePath, { query: params });\n }\n}\n","// CategoriesService — CRUD operations for /inventory/v1/categories\n\nimport type { Paginated } from \"../types/pagination.js\";\nimport type {\n CreateCategoryInput,\n ListCategoriesParams,\n SpaceCategory,\n UpdateCategoryInput,\n} from \"../types/properties.js\";\nimport { BaseService } from \"./base.js\";\n\n/**\n * Service for managing space categories (room types) in the Atzentis Booking API.\n *\n * Categories are property-scoped — `propertyId` is required for create and list operations.\n *\n * @example\n * ```typescript\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n *\n * // List categories for a property\n * const { data } = await booking.categories.list({ propertyId: \"prop_abc123\" });\n *\n * // Create a new category\n * const category = await booking.categories.create({\n * propertyId: \"prop_abc123\",\n * name: \"Deluxe Suite\",\n * code: \"DLX\",\n * maxOccupancy: 3,\n * basePrice: 25000, // €250.00 in cents\n * });\n * ```\n */\nexport class CategoriesService extends BaseService {\n protected readonly basePath = \"/inventory/v1/categories\";\n\n /**\n * Create a new space category.\n *\n * @example\n * ```typescript\n * const category = await booking.categories.create({\n * propertyId: \"prop_abc123\",\n * name: \"Standard Room\",\n * code: \"STD\",\n * maxOccupancy: 2,\n * basePrice: 12000, // €120.00 in cents\n * });\n * ```\n */\n create(input: CreateCategoryInput): Promise<SpaceCategory> {\n return this._post<SpaceCategory>(this.basePath, input);\n }\n\n /**\n * List categories for a property with cursor-based pagination.\n *\n * @param params - Must include `propertyId`\n *\n * @example\n * ```typescript\n * const page = await booking.categories.list({\n * propertyId: \"prop_abc123\",\n * limit: 50,\n * });\n * ```\n */\n list(params: ListCategoriesParams): Promise<Paginated<SpaceCategory>> {\n return this._list<SpaceCategory>(params);\n }\n\n /**\n * Update an existing space category.\n *\n * @example\n * ```typescript\n * const updated = await booking.categories.update(\"cat_xyz789\", {\n * basePrice: 15000, // Updated to €150.00\n * });\n * ```\n */\n update(categoryId: string, input: UpdateCategoryInput): Promise<SpaceCategory> {\n return this._patch<SpaceCategory>(this._buildPath(categoryId), input);\n }\n\n /**\n * Delete a space category.\n *\n * @example\n * ```typescript\n * await booking.categories.delete(\"cat_xyz789\");\n * ```\n */\n delete(categoryId: string): Promise<void> {\n return this._delete(this._buildPath(categoryId));\n }\n}\n","// PropertiesService — CRUD operations for /inventory/v1/properties\n\nimport type { Paginated } from \"../types/pagination.js\";\nimport type {\n CreatePropertyInput,\n ListPropertiesParams,\n Property,\n UpdatePropertyInput,\n} from \"../types/properties.js\";\nimport { BaseService } from \"./base.js\";\n\n/**\n * Service for managing properties in the Atzentis Booking API.\n *\n * @example\n * ```typescript\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n *\n * // List all active properties\n * const { data, hasMore } = await booking.properties.list({ status: \"active\" });\n *\n * // Create a new property\n * const property = await booking.properties.create({\n * name: \"Seaside Villa\",\n * type: \"villa\",\n * currency: \"EUR\",\n * timezone: \"Europe/Athens\",\n * address: { street: \"123 Coast Rd\", city: \"Chania\", country: \"GR\" },\n * });\n * ```\n */\nexport class PropertiesService extends BaseService {\n protected readonly basePath = \"/inventory/v1/properties\";\n\n /**\n * Create a new property.\n *\n * @example\n * ```typescript\n * const property = await booking.properties.create({\n * name: \"Hotel Athena\",\n * type: \"hotel\",\n * currency: \"EUR\",\n * timezone: \"Europe/Athens\",\n * address: { street: \"1 Plaka St\", city: \"Athens\", country: \"GR\" },\n * });\n * ```\n */\n create(input: CreatePropertyInput): Promise<Property> {\n return this._post<Property>(this.basePath, input);\n }\n\n /**\n * List properties with optional filters and cursor-based pagination.\n *\n * @example\n * ```typescript\n * const page = await booking.properties.list({ type: \"hotel\", limit: 20 });\n * console.log(page.data); // Property[]\n * console.log(page.hasMore); // boolean\n * ```\n */\n list(params?: ListPropertiesParams): Promise<Paginated<Property>> {\n return this._list<Property>(params);\n }\n\n /**\n * Get a single property by ID.\n *\n * @example\n * ```typescript\n * const property = await booking.properties.get(\"prop_abc123\");\n * ```\n */\n get(propertyId: string): Promise<Property> {\n return this._get<Property>(this._buildPath(propertyId));\n }\n\n /**\n * Update an existing property.\n *\n * @example\n * ```typescript\n * const updated = await booking.properties.update(\"prop_abc123\", {\n * name: \"Hotel Athena Deluxe\",\n * });\n * ```\n */\n update(propertyId: string, input: UpdatePropertyInput): Promise<Property> {\n return this._patch<Property>(this._buildPath(propertyId), input);\n }\n\n /**\n * Delete a property.\n *\n * @example\n * ```typescript\n * await booking.properties.delete(\"prop_abc123\");\n * ```\n */\n delete(propertyId: string): Promise<void> {\n return this._delete(this._buildPath(propertyId));\n }\n}\n","// SpacesService — CRUD, bulk operations, and POS linking for /inventory/v1/spaces\n\nimport type { Paginated } from \"../types/pagination.js\";\nimport type {\n BulkUpdateSpaceInput,\n CreateSpaceInput,\n LinkPosTableInput,\n ListSpacesParams,\n Space,\n UpdateSpaceInput,\n} from \"../types/spaces.js\";\nimport { BaseService } from \"./base.js\";\n\n/**\n * Service for managing bookable spaces in the Atzentis Booking API.\n *\n * Spaces are the universal bookable inventory unit across all three verticals\n * (Stays, Tables, Services). The `type` field determines which vertical a\n * space belongs to and what vertical-specific fields apply.\n *\n * @example\n * ```typescript\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n *\n * // List all rooms for a property\n * const { data } = await booking.spaces.list({\n * propertyId: \"prop_abc123\",\n * type: \"room\",\n * });\n *\n * // Create a new table space\n * const space = await booking.spaces.create({\n * propertyId: \"prop_abc123\",\n * name: \"Table 1\",\n * type: \"table\",\n * capacity: 4,\n * });\n * ```\n */\nexport class SpacesService extends BaseService {\n protected readonly basePath = \"/inventory/v1/spaces\";\n\n /**\n * Create a new space.\n *\n * @example\n * ```typescript\n * const space = await booking.spaces.create({\n * propertyId: \"prop_abc123\",\n * name: \"Room 101\",\n * type: \"room\",\n * floor: \"1\",\n * capacity: 2,\n * });\n * ```\n */\n create(input: CreateSpaceInput): Promise<Space> {\n return this._post<Space>(this.basePath, input);\n }\n\n /**\n * List spaces for a property with optional filters and cursor-based pagination.\n *\n * @param params - Must include `propertyId`; supports optional `type`, `status`, `categoryId`, `floor` filters\n *\n * @example\n * ```typescript\n * const page = await booking.spaces.list({\n * propertyId: \"prop_abc123\",\n * type: \"room\",\n * status: \"available\",\n * limit: 20,\n * });\n * ```\n */\n list(params: ListSpacesParams): Promise<Paginated<Space>> {\n return this._list<Space>(params);\n }\n\n /**\n * Get a single space by ID.\n *\n * @example\n * ```typescript\n * const space = await booking.spaces.get(\"spc_abc123\");\n * ```\n */\n get(spaceId: string): Promise<Space> {\n return this._get<Space>(this._buildPath(spaceId));\n }\n\n /**\n * Update an existing space.\n *\n * @example\n * ```typescript\n * const updated = await booking.spaces.update(\"spc_abc123\", {\n * name: \"Room 101 Deluxe\",\n * capacity: 3,\n * });\n * ```\n */\n update(spaceId: string, input: UpdateSpaceInput): Promise<Space> {\n return this._patch<Space>(this._buildPath(spaceId), input);\n }\n\n /**\n * Delete a space.\n *\n * @example\n * ```typescript\n * await booking.spaces.delete(\"spc_abc123\");\n * ```\n */\n delete(spaceId: string): Promise<void> {\n return this._delete(this._buildPath(spaceId));\n }\n\n /**\n * Bulk create multiple spaces for a property in a single API call.\n *\n * @example\n * ```typescript\n * const spaces = await booking.spaces.bulkCreate(\"prop_abc123\", [\n * { propertyId: \"prop_abc123\", name: \"Room 101\", type: \"room\" },\n * { propertyId: \"prop_abc123\", name: \"Room 102\", type: \"room\" },\n * ]);\n * ```\n */\n bulkCreate(propertyId: string, spaces: CreateSpaceInput[]): Promise<Space[]> {\n return this._post<Space[]>(this._buildPath(\"bulk\"), {\n propertyId,\n spaces,\n });\n }\n\n /**\n * Bulk update multiple spaces for a property in a single API call.\n *\n * @example\n * ```typescript\n * const updated = await booking.spaces.bulkUpdate(\"prop_abc123\", [\n * { id: \"spc_1\", name: \"Room 101 Deluxe\" },\n * { id: \"spc_2\", capacity: 3 },\n * ]);\n * ```\n */\n bulkUpdate(propertyId: string, updates: BulkUpdateSpaceInput[]): Promise<Space[]> {\n return this._patch<Space[]>(this._buildPath(\"bulk\"), {\n propertyId,\n updates,\n });\n }\n\n /**\n * Link a space to a POS table. Tables vertical only.\n *\n * Creates a cross-domain bridge between the inventory service and the POS system,\n * enabling a space to reference its physical POS table.\n *\n * @example\n * ```typescript\n * const linked = await booking.spaces.linkPosTable(\"spc_abc123\", {\n * posTableId: \"pos_table_42\",\n * });\n * ```\n */\n linkPosTable(spaceId: string, input: LinkPosTableInput): Promise<Space> {\n return this._post<Space>(this._buildPath(spaceId, \"pos-table\"), input);\n }\n}\n","// BookingClient — primary public entry point for @atzentis/booking-sdk\n\nimport { type BookingClientConfig, bookingClientConfigSchema } from \"./config.js\";\nimport { HttpClient } from \"./http.js\";\nimport { CategoriesService } from \"./services/categories.js\";\nimport { PropertiesService } from \"./services/properties.js\";\nimport { SpacesService } from \"./services/spaces.js\";\n\n/**\n * Main SDK client for the Atzentis Booking API.\n *\n * @example\n * ```typescript\n * import { BookingClient } from \"@atzentis/booking-sdk\";\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n * ```\n */\nexport class BookingClient {\n readonly httpClient: HttpClient;\n private _properties?: PropertiesService;\n private _categories?: CategoriesService;\n private _spaces?: SpacesService;\n\n constructor(config: BookingClientConfig) {\n const validated = bookingClientConfigSchema.parse(config);\n\n this.httpClient = new HttpClient({\n baseUrl: validated.baseUrl,\n apiKey: validated.apiKey,\n tenantId: validated.tenantId,\n timeout: validated.timeout,\n retryConfig: validated.retry\n ? {\n maxRetries: validated.retry.maxRetries,\n baseDelay: validated.retry.baseDelay,\n }\n : undefined,\n debug: validated.debug,\n logger: validated.logger,\n });\n }\n\n /** Properties service — lazy-initialized on first access */\n get properties(): PropertiesService {\n this._properties ??= new PropertiesService(this.httpClient);\n return this._properties;\n }\n\n /** Categories service — lazy-initialized on first access */\n get categories(): CategoriesService {\n this._categories ??= new CategoriesService(this.httpClient);\n return this._categories;\n }\n\n /** Spaces service — lazy-initialized on first access */\n get spaces(): SpacesService {\n this._spaces ??= new SpacesService(this.httpClient);\n return this._spaces;\n }\n\n setApiKey(key: string): void {\n if (!key || key.trim().length === 0) {\n throw new Error(\"apiKey must be a non-empty string\");\n }\n this.httpClient.setApiKey(key);\n }\n\n setTenantId(id: string): void {\n if (!id || id.trim().length === 0) {\n throw new Error(\"tenantId must be a non-empty string\");\n }\n this.httpClient.setTenantId(id);\n }\n}\n","// Cursor-based pagination helpers for @atzentis/booking-sdk\n\nimport type { PageFetcher, Paginated, PaginationOptions } from \"./types/pagination.js\";\n\n/**\n * Returns an AsyncIterable that yields each page's data array in order.\n * Iteration stops automatically when hasMore is false or cursor is null.\n *\n * @example\n * for await (const page of paginate(fetcher, { limit: 50 })) {\n * for (const item of page) {\n * process(item);\n * }\n * }\n */\nexport function paginate<T>(\n fetcher: PageFetcher<T>,\n options?: PaginationOptions,\n): AsyncIterable<T[]> {\n return {\n [Symbol.asyncIterator](): AsyncIterator<T[]> {\n let cursor: string | undefined = options?.cursor;\n let done = false;\n\n return {\n async next(): Promise<IteratorResult<T[]>> {\n if (done) return { value: undefined as unknown as T[], done: true };\n\n const result = await fetcher({ ...(options ?? {}), cursor });\n\n if (!result.hasMore || result.cursor === null) {\n done = true;\n } else {\n cursor = result.cursor;\n }\n\n return { value: result.data, done: false };\n },\n };\n },\n };\n}\n\n/**\n * Fetches only the first page and returns the full Paginated<T> result.\n * Useful when callers only need one page and don't want to use for-await.\n *\n * @example\n * const result = await firstPage(fetcher, { limit: 10 });\n * console.log(result.data, result.hasMore);\n */\nexport async function firstPage<T>(\n fetcher: PageFetcher<T>,\n options?: PaginationOptions,\n): Promise<Paginated<T>> {\n return fetcher({ ...(options ?? {}) });\n}\n","// Property and Category types for @atzentis/booking-sdk\n\n/** All supported property types in the v4.0 API */\nexport type PropertyType =\n | \"hotel\"\n | \"resort\"\n | \"villa\"\n | \"apartment\"\n | \"hostel\"\n | \"bnb\"\n | \"restaurant\"\n | \"cafe\"\n | \"bar\"\n | \"beach\"\n | \"spa\"\n | \"salon\"\n | \"custom\";\n\n/** Property lifecycle status */\nexport type PropertyStatus = \"active\" | \"inactive\" | \"setup\" | \"suspended\";\n\n/** Geographic coordinates */\nexport interface Coordinates {\n lat: number;\n lng: number;\n}\n\n/** Physical address of a property */\nexport interface PropertyAddress {\n street: string;\n city: string;\n country: string;\n state?: string;\n postalCode?: string;\n coordinates?: Coordinates;\n}\n\n/**\n * Feature modules that can be enabled per property.\n *\n * Each flag controls access to a v4.0 API service group:\n * - `booking` — Reservation and availability management\n * - `concierge` — Guest request and service management\n * - `intelligence` — Analytics and reporting\n * - `revenue` — Dynamic pricing and yield management\n * - `housekeeping` — Room cleaning and maintenance scheduling\n * - `nightAudit` — End-of-day accounting reconciliation\n * - `distribution` — Channel manager and OTA connectivity\n * - `fiscal` — Tax compliance and fiscal reporting\n * - `pos` — Point of sale bridge integration\n */\nexport interface PropertyModules {\n booking?: boolean;\n concierge?: boolean;\n intelligence?: boolean;\n revenue?: boolean;\n housekeeping?: boolean;\n nightAudit?: boolean;\n distribution?: boolean;\n fiscal?: boolean;\n pos?: boolean;\n}\n\n/** All 9 module names as a readonly tuple */\nexport const PROPERTY_MODULES = [\n \"booking\",\n \"concierge\",\n \"intelligence\",\n \"revenue\",\n \"housekeeping\",\n \"nightAudit\",\n \"distribution\",\n \"fiscal\",\n \"pos\",\n] as const;\n\n/** Default modules configuration with all modules disabled */\nexport const DEFAULT_MODULES: PropertyModules = {\n booking: false,\n concierge: false,\n intelligence: false,\n revenue: false,\n housekeeping: false,\n nightAudit: false,\n distribution: false,\n fiscal: false,\n pos: false,\n};\n\n/** A property in the Atzentis Booking system */\nexport interface Property {\n id: string;\n name: string;\n type: PropertyType;\n status: PropertyStatus;\n currency: string;\n timezone: string;\n address: PropertyAddress;\n modules: PropertyModules;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Input for creating a new property */\nexport interface CreatePropertyInput {\n name: string;\n type: PropertyType;\n currency: string;\n timezone: string;\n address: PropertyAddress;\n modules?: PropertyModules;\n}\n\n/** Input for updating an existing property — all fields optional */\nexport type UpdatePropertyInput = Partial<CreatePropertyInput>;\n\n/** Query parameters for listing properties */\nexport interface ListPropertiesParams {\n type?: PropertyType;\n status?: PropertyStatus;\n cursor?: string;\n limit?: number;\n}\n\n/** A space category (room type) belonging to a property */\nexport interface SpaceCategory {\n id: string;\n propertyId: string;\n name: string;\n code: string;\n maxOccupancy: number;\n /** Base price in integer cents */\n basePrice: number;\n description?: string;\n sortOrder?: number;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Input for creating a new space category */\nexport interface CreateCategoryInput {\n propertyId: string;\n name: string;\n code: string;\n maxOccupancy: number;\n /** Base price in integer cents */\n basePrice: number;\n description?: string;\n sortOrder?: number;\n}\n\n/** Input for updating a space category — cannot change propertyId */\nexport type UpdateCategoryInput = Partial<Omit<CreateCategoryInput, \"propertyId\">>;\n\n/** Query parameters for listing categories — propertyId is required */\nexport interface ListCategoriesParams {\n propertyId: string;\n cursor?: string;\n limit?: number;\n}\n","// Space types for @atzentis/booking-sdk\n\n/**\n * All supported space types in the v4.0 API.\n *\n * Grouped by vertical:\n * - **Stays:** `room`, `sunbed`, `parking`\n * - **Tables:** `table`, `locker`\n * - **Services:** `service`, `meeting_room`, `desk`\n * - **Universal:** `custom`\n */\nexport type SpaceType =\n | \"room\"\n | \"table\"\n | \"sunbed\"\n | \"parking\"\n | \"desk\"\n | \"meeting_room\"\n | \"locker\"\n | \"service\"\n | \"custom\";\n\n/** All 9 space types as a readonly tuple for runtime enumeration */\nexport const SPACE_TYPES = [\n \"room\",\n \"table\",\n \"sunbed\",\n \"parking\",\n \"desk\",\n \"meeting_room\",\n \"locker\",\n \"service\",\n \"custom\",\n] as const;\n\n/** Space availability/lifecycle status */\nexport type SpaceStatus = \"available\" | \"occupied\" | \"maintenance\" | \"blocked\" | \"inactive\";\n\n/** All 5 space statuses as a readonly tuple for runtime enumeration */\nexport const SPACE_STATUSES = [\n \"available\",\n \"occupied\",\n \"maintenance\",\n \"blocked\",\n \"inactive\",\n] as const;\n\n/** A bookable space in the Atzentis Booking system */\nexport interface Space {\n id: string;\n propertyId: string;\n categoryId: string | null;\n name: string;\n type: SpaceType;\n status: SpaceStatus;\n /** Used for rooms (hotel floor) and desks/meeting rooms (office floor). Use string to support labels like \"B1\", \"G\", \"1\", \"2\". */\n floor: string | null;\n /** Used for tables (cover count) and meeting rooms (person count). Null if not applicable. */\n capacity: number | null;\n /** POS table reference; set via `linkPosTable()`. Tables vertical only. Null until linked. */\n posTableId: string | null;\n /** Open bag for vertical-specific extras not covered by standard fields. Schema is consumer-defined. */\n metadata: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Input for creating a new space */\nexport interface CreateSpaceInput {\n propertyId: string;\n name: string;\n type: SpaceType;\n categoryId?: string;\n /** Optional. See `Space.floor` for usage by vertical. */\n floor?: string;\n /** Optional. See `Space.capacity` for usage by vertical. */\n capacity?: number;\n /** Optional. See `Space.metadata` for usage by vertical. */\n metadata?: Record<string, unknown>;\n}\n\n/** Input for updating an existing space — all fields optional */\nexport type UpdateSpaceInput = Partial<Omit<CreateSpaceInput, \"propertyId\">>;\n\n/** Input for bulk updating spaces — requires `id` to identify each space */\nexport type BulkUpdateSpaceInput = UpdateSpaceInput & { id: string };\n\n/** Input for linking a space to a POS table */\nexport interface LinkPosTableInput {\n posTableId: string;\n}\n\n/** Query parameters for listing spaces — propertyId is required */\nexport interface ListSpacesParams {\n propertyId: string;\n type?: SpaceType;\n status?: SpaceStatus;\n categoryId?: string;\n floor?: number | string;\n limit?: number;\n cursor?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,KAAK;AACP;;;AChEO,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAMO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;AX5CO,IAAM,UAAU;","names":["retryAfterHeader"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/errors.ts","../src/http.ts","../src/services/base.ts","../src/services/availability.ts","../src/services/categories.ts","../src/services/properties.ts","../src/services/spaces.ts","../src/client.ts","../src/pagination.ts","../src/types/properties.ts","../src/types/spaces.ts"],"sourcesContent":["// @atzentis/booking-sdk\nexport const VERSION = \"0.1.0\";\n\nexport { BookingClient } from \"./client.js\";\nexport { bookingClientConfigSchema } from \"./config.js\";\nexport type {\n BookingClientConfig,\n ResolvedBookingClientConfig,\n} from \"./config.js\";\n\nexport { HttpClient } from \"./http.js\";\n\nexport {\n AuthenticationError,\n BookingError,\n ConflictError,\n createErrorFromResponse,\n ForbiddenError,\n NotFoundError,\n PaymentError,\n RateLimitError,\n ServerError,\n TimeoutError,\n ValidationError,\n} from \"./errors.js\";\nexport type { BookingErrorOptions } from \"./errors.js\";\n\nexport { firstPage, paginate } from \"./pagination.js\";\n\n// Services\nexport {\n AvailabilityService,\n CategoriesService,\n PropertiesService,\n SpacesService,\n} from \"./services/index.js\";\n\n// Types — re-export everything from types barrel\nexport type {\n AvailabilityCheckParams,\n AvailabilityPricing,\n AvailabilityRestrictions,\n AvailabilityResult,\n AvailabilitySearchParams,\n AvailabilitySearchResult,\n AvailabilitySearchResultEntry,\n AvailableSpace,\n BulkUpdateSpaceInput,\n CalendarDay,\n CalendarParams,\n Coordinates,\n CreateCategoryInput,\n CreatePropertyInput,\n CreateSpaceInput,\n HttpClientOptions,\n HttpMethod,\n HttpResponse,\n LinkPosTableInput,\n ListCategoriesParams,\n ListPropertiesParams,\n ListSpacesParams,\n Logger,\n PageFetcher,\n Paginated,\n PaginationOptions,\n PriceRange,\n PricingParams,\n PricingResult,\n Property,\n PropertyAddress,\n PropertyModules,\n PropertyStatus,\n PropertyType,\n RequestOptions,\n RetryConfig,\n RetryOptions,\n ServiceSlotParams,\n ServiceTimeSlot,\n Space,\n SpaceCategory,\n SpaceStatus,\n SpaceType,\n TableSlotParams,\n TimeSlot,\n UpdateCategoryInput,\n UpdatePropertyInput,\n UpdateSpaceInput,\n} from \"./types/index.js\";\nexport {\n DEFAULT_MODULES,\n PROPERTY_MODULES,\n SPACE_STATUSES,\n SPACE_TYPES,\n} from \"./types/index.js\";\n","// Configuration schema for @atzentis/booking-sdk\n\nimport { z } from \"zod\";\n\nexport const bookingClientConfigSchema = z.object({\n apiKey: z.string().min(1, \"apiKey is required\"),\n baseUrl: z.string().url().default(\"https://api.atzentis.io\"),\n tenantId: z.string().min(1).optional(),\n timeout: z.number().int().positive().default(30_000),\n retry: z\n .object({\n maxRetries: z.number().int().min(0).max(10).default(3),\n baseDelay: z.number().int().positive().default(500),\n })\n .optional(),\n debug: z.boolean().default(false),\n logger: z\n .object({\n debug: z.custom<(message: string, ...args: unknown[]) => void>(\n (val) => typeof val === \"function\",\n ),\n })\n .optional(),\n});\n\n/** Input type for BookingClient constructor (optional fields truly optional) */\nexport type BookingClientConfig = z.input<typeof bookingClientConfigSchema>;\n\n/** Resolved config type after Zod defaults are applied */\nexport type ResolvedBookingClientConfig = z.output<typeof bookingClientConfigSchema>;\n","// Error class hierarchy for @atzentis/booking-sdk\n\n/** Options for constructing a BookingError */\nexport interface BookingErrorOptions {\n code: string;\n status?: number;\n details?: Record<string, unknown>;\n}\n\n/** Base error class for all SDK errors */\nexport class BookingError extends Error {\n readonly code: string;\n readonly status: number | undefined;\n readonly details: Record<string, unknown>;\n\n constructor(message: string, options: BookingErrorOptions) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"BookingError\";\n this.code = options.code;\n this.status = options.status;\n this.details = options.details ?? {};\n }\n}\n\n/** HTTP 401 — invalid or missing API key */\nexport class AuthenticationError extends BookingError {\n constructor(\n message = \"Authentication failed: invalid or missing API key\",\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"AUTHENTICATION_ERROR\", status: 401, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"AuthenticationError\";\n }\n}\n\n/** HTTP 402 — payment required or payment failed */\nexport class PaymentError extends BookingError {\n constructor(message = \"Payment required or payment failed\", details?: Record<string, unknown>) {\n super(message, { code: \"PAYMENT_ERROR\", status: 402, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"PaymentError\";\n }\n}\n\n/** HTTP 403 — insufficient permissions */\nexport class ForbiddenError extends BookingError {\n constructor(\n message = \"Insufficient permissions to perform this action\",\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"FORBIDDEN_ERROR\", status: 403, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ForbiddenError\";\n }\n}\n\n/** HTTP 404 — resource not found */\nexport class NotFoundError extends BookingError {\n constructor(message = \"The requested resource was not found\", details?: Record<string, unknown>) {\n super(message, { code: \"NOT_FOUND_ERROR\", status: 404, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"NotFoundError\";\n }\n}\n\n/** HTTP 409 — resource conflict */\nexport class ConflictError extends BookingError {\n constructor(\n message = \"Resource conflict — the booking may already exist\",\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"CONFLICT_ERROR\", status: 409, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ConflictError\";\n }\n}\n\n/** HTTP 422 — request validation failed with field-level errors */\nexport class ValidationError extends BookingError {\n readonly fieldErrors: Record<string, string[]>;\n\n constructor(\n message = \"Request validation failed\",\n fieldErrors: Record<string, string[]> = {},\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"VALIDATION_ERROR\", status: 422, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ValidationError\";\n this.fieldErrors = fieldErrors;\n }\n}\n\n/** HTTP 429 — rate limit exceeded */\nexport class RateLimitError extends BookingError {\n readonly retryAfter: number;\n\n constructor(message = \"Rate limit exceeded\", retryAfter = 60) {\n super(message, { code: \"RATE_LIMIT_ERROR\", status: 429 });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"RateLimitError\";\n this.retryAfter = retryAfter;\n }\n}\n\n/** HTTP 5xx — unexpected server error */\nexport class ServerError extends BookingError {\n constructor(\n message = \"An unexpected server error occurred\",\n status = 500,\n details?: Record<string, unknown>,\n ) {\n super(message, { code: \"SERVER_ERROR\", status, details });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ServerError\";\n }\n}\n\n/** Timeout error — request was aborted by AbortController */\nexport class TimeoutError extends BookingError {\n constructor(message = \"The request timed out\") {\n super(message, { code: \"TIMEOUT_ERROR\" });\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"TimeoutError\";\n }\n}\n\n// --- Factory helpers ---\n\nfunction parseRetryAfter(header: string | null | undefined): number {\n if (!header) return 60;\n\n const seconds = Number.parseInt(header, 10);\n if (Number.isFinite(seconds) && seconds > 0) return seconds;\n\n const date = new Date(header);\n if (!Number.isNaN(date.getTime())) {\n return Math.max(0, Math.round((date.getTime() - Date.now()) / 1000));\n }\n\n return 60;\n}\n\nfunction extractBody(body: unknown): Record<string, unknown> {\n if (typeof body === \"object\" && body !== null && !Array.isArray(body)) {\n return body as Record<string, unknown>;\n }\n return {};\n}\n\nfunction extractMessage(body: Record<string, unknown>, fallback: string): string {\n if (typeof body.message === \"string\" && body.message.length > 0) {\n return body.message;\n }\n return fallback;\n}\n\nfunction parseFieldErrors(errors: unknown): Record<string, string[]> {\n if (typeof errors !== \"object\" || errors === null || Array.isArray(errors)) {\n return {};\n }\n\n const result: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(errors as Record<string, unknown>)) {\n if (Array.isArray(value)) {\n result[key] = value.map(String);\n } else if (typeof value === \"string\") {\n result[key] = [value];\n }\n }\n return result;\n}\n\n/** Creates a typed BookingError from an HTTP response and parsed body */\nexport function createErrorFromResponse(\n response: Response,\n body: unknown,\n retryAfterHeader?: string | null,\n): BookingError {\n const bodyObj = extractBody(body);\n const status = response.status;\n\n switch (status) {\n case 401:\n return new AuthenticationError(\n extractMessage(bodyObj, \"Authentication failed: invalid or missing API key\"),\n bodyObj,\n );\n case 402:\n return new PaymentError(\n extractMessage(bodyObj, \"Payment required or payment failed\"),\n bodyObj,\n );\n case 403:\n return new ForbiddenError(\n extractMessage(bodyObj, \"Insufficient permissions to perform this action\"),\n bodyObj,\n );\n case 404:\n return new NotFoundError(\n extractMessage(bodyObj, \"The requested resource was not found\"),\n bodyObj,\n );\n case 409:\n return new ConflictError(extractMessage(bodyObj, \"Resource conflict\"), bodyObj);\n case 422:\n return new ValidationError(\n extractMessage(bodyObj, \"Request validation failed\"),\n parseFieldErrors(bodyObj.errors),\n bodyObj,\n );\n case 429:\n return new RateLimitError(\n extractMessage(bodyObj, \"Rate limit exceeded\"),\n parseRetryAfter(retryAfterHeader ?? null),\n );\n default:\n if (status >= 500) {\n return new ServerError(\n extractMessage(bodyObj, \"An unexpected server error occurred\"),\n status,\n bodyObj,\n );\n }\n return new BookingError(extractMessage(bodyObj, `HTTP ${status} error`), {\n code: \"HTTP_ERROR\",\n status,\n details: bodyObj,\n });\n }\n}\n","// Core HTTP client — wraps native fetch with typed methods\n\nimport { TimeoutError, createErrorFromResponse } from \"./errors.js\";\nimport type { Logger, RetryConfig } from \"./types/config.js\";\nimport type { HttpClientOptions, HttpMethod, RequestOptions } from \"./types/http.js\";\n\nconst RETRYABLE_STATUSES = new Set([500, 502, 503, 504]);\n\nconst DEFAULT_RETRY_CONFIG: RetryConfig = {\n maxRetries: 3,\n baseDelay: 500,\n retryOnMethods: [\"GET\", \"DELETE\"],\n};\n\n/** Parse Retry-After header as integer seconds. Returns 1 on invalid/missing. */\nfunction parseRetryAfterHeader(header: string | null): number {\n if (!header) return 1;\n const seconds = Number.parseInt(header, 10);\n if (Number.isNaN(seconds) || seconds < 0) return 1;\n return seconds;\n}\n\nfunction createDefaultLogger(): Logger {\n return {\n debug(message: string, ...args: unknown[]) {\n console.debug(message, ...args);\n },\n };\n}\n\nfunction redactHeaders(headers: Record<string, string>): Record<string, string> {\n const result = { ...headers };\n if (result.Authorization) {\n result.Authorization = \"Bearer ***\";\n }\n return result;\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly fetchFn: typeof globalThis.fetch;\n private defaultHeaders: Record<string, string>;\n #apiKey: string;\n #tenantId: string | undefined;\n #retryConfig: RetryConfig;\n #timeout: number;\n #debug: boolean;\n #logger: Logger;\n\n constructor(options: HttpClientOptions) {\n this.baseUrl = options.baseUrl;\n this.fetchFn = options.fetch ?? globalThis.fetch;\n this.defaultHeaders = { ...options.defaultHeaders };\n this.#apiKey = options.apiKey;\n this.#tenantId = options.tenantId;\n this.#retryConfig = {\n ...DEFAULT_RETRY_CONFIG,\n ...options.retryConfig,\n };\n this.#timeout = options.timeout ?? 30_000;\n this.#debug = options.debug ?? false;\n this.#logger = options.logger ?? createDefaultLogger();\n }\n\n async request<T>(method: HttpMethod, path: string, options?: RequestOptions): Promise<T> {\n if (!this.#apiKey) {\n throw new Error(\"BookingSDK: apiKey is required but was not provided\");\n }\n\n const url = this.buildUrl(path, options?.query);\n const headers = this.buildHeaders(options?.headers);\n\n if (options?.body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n // Auth headers applied last — always override per-request headers\n headers.Authorization = `Bearer ${this.#apiKey}`;\n if (this.#tenantId) {\n headers[\"X-Tenant-ID\"] = this.#tenantId;\n }\n\n const init: RequestInit = {\n method,\n headers,\n };\n\n if (options?.body !== undefined) {\n init.body = JSON.stringify(options.body);\n }\n\n // Merge global retry config with per-request overrides\n const effectiveRetry = {\n maxRetries: options?.retry?.maxRetries ?? this.#retryConfig.maxRetries,\n baseDelay: options?.retry?.baseDelay ?? this.#retryConfig.baseDelay,\n retryOnMethods: this.#retryConfig.retryOnMethods,\n force: options?.retry?.force ?? false,\n maxRetryAfter: this.#retryConfig.maxRetryAfter ?? 60,\n };\n\n if (this.#debug) {\n this.#logger.debug(`[BookingSDK] --> ${method} ${url}`, {\n headers: redactHeaders(headers),\n ...(options?.body ? { body: JSON.stringify(options.body).slice(0, 200) } : {}),\n });\n }\n\n const timeoutMs = options?.timeout ?? this.#timeout;\n const startTime = Date.now();\n let lastError: unknown;\n let wasRateLimited = false;\n\n for (let attempt = 0; attempt <= effectiveRetry.maxRetries; attempt++) {\n // Exponential backoff before retry (skip after 429 — already slept for Retry-After)\n if (attempt > 0 && !wasRateLimited) {\n await this.sleep(this.calculateDelay(attempt - 1, effectiveRetry.baseDelay));\n }\n wasRateLimited = false;\n\n // Fresh AbortController per attempt for timeout\n let timedOut = false;\n const controller = new AbortController();\n const timer: ReturnType<typeof setTimeout> = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeoutMs);\n\n // Propagate user-initiated abort to timeout controller\n if (options?.signal) {\n if (options.signal.aborted) {\n clearTimeout(timer);\n controller.abort();\n } else {\n options.signal.addEventListener(\"abort\", () => controller.abort(), { once: true });\n }\n }\n\n try {\n const response = await this.fetchFn(url, {\n ...init,\n signal: controller.signal,\n });\n\n if (this.#debug) {\n const elapsed = Date.now() - startTime;\n this.#logger.debug(`[BookingSDK] <-- ${response.status} (${elapsed}ms)`);\n }\n\n if (!response.ok) {\n // 429 Rate Limit — wait Retry-After and retry\n if (response.status === 429 && this.shouldRetry(method, effectiveRetry, attempt)) {\n const retryAfterHeader = response.headers.get(\"Retry-After\");\n const retryAfterSeconds = parseRetryAfterHeader(retryAfterHeader);\n const cappedSeconds = Math.min(retryAfterSeconds, effectiveRetry.maxRetryAfter);\n if (this.#debug) {\n this.#logger.debug(\n `[BookingSDK] retry attempt ${attempt + 1}/${effectiveRetry.maxRetries} in ${cappedSeconds * 1000}ms (reason: 429 Rate Limited)`,\n );\n }\n await this.sleep(cappedSeconds * 1000);\n wasRateLimited = true;\n lastError = response;\n continue;\n }\n\n // 5xx Server Error — retry with exponential backoff\n if (\n RETRYABLE_STATUSES.has(response.status) &&\n this.shouldRetry(method, effectiveRetry, attempt)\n ) {\n if (this.#debug) {\n const delay = this.calculateDelay(attempt, effectiveRetry.baseDelay);\n this.#logger.debug(\n `[BookingSDK] retry attempt ${attempt + 1}/${effectiveRetry.maxRetries} in ${delay}ms (reason: ${response.status})`,\n );\n }\n lastError = response;\n continue;\n }\n\n // Non-retryable error — throw immediately\n const body = await response.json().catch(() => ({}));\n const retryAfterHeader = response.headers.get(\"Retry-After\");\n throw createErrorFromResponse(response, body, retryAfterHeader);\n }\n\n if (this.#debug) {\n const text = await response\n .clone()\n .text()\n .catch(() => \"\");\n if (text) {\n this.#logger.debug(`[BookingSDK] body preview: ${text.slice(0, 500)}`);\n }\n }\n\n return response.json() as Promise<T>;\n } catch (error) {\n // Abort: timeout or user-initiated\n if (error instanceof Error && error.name === \"AbortError\") {\n if (timedOut) {\n throw new TimeoutError(`Request timed out after ${timeoutMs}ms`);\n }\n throw error;\n }\n\n // Already a typed BookingError — don't retry\n if (!(error instanceof TypeError)) {\n throw error;\n }\n\n // Network error (TypeError from fetch) — retry if eligible\n if (!this.shouldRetry(method, effectiveRetry, attempt)) {\n throw error;\n }\n\n lastError = error;\n } finally {\n clearTimeout(timer);\n }\n }\n\n // Exhausted all retries\n if (lastError instanceof Response) {\n const body = await (lastError as Response).json().catch(() => ({}));\n const retryAfterHeader = (lastError as Response).headers.get(\"Retry-After\");\n throw createErrorFromResponse(lastError as Response, body, retryAfterHeader);\n }\n\n throw lastError;\n }\n\n async get<T>(path: string, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"GET\", path, options);\n }\n\n async post<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"POST\", path, options);\n }\n\n async put<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"PUT\", path, options);\n }\n\n async patch<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"PATCH\", path, options);\n }\n\n async delete<T>(path: string, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"DELETE\", path, options);\n }\n\n setApiKey(key: string): void {\n this.#apiKey = key;\n }\n\n setTenantId(id: string | undefined): void {\n this.#tenantId = id;\n }\n\n setDefaultHeader(key: string, value: string): void {\n this.defaultHeaders[key] = value;\n }\n\n removeDefaultHeader(key: string): void {\n delete this.defaultHeaders[key];\n }\n\n private shouldRetry(\n method: HttpMethod,\n config: { retryOnMethods: HttpMethod[]; force: boolean; maxRetries: number },\n attempt: number,\n ): boolean {\n if (attempt >= config.maxRetries) return false;\n if (config.force) return true;\n return config.retryOnMethods.includes(method);\n }\n\n private calculateDelay(attempt: number, baseDelay: number): number {\n return baseDelay * 2 ** attempt + Math.floor(Math.random() * 100);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private buildUrl(path: string, query?: RequestOptions[\"query\"]): string {\n const cleanPath = path.startsWith(\"/\") ? path.slice(1) : path;\n let url = `${this.baseUrl}/${cleanPath}`;\n\n if (query) {\n const params = new URLSearchParams();\n\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n params.append(key, item);\n }\n } else {\n params.set(key, String(value));\n }\n }\n\n const qs = params.toString();\n if (qs) {\n url = `${url}?${qs}`;\n }\n }\n\n return url;\n }\n\n private buildHeaders(perRequestHeaders?: Record<string, string>): Record<string, string> {\n return {\n Accept: \"application/json\",\n ...this.defaultHeaders,\n ...perRequestHeaders,\n };\n }\n}\n","// BaseService — abstract base for all SDK service classes (internal)\n\nimport type { HttpClient } from \"../http.js\";\nimport type { Paginated } from \"../types/pagination.js\";\n\n/**\n * Abstract base class for all SDK services.\n * Provides typed HTTP helper methods and path construction.\n * Not exported from the public API.\n */\nexport abstract class BaseService {\n protected readonly http: HttpClient;\n protected abstract readonly basePath: string;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** Build a full path from the base path and additional segments */\n protected _buildPath(...segments: string[]): string {\n if (segments.length === 0) return this.basePath;\n return `${this.basePath}/${segments.join(\"/\")}`;\n }\n\n /** GET request returning typed response */\n protected _get<T>(\n path: string,\n query?: Record<string, string | number | boolean | null | undefined>,\n ): Promise<T> {\n return this.http.get<T>(path, { query });\n }\n\n /** POST request with body, returning typed response */\n protected _post<T>(path: string, body: unknown): Promise<T> {\n return this.http.post<T>(path, { body });\n }\n\n /** PATCH request with body, returning typed response */\n protected _patch<T>(path: string, body: unknown): Promise<T> {\n return this.http.patch<T>(path, { body });\n }\n\n /** DELETE request, returning void */\n protected _delete(path: string): Promise<void> {\n return this.http.delete(path) as Promise<void>;\n }\n\n /** GET list request with optional query params, returning paginated response */\n // biome-ignore lint/suspicious/noExplicitAny: params are typed at service level, cast needed for HttpClient\n protected _list<T>(params?: any): Promise<Paginated<T>> {\n return this.http.get<Paginated<T>>(this.basePath, { query: params });\n }\n}\n","// AvailabilityService — check, search, and helper methods for /booking/v1/availability\n\nimport type {\n AvailabilityCheckParams,\n AvailabilityResult,\n AvailabilitySearchParams,\n AvailabilitySearchResult,\n CalendarDay,\n CalendarParams,\n PricingParams,\n PricingResult,\n ServiceSlotParams,\n ServiceTimeSlot,\n TableSlotParams,\n TimeSlot,\n} from \"../types/availability.js\";\nimport { BaseService } from \"./base.js\";\n\n/**\n * Service for checking and searching availability in the Atzentis Booking API.\n *\n * Provides two API endpoints (`check` and `search`) plus four client-side helper\n * methods for calendar views, table time-slots, service appointment slots, and\n * pricing aggregation.\n *\n * @example\n * ```typescript\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n *\n * // Check availability for a property\n * const result = await booking.availability.check({\n * propertyId: \"prop_abc123\",\n * checkIn: \"2025-06-01\",\n * checkOut: \"2025-06-05\",\n * });\n * ```\n */\nexport class AvailabilityService extends BaseService {\n protected readonly basePath = \"/booking/v1/availability\";\n\n /**\n * Check availability for a property and date range.\n *\n * @param params - Must include `propertyId`, `checkIn`, `checkOut`; supports optional filters\n *\n * @example\n * ```typescript\n * const result = await booking.availability.check({\n * propertyId: \"prop_abc123\",\n * checkIn: \"2025-06-01\",\n * checkOut: \"2025-06-05\",\n * type: \"room\",\n * guests: 2,\n * });\n * ```\n */\n check(params: AvailabilityCheckParams): Promise<AvailabilityResult> {\n const { propertyId, checkIn, checkOut, categoryId, spaceId, guests, type } = params;\n return this._get<AvailabilityResult>(this.basePath, {\n propertyId,\n checkIn,\n checkOut,\n categoryId,\n spaceId,\n guests,\n type,\n });\n }\n\n /**\n * Search availability across multiple properties.\n *\n * @param params - Must include `propertyIds`, `checkIn`, `checkOut`; supports filtering and pagination\n *\n * @example\n * ```typescript\n * const results = await booking.availability.search({\n * propertyIds: [\"prop_abc\", \"prop_def\"],\n * checkIn: \"2025-06-01\",\n * checkOut: \"2025-06-05\",\n * guests: 2,\n * priceRange: { min: 5000, max: 20000 },\n * });\n * ```\n */\n search(params: AvailabilitySearchParams): Promise<AvailabilitySearchResult> {\n return this._post<AvailabilitySearchResult>(this.basePath, params);\n }\n\n /**\n * Generate a calendar view of daily availability for a property.\n *\n * Client-side helper that calls `check()` internally and transforms the result\n * into a `CalendarDay[]` suitable for calendar UI rendering.\n *\n * @param params - Extends `AvailabilityCheckParams` with optional `months` (default: 1)\n *\n * @example\n * ```typescript\n * const calendar = await booking.availability.getCalendar({\n * propertyId: \"prop_abc123\",\n * checkIn: \"2025-06-01\",\n * checkOut: \"2025-06-30\",\n * });\n * ```\n */\n async getCalendar(params: CalendarParams): Promise<CalendarDay[]> {\n const { months, ...checkParams } = params;\n\n // Determine end date\n let endDate: string;\n if (checkParams.checkOut !== checkParams.checkIn) {\n endDate = checkParams.checkOut;\n } else if (months != null) {\n // Explicit months parameter: generate N months from checkIn\n endDate = addDays(checkParams.checkIn, months * 30);\n } else {\n // checkIn === checkOut with no months → empty calendar\n return [];\n }\n\n // Generate date range, capped at 365 days\n const dates = generateDateRange(checkParams.checkIn, endDate, 365);\n if (dates.length === 0) return [];\n\n // Fetch availability for the full range\n const result = await this.check({ ...checkParams, checkOut: endDate });\n\n // Map each date to a CalendarDay\n const spacesAvailable = result.spaces.filter((s) => s.available).length;\n\n return dates.map((date) => ({\n date,\n available: result.available,\n price: result.available && result.pricing ? result.pricing.total : null,\n minStay: result.restrictions?.minStay ?? null,\n closedToArrival: result.restrictions?.closedToArrival ?? false,\n closedToDeparture: result.restrictions?.closedToDeparture ?? false,\n spacesAvailable: result.available ? spacesAvailable : 0,\n }));\n }\n\n /**\n * Get available table reservation time slots for a specific date.\n *\n * Client-side helper for the Tables vertical. Calls `check()` internally\n * with `type: \"table\"` and reshapes the response into `TimeSlot[]`.\n *\n * @param params - Must include `propertyId` and `date`\n *\n * @example\n * ```typescript\n * const slots = await booking.availability.getTableSlots({\n * propertyId: \"prop_abc123\",\n * date: \"2025-06-15\",\n * guests: 4,\n * });\n * ```\n */\n async getTableSlots(params: TableSlotParams): Promise<TimeSlot[]> {\n const { date, guests, categoryId, duration, ...rest } = params;\n\n const result = await this.check({\n ...rest,\n checkIn: date,\n checkOut: date,\n type: \"table\",\n guests,\n categoryId,\n });\n\n if (!result.available || result.spaces.length === 0) {\n return [];\n }\n\n const slotDuration = duration ?? 90;\n const availableSpaces = result.spaces.filter((s) => s.available);\n\n return availableSpaces.map((space, index) => ({\n startTime: minutesToTime(11 * 60 + index * slotDuration),\n endTime: minutesToTime(11 * 60 + index * slotDuration + slotDuration),\n available: true,\n tablesAvailable: availableSpaces.length,\n price: space.price,\n }));\n }\n\n /**\n * Get available service appointment slots for a specific date.\n *\n * Client-side helper for the Services vertical. Calls `check()` internally\n * with `type: \"service\"` and reshapes the response into `ServiceTimeSlot[]`.\n *\n * @param params - Must include `propertyId` and `date`\n *\n * @example\n * ```typescript\n * const slots = await booking.availability.getServiceSlots({\n * propertyId: \"prop_abc123\",\n * date: \"2025-06-15\",\n * providerId: \"staff_001\",\n * duration: 60,\n * });\n * ```\n */\n async getServiceSlots(params: ServiceSlotParams): Promise<ServiceTimeSlot[]> {\n const { date, providerId, categoryId, duration, ...rest } = params;\n\n const result = await this.check({\n ...rest,\n checkIn: date,\n checkOut: date,\n type: \"service\",\n categoryId,\n });\n\n if (!result.available || result.spaces.length === 0) {\n return [];\n }\n\n const slotDuration = duration ?? 60;\n const availableSpaces = result.spaces.filter((s) => s.available);\n\n return availableSpaces.map((space, index) => ({\n startTime: minutesToTime(9 * 60 + index * slotDuration),\n endTime: minutesToTime(9 * 60 + index * slotDuration + slotDuration),\n available: true,\n tablesAvailable: availableSpaces.length,\n price: space.price,\n providerId: providerId ?? space.spaceId,\n providerName: space.name,\n }));\n }\n\n /**\n * Get aggregated pricing statistics for a property and date range.\n *\n * Client-side helper that calls `check()` internally and computes\n * min/max/average/total pricing from available spaces.\n *\n * @param params - Extends `AvailabilityCheckParams` with optional `currency`\n *\n * @example\n * ```typescript\n * const pricing = await booking.availability.getPricing({\n * propertyId: \"prop_abc123\",\n * checkIn: \"2025-06-01\",\n * checkOut: \"2025-06-05\",\n * });\n * console.log(`From €${pricing.minPrice / 100} to €${pricing.maxPrice / 100}`);\n * ```\n */\n async getPricing(params: PricingParams): Promise<PricingResult> {\n const { currency: requestedCurrency, ...checkParams } = params;\n\n const result = await this.check(checkParams);\n\n const availableSpaces = result.spaces.filter((s) => s.available);\n const nights = dateDiffDays(params.checkIn, params.checkOut);\n const currency = requestedCurrency ?? result.pricing?.currency ?? \"EUR\";\n\n if (availableSpaces.length === 0) {\n return {\n minPrice: 0,\n maxPrice: 0,\n averagePrice: 0,\n totalPrice: 0,\n perNight: null,\n nights,\n currency,\n };\n }\n\n const prices = availableSpaces.map((s) => s.price);\n const minPrice = Math.min(...prices);\n const maxPrice = Math.max(...prices);\n const averagePrice = Math.round(prices.reduce((sum, p) => sum + p, 0) / prices.length);\n const totalPrice = result.pricing?.total ?? averagePrice * Math.max(nights, 1);\n const perNight = nights > 0 ? Math.round(totalPrice / nights) : null;\n\n return { minPrice, maxPrice, averagePrice, totalPrice, perNight, nights, currency };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Date utility helpers (timezone-agnostic, string-based)\n// ---------------------------------------------------------------------------\n\n/** Parse YYYY-MM-DD into [year, month, day] integers. */\nfunction parseDateStr(dateStr: string): [number, number, number] {\n const parts = dateStr.split(\"-\");\n return [Number(parts[0]), Number(parts[1]), Number(parts[2])];\n}\n\n/** Add N days to a YYYY-MM-DD string. Uses UTC to avoid timezone issues. */\nfunction addDays(dateStr: string, days: number): string {\n const [year, month, day] = parseDateStr(dateStr);\n return formatDate(new Date(Date.UTC(year, month - 1, day + days)));\n}\n\n/** Generate YYYY-MM-DD strings from start (inclusive) to end (exclusive), capped at maxDays. */\nfunction generateDateRange(start: string, end: string, maxDays: number): string[] {\n const [sy, sm, sd] = parseDateStr(start);\n const [ey, em, ed] = parseDateStr(end);\n const startMs = Date.UTC(sy, sm - 1, sd);\n const endMs = Date.UTC(ey, em - 1, ed);\n\n if (endMs <= startMs) return [];\n\n const msPerDay = 86_400_000;\n const totalDays = Math.min(Math.floor((endMs - startMs) / msPerDay), maxDays);\n const dates: string[] = [];\n\n for (let i = 0; i < totalDays; i++) {\n dates.push(formatDate(new Date(startMs + i * msPerDay)));\n }\n\n return dates;\n}\n\n/** Compute the difference in days between two YYYY-MM-DD strings. */\nfunction dateDiffDays(start: string, end: string): number {\n const [sy, sm, sd] = parseDateStr(start);\n const [ey, em, ed] = parseDateStr(end);\n const startMs = Date.UTC(sy, sm - 1, sd);\n const endMs = Date.UTC(ey, em - 1, ed);\n return Math.max(0, Math.floor((endMs - startMs) / 86_400_000));\n}\n\n/** Format a Date as YYYY-MM-DD using UTC values. */\nfunction formatDate(d: Date): string {\n const y = d.getUTCFullYear();\n const m = String(d.getUTCMonth() + 1).padStart(2, \"0\");\n const day = String(d.getUTCDate()).padStart(2, \"0\");\n return `${y}-${m}-${day}`;\n}\n\n/** Convert total minutes since midnight to HH:MM string. */\nfunction minutesToTime(totalMinutes: number): string {\n const hours = Math.floor(totalMinutes / 60) % 24;\n const minutes = totalMinutes % 60;\n return `${String(hours).padStart(2, \"0\")}:${String(minutes).padStart(2, \"0\")}`;\n}\n","// CategoriesService — CRUD operations for /inventory/v1/categories\n\nimport type { Paginated } from \"../types/pagination.js\";\nimport type {\n CreateCategoryInput,\n ListCategoriesParams,\n SpaceCategory,\n UpdateCategoryInput,\n} from \"../types/properties.js\";\nimport { BaseService } from \"./base.js\";\n\n/**\n * Service for managing space categories (room types) in the Atzentis Booking API.\n *\n * Categories are property-scoped — `propertyId` is required for create and list operations.\n *\n * @example\n * ```typescript\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n *\n * // List categories for a property\n * const { data } = await booking.categories.list({ propertyId: \"prop_abc123\" });\n *\n * // Create a new category\n * const category = await booking.categories.create({\n * propertyId: \"prop_abc123\",\n * name: \"Deluxe Suite\",\n * code: \"DLX\",\n * maxOccupancy: 3,\n * basePrice: 25000, // €250.00 in cents\n * });\n * ```\n */\nexport class CategoriesService extends BaseService {\n protected readonly basePath = \"/inventory/v1/categories\";\n\n /**\n * Create a new space category.\n *\n * @example\n * ```typescript\n * const category = await booking.categories.create({\n * propertyId: \"prop_abc123\",\n * name: \"Standard Room\",\n * code: \"STD\",\n * maxOccupancy: 2,\n * basePrice: 12000, // €120.00 in cents\n * });\n * ```\n */\n create(input: CreateCategoryInput): Promise<SpaceCategory> {\n return this._post<SpaceCategory>(this.basePath, input);\n }\n\n /**\n * List categories for a property with cursor-based pagination.\n *\n * @param params - Must include `propertyId`\n *\n * @example\n * ```typescript\n * const page = await booking.categories.list({\n * propertyId: \"prop_abc123\",\n * limit: 50,\n * });\n * ```\n */\n list(params: ListCategoriesParams): Promise<Paginated<SpaceCategory>> {\n return this._list<SpaceCategory>(params);\n }\n\n /**\n * Update an existing space category.\n *\n * @example\n * ```typescript\n * const updated = await booking.categories.update(\"cat_xyz789\", {\n * basePrice: 15000, // Updated to €150.00\n * });\n * ```\n */\n update(categoryId: string, input: UpdateCategoryInput): Promise<SpaceCategory> {\n return this._patch<SpaceCategory>(this._buildPath(categoryId), input);\n }\n\n /**\n * Delete a space category.\n *\n * @example\n * ```typescript\n * await booking.categories.delete(\"cat_xyz789\");\n * ```\n */\n delete(categoryId: string): Promise<void> {\n return this._delete(this._buildPath(categoryId));\n }\n}\n","// PropertiesService — CRUD operations for /inventory/v1/properties\n\nimport type { Paginated } from \"../types/pagination.js\";\nimport type {\n CreatePropertyInput,\n ListPropertiesParams,\n Property,\n UpdatePropertyInput,\n} from \"../types/properties.js\";\nimport { BaseService } from \"./base.js\";\n\n/**\n * Service for managing properties in the Atzentis Booking API.\n *\n * @example\n * ```typescript\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n *\n * // List all active properties\n * const { data, hasMore } = await booking.properties.list({ status: \"active\" });\n *\n * // Create a new property\n * const property = await booking.properties.create({\n * name: \"Seaside Villa\",\n * type: \"villa\",\n * currency: \"EUR\",\n * timezone: \"Europe/Athens\",\n * address: { street: \"123 Coast Rd\", city: \"Chania\", country: \"GR\" },\n * });\n * ```\n */\nexport class PropertiesService extends BaseService {\n protected readonly basePath = \"/inventory/v1/properties\";\n\n /**\n * Create a new property.\n *\n * @example\n * ```typescript\n * const property = await booking.properties.create({\n * name: \"Hotel Athena\",\n * type: \"hotel\",\n * currency: \"EUR\",\n * timezone: \"Europe/Athens\",\n * address: { street: \"1 Plaka St\", city: \"Athens\", country: \"GR\" },\n * });\n * ```\n */\n create(input: CreatePropertyInput): Promise<Property> {\n return this._post<Property>(this.basePath, input);\n }\n\n /**\n * List properties with optional filters and cursor-based pagination.\n *\n * @example\n * ```typescript\n * const page = await booking.properties.list({ type: \"hotel\", limit: 20 });\n * console.log(page.data); // Property[]\n * console.log(page.hasMore); // boolean\n * ```\n */\n list(params?: ListPropertiesParams): Promise<Paginated<Property>> {\n return this._list<Property>(params);\n }\n\n /**\n * Get a single property by ID.\n *\n * @example\n * ```typescript\n * const property = await booking.properties.get(\"prop_abc123\");\n * ```\n */\n get(propertyId: string): Promise<Property> {\n return this._get<Property>(this._buildPath(propertyId));\n }\n\n /**\n * Update an existing property.\n *\n * @example\n * ```typescript\n * const updated = await booking.properties.update(\"prop_abc123\", {\n * name: \"Hotel Athena Deluxe\",\n * });\n * ```\n */\n update(propertyId: string, input: UpdatePropertyInput): Promise<Property> {\n return this._patch<Property>(this._buildPath(propertyId), input);\n }\n\n /**\n * Delete a property.\n *\n * @example\n * ```typescript\n * await booking.properties.delete(\"prop_abc123\");\n * ```\n */\n delete(propertyId: string): Promise<void> {\n return this._delete(this._buildPath(propertyId));\n }\n}\n","// SpacesService — CRUD, bulk operations, and POS linking for /inventory/v1/spaces\n\nimport type { Paginated } from \"../types/pagination.js\";\nimport type {\n BulkUpdateSpaceInput,\n CreateSpaceInput,\n LinkPosTableInput,\n ListSpacesParams,\n Space,\n UpdateSpaceInput,\n} from \"../types/spaces.js\";\nimport { BaseService } from \"./base.js\";\n\n/**\n * Service for managing bookable spaces in the Atzentis Booking API.\n *\n * Spaces are the universal bookable inventory unit across all three verticals\n * (Stays, Tables, Services). The `type` field determines which vertical a\n * space belongs to and what vertical-specific fields apply.\n *\n * @example\n * ```typescript\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n *\n * // List all rooms for a property\n * const { data } = await booking.spaces.list({\n * propertyId: \"prop_abc123\",\n * type: \"room\",\n * });\n *\n * // Create a new table space\n * const space = await booking.spaces.create({\n * propertyId: \"prop_abc123\",\n * name: \"Table 1\",\n * type: \"table\",\n * capacity: 4,\n * });\n * ```\n */\nexport class SpacesService extends BaseService {\n protected readonly basePath = \"/inventory/v1/spaces\";\n\n /**\n * Create a new space.\n *\n * @example\n * ```typescript\n * const space = await booking.spaces.create({\n * propertyId: \"prop_abc123\",\n * name: \"Room 101\",\n * type: \"room\",\n * floor: \"1\",\n * capacity: 2,\n * });\n * ```\n */\n create(input: CreateSpaceInput): Promise<Space> {\n return this._post<Space>(this.basePath, input);\n }\n\n /**\n * List spaces for a property with optional filters and cursor-based pagination.\n *\n * @param params - Must include `propertyId`; supports optional `type`, `status`, `categoryId`, `floor` filters\n *\n * @example\n * ```typescript\n * const page = await booking.spaces.list({\n * propertyId: \"prop_abc123\",\n * type: \"room\",\n * status: \"available\",\n * limit: 20,\n * });\n * ```\n */\n list(params: ListSpacesParams): Promise<Paginated<Space>> {\n return this._list<Space>(params);\n }\n\n /**\n * Get a single space by ID.\n *\n * @example\n * ```typescript\n * const space = await booking.spaces.get(\"spc_abc123\");\n * ```\n */\n get(spaceId: string): Promise<Space> {\n return this._get<Space>(this._buildPath(spaceId));\n }\n\n /**\n * Update an existing space.\n *\n * @example\n * ```typescript\n * const updated = await booking.spaces.update(\"spc_abc123\", {\n * name: \"Room 101 Deluxe\",\n * capacity: 3,\n * });\n * ```\n */\n update(spaceId: string, input: UpdateSpaceInput): Promise<Space> {\n return this._patch<Space>(this._buildPath(spaceId), input);\n }\n\n /**\n * Delete a space.\n *\n * @example\n * ```typescript\n * await booking.spaces.delete(\"spc_abc123\");\n * ```\n */\n delete(spaceId: string): Promise<void> {\n return this._delete(this._buildPath(spaceId));\n }\n\n /**\n * Bulk create multiple spaces for a property in a single API call.\n *\n * @example\n * ```typescript\n * const spaces = await booking.spaces.bulkCreate(\"prop_abc123\", [\n * { propertyId: \"prop_abc123\", name: \"Room 101\", type: \"room\" },\n * { propertyId: \"prop_abc123\", name: \"Room 102\", type: \"room\" },\n * ]);\n * ```\n */\n bulkCreate(propertyId: string, spaces: CreateSpaceInput[]): Promise<Space[]> {\n return this._post<Space[]>(this._buildPath(\"bulk\"), {\n propertyId,\n spaces,\n });\n }\n\n /**\n * Bulk update multiple spaces for a property in a single API call.\n *\n * @example\n * ```typescript\n * const updated = await booking.spaces.bulkUpdate(\"prop_abc123\", [\n * { id: \"spc_1\", name: \"Room 101 Deluxe\" },\n * { id: \"spc_2\", capacity: 3 },\n * ]);\n * ```\n */\n bulkUpdate(propertyId: string, updates: BulkUpdateSpaceInput[]): Promise<Space[]> {\n return this._patch<Space[]>(this._buildPath(\"bulk\"), {\n propertyId,\n updates,\n });\n }\n\n /**\n * Link a space to a POS table. Tables vertical only.\n *\n * Creates a cross-domain bridge between the inventory service and the POS system,\n * enabling a space to reference its physical POS table.\n *\n * @example\n * ```typescript\n * const linked = await booking.spaces.linkPosTable(\"spc_abc123\", {\n * posTableId: \"pos_table_42\",\n * });\n * ```\n */\n linkPosTable(spaceId: string, input: LinkPosTableInput): Promise<Space> {\n return this._post<Space>(this._buildPath(spaceId, \"pos-table\"), input);\n }\n}\n","// BookingClient — primary public entry point for @atzentis/booking-sdk\n\nimport { type BookingClientConfig, bookingClientConfigSchema } from \"./config.js\";\nimport { HttpClient } from \"./http.js\";\nimport { AvailabilityService } from \"./services/availability.js\";\nimport { CategoriesService } from \"./services/categories.js\";\nimport { PropertiesService } from \"./services/properties.js\";\nimport { SpacesService } from \"./services/spaces.js\";\n\n/**\n * Main SDK client for the Atzentis Booking API.\n *\n * @example\n * ```typescript\n * import { BookingClient } from \"@atzentis/booking-sdk\";\n * const booking = new BookingClient({ apiKey: \"atz_io_live_xxxxx\" });\n * ```\n */\nexport class BookingClient {\n readonly httpClient: HttpClient;\n private _availability?: AvailabilityService;\n private _properties?: PropertiesService;\n private _categories?: CategoriesService;\n private _spaces?: SpacesService;\n\n constructor(config: BookingClientConfig) {\n const validated = bookingClientConfigSchema.parse(config);\n\n this.httpClient = new HttpClient({\n baseUrl: validated.baseUrl,\n apiKey: validated.apiKey,\n tenantId: validated.tenantId,\n timeout: validated.timeout,\n retryConfig: validated.retry\n ? {\n maxRetries: validated.retry.maxRetries,\n baseDelay: validated.retry.baseDelay,\n }\n : undefined,\n debug: validated.debug,\n logger: validated.logger,\n });\n }\n\n /** Availability service — lazy-initialized on first access */\n get availability(): AvailabilityService {\n this._availability ??= new AvailabilityService(this.httpClient);\n return this._availability;\n }\n\n /** Properties service — lazy-initialized on first access */\n get properties(): PropertiesService {\n this._properties ??= new PropertiesService(this.httpClient);\n return this._properties;\n }\n\n /** Categories service — lazy-initialized on first access */\n get categories(): CategoriesService {\n this._categories ??= new CategoriesService(this.httpClient);\n return this._categories;\n }\n\n /** Spaces service — lazy-initialized on first access */\n get spaces(): SpacesService {\n this._spaces ??= new SpacesService(this.httpClient);\n return this._spaces;\n }\n\n setApiKey(key: string): void {\n if (!key || key.trim().length === 0) {\n throw new Error(\"apiKey must be a non-empty string\");\n }\n this.httpClient.setApiKey(key);\n }\n\n setTenantId(id: string): void {\n if (!id || id.trim().length === 0) {\n throw new Error(\"tenantId must be a non-empty string\");\n }\n this.httpClient.setTenantId(id);\n }\n}\n","// Cursor-based pagination helpers for @atzentis/booking-sdk\n\nimport type { PageFetcher, Paginated, PaginationOptions } from \"./types/pagination.js\";\n\n/**\n * Returns an AsyncIterable that yields each page's data array in order.\n * Iteration stops automatically when hasMore is false or cursor is null.\n *\n * @example\n * for await (const page of paginate(fetcher, { limit: 50 })) {\n * for (const item of page) {\n * process(item);\n * }\n * }\n */\nexport function paginate<T>(\n fetcher: PageFetcher<T>,\n options?: PaginationOptions,\n): AsyncIterable<T[]> {\n return {\n [Symbol.asyncIterator](): AsyncIterator<T[]> {\n let cursor: string | undefined = options?.cursor;\n let done = false;\n\n return {\n async next(): Promise<IteratorResult<T[]>> {\n if (done) return { value: undefined as unknown as T[], done: true };\n\n const result = await fetcher({ ...(options ?? {}), cursor });\n\n if (!result.hasMore || result.cursor === null) {\n done = true;\n } else {\n cursor = result.cursor;\n }\n\n return { value: result.data, done: false };\n },\n };\n },\n };\n}\n\n/**\n * Fetches only the first page and returns the full Paginated<T> result.\n * Useful when callers only need one page and don't want to use for-await.\n *\n * @example\n * const result = await firstPage(fetcher, { limit: 10 });\n * console.log(result.data, result.hasMore);\n */\nexport async function firstPage<T>(\n fetcher: PageFetcher<T>,\n options?: PaginationOptions,\n): Promise<Paginated<T>> {\n return fetcher({ ...(options ?? {}) });\n}\n","// Property and Category types for @atzentis/booking-sdk\n\n/** All supported property types in the v4.0 API */\nexport type PropertyType =\n | \"hotel\"\n | \"resort\"\n | \"villa\"\n | \"apartment\"\n | \"hostel\"\n | \"bnb\"\n | \"restaurant\"\n | \"cafe\"\n | \"bar\"\n | \"beach\"\n | \"spa\"\n | \"salon\"\n | \"custom\";\n\n/** Property lifecycle status */\nexport type PropertyStatus = \"active\" | \"inactive\" | \"setup\" | \"suspended\";\n\n/** Geographic coordinates */\nexport interface Coordinates {\n lat: number;\n lng: number;\n}\n\n/** Physical address of a property */\nexport interface PropertyAddress {\n street: string;\n city: string;\n country: string;\n state?: string;\n postalCode?: string;\n coordinates?: Coordinates;\n}\n\n/**\n * Feature modules that can be enabled per property.\n *\n * Each flag controls access to a v4.0 API service group:\n * - `booking` — Reservation and availability management\n * - `concierge` — Guest request and service management\n * - `intelligence` — Analytics and reporting\n * - `revenue` — Dynamic pricing and yield management\n * - `housekeeping` — Room cleaning and maintenance scheduling\n * - `nightAudit` — End-of-day accounting reconciliation\n * - `distribution` — Channel manager and OTA connectivity\n * - `fiscal` — Tax compliance and fiscal reporting\n * - `pos` — Point of sale bridge integration\n */\nexport interface PropertyModules {\n booking?: boolean;\n concierge?: boolean;\n intelligence?: boolean;\n revenue?: boolean;\n housekeeping?: boolean;\n nightAudit?: boolean;\n distribution?: boolean;\n fiscal?: boolean;\n pos?: boolean;\n}\n\n/** All 9 module names as a readonly tuple */\nexport const PROPERTY_MODULES = [\n \"booking\",\n \"concierge\",\n \"intelligence\",\n \"revenue\",\n \"housekeeping\",\n \"nightAudit\",\n \"distribution\",\n \"fiscal\",\n \"pos\",\n] as const;\n\n/** Default modules configuration with all modules disabled */\nexport const DEFAULT_MODULES: PropertyModules = {\n booking: false,\n concierge: false,\n intelligence: false,\n revenue: false,\n housekeeping: false,\n nightAudit: false,\n distribution: false,\n fiscal: false,\n pos: false,\n};\n\n/** A property in the Atzentis Booking system */\nexport interface Property {\n id: string;\n name: string;\n type: PropertyType;\n status: PropertyStatus;\n currency: string;\n timezone: string;\n address: PropertyAddress;\n modules: PropertyModules;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Input for creating a new property */\nexport interface CreatePropertyInput {\n name: string;\n type: PropertyType;\n currency: string;\n timezone: string;\n address: PropertyAddress;\n modules?: PropertyModules;\n}\n\n/** Input for updating an existing property — all fields optional */\nexport type UpdatePropertyInput = Partial<CreatePropertyInput>;\n\n/** Query parameters for listing properties */\nexport interface ListPropertiesParams {\n type?: PropertyType;\n status?: PropertyStatus;\n cursor?: string;\n limit?: number;\n}\n\n/** A space category (room type) belonging to a property */\nexport interface SpaceCategory {\n id: string;\n propertyId: string;\n name: string;\n code: string;\n maxOccupancy: number;\n /** Base price in integer cents */\n basePrice: number;\n description?: string;\n sortOrder?: number;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Input for creating a new space category */\nexport interface CreateCategoryInput {\n propertyId: string;\n name: string;\n code: string;\n maxOccupancy: number;\n /** Base price in integer cents */\n basePrice: number;\n description?: string;\n sortOrder?: number;\n}\n\n/** Input for updating a space category — cannot change propertyId */\nexport type UpdateCategoryInput = Partial<Omit<CreateCategoryInput, \"propertyId\">>;\n\n/** Query parameters for listing categories — propertyId is required */\nexport interface ListCategoriesParams {\n propertyId: string;\n cursor?: string;\n limit?: number;\n}\n","// Space types for @atzentis/booking-sdk\n\n/**\n * All supported space types in the v4.0 API.\n *\n * Grouped by vertical:\n * - **Stays:** `room`, `sunbed`, `parking`\n * - **Tables:** `table`, `locker`\n * - **Services:** `service`, `meeting_room`, `desk`\n * - **Universal:** `custom`\n */\nexport type SpaceType =\n | \"room\"\n | \"table\"\n | \"sunbed\"\n | \"parking\"\n | \"desk\"\n | \"meeting_room\"\n | \"locker\"\n | \"service\"\n | \"custom\";\n\n/** All 9 space types as a readonly tuple for runtime enumeration */\nexport const SPACE_TYPES = [\n \"room\",\n \"table\",\n \"sunbed\",\n \"parking\",\n \"desk\",\n \"meeting_room\",\n \"locker\",\n \"service\",\n \"custom\",\n] as const;\n\n/** Space availability/lifecycle status */\nexport type SpaceStatus = \"available\" | \"occupied\" | \"maintenance\" | \"blocked\" | \"inactive\";\n\n/** All 5 space statuses as a readonly tuple for runtime enumeration */\nexport const SPACE_STATUSES = [\n \"available\",\n \"occupied\",\n \"maintenance\",\n \"blocked\",\n \"inactive\",\n] as const;\n\n/** A bookable space in the Atzentis Booking system */\nexport interface Space {\n id: string;\n propertyId: string;\n categoryId: string | null;\n name: string;\n type: SpaceType;\n status: SpaceStatus;\n /** Used for rooms (hotel floor) and desks/meeting rooms (office floor). Use string to support labels like \"B1\", \"G\", \"1\", \"2\". */\n floor: string | null;\n /** Used for tables (cover count) and meeting rooms (person count). Null if not applicable. */\n capacity: number | null;\n /** POS table reference; set via `linkPosTable()`. Tables vertical only. Null until linked. */\n posTableId: string | null;\n /** Open bag for vertical-specific extras not covered by standard fields. Schema is consumer-defined. */\n metadata: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Input for creating a new space */\nexport interface CreateSpaceInput {\n propertyId: string;\n name: string;\n type: SpaceType;\n categoryId?: string;\n /** Optional. See `Space.floor` for usage by vertical. */\n floor?: string;\n /** Optional. See `Space.capacity` for usage by vertical. */\n capacity?: number;\n /** Optional. See `Space.metadata` for usage by vertical. */\n metadata?: Record<string, unknown>;\n}\n\n/** Input for updating an existing space — all fields optional */\nexport type UpdateSpaceInput = Partial<Omit<CreateSpaceInput, \"propertyId\">>;\n\n/** Input for bulk updating spaces — requires `id` to identify each space */\nexport type BulkUpdateSpaceInput = UpdateSpaceInput & { id: string };\n\n/** Input for linking a space to a POS table */\nexport interface LinkPosTableInput {\n posTableId: string;\n}\n\n/** Query parameters for listing spaces — propertyId is required */\nexport interface ListSpacesParams {\n propertyId: string;\n type?: SpaceType;\n status?: SpaceStatus;\n categoryId?: string;\n floor?: number | string;\n limit?: number;\n cursor?: string;\n}\n"],"mappings":";;;;;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