@atzentis/booking-sdk 0.1.3 → 0.1.4

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
@@ -40,7 +40,10 @@ __export(index_exports, {
40
40
  PaymentError: () => PaymentError,
41
41
  PropertiesService: () => PropertiesService,
42
42
  RateLimitError: () => RateLimitError,
43
+ SPACE_STATUSES: () => SPACE_STATUSES,
44
+ SPACE_TYPES: () => SPACE_TYPES,
43
45
  ServerError: () => ServerError,
46
+ SpacesService: () => SpacesService,
44
47
  TimeoutError: () => TimeoutError,
45
48
  VERSION: () => VERSION,
46
49
  ValidationError: () => ValidationError,
@@ -658,6 +661,135 @@ var PropertiesService = class extends BaseService {
658
661
  }
659
662
  };
660
663
 
664
+ // src/services/spaces.ts
665
+ var SpacesService = class extends BaseService {
666
+ constructor() {
667
+ super(...arguments);
668
+ this.basePath = "/inventory/v1/spaces";
669
+ }
670
+ /**
671
+ * Create a new space.
672
+ *
673
+ * @example
674
+ * ```typescript
675
+ * const space = await booking.spaces.create({
676
+ * propertyId: "prop_abc123",
677
+ * name: "Room 101",
678
+ * type: "room",
679
+ * floor: "1",
680
+ * capacity: 2,
681
+ * });
682
+ * ```
683
+ */
684
+ create(input) {
685
+ return this._post(this.basePath, input);
686
+ }
687
+ /**
688
+ * List spaces for a property with optional filters and cursor-based pagination.
689
+ *
690
+ * @param params - Must include `propertyId`; supports optional `type`, `status`, `categoryId`, `floor` filters
691
+ *
692
+ * @example
693
+ * ```typescript
694
+ * const page = await booking.spaces.list({
695
+ * propertyId: "prop_abc123",
696
+ * type: "room",
697
+ * status: "available",
698
+ * limit: 20,
699
+ * });
700
+ * ```
701
+ */
702
+ list(params) {
703
+ return this._list(params);
704
+ }
705
+ /**
706
+ * Get a single space by ID.
707
+ *
708
+ * @example
709
+ * ```typescript
710
+ * const space = await booking.spaces.get("spc_abc123");
711
+ * ```
712
+ */
713
+ get(spaceId) {
714
+ return this._get(this._buildPath(spaceId));
715
+ }
716
+ /**
717
+ * Update an existing space.
718
+ *
719
+ * @example
720
+ * ```typescript
721
+ * const updated = await booking.spaces.update("spc_abc123", {
722
+ * name: "Room 101 Deluxe",
723
+ * capacity: 3,
724
+ * });
725
+ * ```
726
+ */
727
+ update(spaceId, input) {
728
+ return this._patch(this._buildPath(spaceId), input);
729
+ }
730
+ /**
731
+ * Delete a space.
732
+ *
733
+ * @example
734
+ * ```typescript
735
+ * await booking.spaces.delete("spc_abc123");
736
+ * ```
737
+ */
738
+ delete(spaceId) {
739
+ return this._delete(this._buildPath(spaceId));
740
+ }
741
+ /**
742
+ * Bulk create multiple spaces for a property in a single API call.
743
+ *
744
+ * @example
745
+ * ```typescript
746
+ * const spaces = await booking.spaces.bulkCreate("prop_abc123", [
747
+ * { propertyId: "prop_abc123", name: "Room 101", type: "room" },
748
+ * { propertyId: "prop_abc123", name: "Room 102", type: "room" },
749
+ * ]);
750
+ * ```
751
+ */
752
+ bulkCreate(propertyId, spaces) {
753
+ return this._post(this._buildPath("bulk"), {
754
+ propertyId,
755
+ spaces
756
+ });
757
+ }
758
+ /**
759
+ * Bulk update multiple spaces for a property in a single API call.
760
+ *
761
+ * @example
762
+ * ```typescript
763
+ * const updated = await booking.spaces.bulkUpdate("prop_abc123", [
764
+ * { id: "spc_1", name: "Room 101 Deluxe" },
765
+ * { id: "spc_2", capacity: 3 },
766
+ * ]);
767
+ * ```
768
+ */
769
+ bulkUpdate(propertyId, updates) {
770
+ return this._patch(this._buildPath("bulk"), {
771
+ propertyId,
772
+ updates
773
+ });
774
+ }
775
+ /**
776
+ * Link a space to a POS table. Tables vertical only.
777
+ *
778
+ * Creates a cross-domain bridge between the inventory service and the POS system,
779
+ * enabling a space to reference its physical POS table.
780
+ *
781
+ * @example
782
+ * ```typescript
783
+ * const linked = await booking.spaces.linkPosTable("spc_abc123", {
784
+ * posTableId: "pos_table_42",
785
+ * });
786
+ * ```
787
+ */
788
+ linkPosTable(spaceId, input) {
789
+ return this._post(this._buildPath(spaceId, "pos-table"), input);
790
+ }
791
+ };
792
+
661
793
  // src/client.ts
662
794
  var BookingClient = class {
663
795
  constructor(config) {
@@ -685,6 +817,11 @@ var BookingClient = class {
685
817
  this._categories ?? (this._categories = new CategoriesService(this.httpClient));
686
818
  return this._categories;
687
819
  }
820
+ /** Spaces service — lazy-initialized on first access */
821
+ get spaces() {
822
+ this._spaces ?? (this._spaces = new SpacesService(this.httpClient));
823
+ return this._spaces;
824
+ }
688
825
  setApiKey(key) {
689
826
  if (!key || key.trim().length === 0) {
690
827
  throw new Error("apiKey must be a non-empty string");
@@ -748,6 +885,26 @@ var DEFAULT_MODULES = {
748
885
  pos: false
749
886
  };
750
887
 
888
+ // src/types/spaces.ts
889
+ var SPACE_TYPES = [
890
+ "room",
891
+ "table",
892
+ "sunbed",
893
+ "parking",
894
+ "desk",
895
+ "meeting_room",
896
+ "locker",
897
+ "service",
898
+ "custom"
899
+ ];
900
+ var SPACE_STATUSES = [
901
+ "available",
902
+ "occupied",
903
+ "maintenance",
904
+ "blocked",
905
+ "inactive"
906
+ ];
907
+
751
908
  // src/index.ts
752
909
  var VERSION = "0.1.0";
753
910
  // Annotate the CommonJS export names for ESM import in node:
@@ -765,7 +922,10 @@ var VERSION = "0.1.0";
765
922
  PaymentError,
766
923
  PropertiesService,
767
924
  RateLimitError,
925
+ SPACE_STATUSES,
926
+ SPACE_TYPES,
768
927
  ServerError,
928
+ SpacesService,
769
929
  TimeoutError,
770
930
  VERSION,
771
931
  ValidationError,
@@ -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/client.ts","../src/pagination.ts","../src/types/properties.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 { CategoriesService, PropertiesService } from \"./services/index.js\";\n\n// Types — re-export everything from types barrel\nexport type {\n Coordinates,\n CreateCategoryInput,\n CreatePropertyInput,\n HttpClientOptions,\n HttpMethod,\n HttpResponse,\n ListCategoriesParams,\n ListPropertiesParams,\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 SpaceCategory,\n UpdateCategoryInput,\n UpdatePropertyInput,\n} from \"./types/index.js\";\nexport { DEFAULT_MODULES, PROPERTY_MODULES } 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","// 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\";\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\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 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"],"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;AAAA;;;ACEA,iBAAkB;AAEX,IAAM,4BAA4B,aAAE,OAAO;AAAA,EAChD,QAAQ,aAAE,OAAO,EAAE,IAAI,GAAG,oBAAoB;AAAA,EAC9C,SAAS,aAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,yBAAyB;AAAA,EAC3D,UAAU,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EACrC,SAAS,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,GAAM;AAAA,EACnD,OAAO,aACJ,OAAO;AAAA,IACN,YAAY,aAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC;AAAA,IACrD,WAAW,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,GAAG;AAAA,EACpD,CAAC,EACA,SAAS;AAAA,EACZ,OAAO,aAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EAChC,QAAQ,aACL,OAAO;AAAA,IACN,OAAO,aAAE;AAAA,MACP,CAAC,QAAQ,OAAO,QAAQ;AAAA,IAC1B;AAAA,EACF,CAAC,EACA,SAAS;AACd,CAAC;;;ACbM,IAAM,eAAN,cAA2B,MAAM;AAAA,EAKtC,YAAY,SAAiB,SAA8B;AACzD,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,WAAW,SAAS;AAChD,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ;AACtB,SAAK,UAAU,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KAAK;AACP;;;ATtFO,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/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;AAA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