@atzentis/booking-sdk 0.1.2 → 0.1.3
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 +213 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +315 -20
- package/dist/index.d.ts +315 -20
- package/dist/index.js +209 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,11 +30,15 @@ __export(index_exports, {
|
|
|
30
30
|
AuthenticationError: () => AuthenticationError,
|
|
31
31
|
BookingClient: () => BookingClient,
|
|
32
32
|
BookingError: () => BookingError,
|
|
33
|
+
CategoriesService: () => CategoriesService,
|
|
33
34
|
ConflictError: () => ConflictError,
|
|
35
|
+
DEFAULT_MODULES: () => DEFAULT_MODULES,
|
|
34
36
|
ForbiddenError: () => ForbiddenError,
|
|
35
37
|
HttpClient: () => HttpClient,
|
|
36
38
|
NotFoundError: () => NotFoundError,
|
|
39
|
+
PROPERTY_MODULES: () => PROPERTY_MODULES,
|
|
37
40
|
PaymentError: () => PaymentError,
|
|
41
|
+
PropertiesService: () => PropertiesService,
|
|
38
42
|
RateLimitError: () => RateLimitError,
|
|
39
43
|
ServerError: () => ServerError,
|
|
40
44
|
TimeoutError: () => TimeoutError,
|
|
@@ -483,6 +487,177 @@ _timeout = new WeakMap();
|
|
|
483
487
|
_debug = new WeakMap();
|
|
484
488
|
_logger = new WeakMap();
|
|
485
489
|
|
|
490
|
+
// src/services/base.ts
|
|
491
|
+
var BaseService = class {
|
|
492
|
+
constructor(http) {
|
|
493
|
+
this.http = http;
|
|
494
|
+
}
|
|
495
|
+
/** Build a full path from the base path and additional segments */
|
|
496
|
+
_buildPath(...segments) {
|
|
497
|
+
if (segments.length === 0) return this.basePath;
|
|
498
|
+
return `${this.basePath}/${segments.join("/")}`;
|
|
499
|
+
}
|
|
500
|
+
/** GET request returning typed response */
|
|
501
|
+
_get(path, query) {
|
|
502
|
+
return this.http.get(path, { query });
|
|
503
|
+
}
|
|
504
|
+
/** POST request with body, returning typed response */
|
|
505
|
+
_post(path, body) {
|
|
506
|
+
return this.http.post(path, { body });
|
|
507
|
+
}
|
|
508
|
+
/** PATCH request with body, returning typed response */
|
|
509
|
+
_patch(path, body) {
|
|
510
|
+
return this.http.patch(path, { body });
|
|
511
|
+
}
|
|
512
|
+
/** DELETE request, returning void */
|
|
513
|
+
_delete(path) {
|
|
514
|
+
return this.http.delete(path);
|
|
515
|
+
}
|
|
516
|
+
/** GET list request with optional query params, returning paginated response */
|
|
517
|
+
// biome-ignore lint/suspicious/noExplicitAny: params are typed at service level, cast needed for HttpClient
|
|
518
|
+
_list(params) {
|
|
519
|
+
return this.http.get(this.basePath, { query: params });
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
// src/services/categories.ts
|
|
524
|
+
var CategoriesService = class extends BaseService {
|
|
525
|
+
constructor() {
|
|
526
|
+
super(...arguments);
|
|
527
|
+
this.basePath = "/inventory/v1/categories";
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Create a new space category.
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```typescript
|
|
534
|
+
* const category = await booking.categories.create({
|
|
535
|
+
* propertyId: "prop_abc123",
|
|
536
|
+
* name: "Standard Room",
|
|
537
|
+
* code: "STD",
|
|
538
|
+
* maxOccupancy: 2,
|
|
539
|
+
* basePrice: 12000, // €120.00 in cents
|
|
540
|
+
* });
|
|
541
|
+
* ```
|
|
542
|
+
*/
|
|
543
|
+
create(input) {
|
|
544
|
+
return this._post(this.basePath, input);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* List categories for a property with cursor-based pagination.
|
|
548
|
+
*
|
|
549
|
+
* @param params - Must include `propertyId`
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```typescript
|
|
553
|
+
* const page = await booking.categories.list({
|
|
554
|
+
* propertyId: "prop_abc123",
|
|
555
|
+
* limit: 50,
|
|
556
|
+
* });
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
559
|
+
list(params) {
|
|
560
|
+
return this._list(params);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Update an existing space category.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```typescript
|
|
567
|
+
* const updated = await booking.categories.update("cat_xyz789", {
|
|
568
|
+
* basePrice: 15000, // Updated to €150.00
|
|
569
|
+
* });
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
update(categoryId, input) {
|
|
573
|
+
return this._patch(this._buildPath(categoryId), input);
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Delete a space category.
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* await booking.categories.delete("cat_xyz789");
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
delete(categoryId) {
|
|
584
|
+
return this._delete(this._buildPath(categoryId));
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// src/services/properties.ts
|
|
589
|
+
var PropertiesService = class extends BaseService {
|
|
590
|
+
constructor() {
|
|
591
|
+
super(...arguments);
|
|
592
|
+
this.basePath = "/inventory/v1/properties";
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Create a new property.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```typescript
|
|
599
|
+
* const property = await booking.properties.create({
|
|
600
|
+
* name: "Hotel Athena",
|
|
601
|
+
* type: "hotel",
|
|
602
|
+
* currency: "EUR",
|
|
603
|
+
* timezone: "Europe/Athens",
|
|
604
|
+
* address: { street: "1 Plaka St", city: "Athens", country: "GR" },
|
|
605
|
+
* });
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
create(input) {
|
|
609
|
+
return this._post(this.basePath, input);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* List properties with optional filters and cursor-based pagination.
|
|
613
|
+
*
|
|
614
|
+
* @example
|
|
615
|
+
* ```typescript
|
|
616
|
+
* const page = await booking.properties.list({ type: "hotel", limit: 20 });
|
|
617
|
+
* console.log(page.data); // Property[]
|
|
618
|
+
* console.log(page.hasMore); // boolean
|
|
619
|
+
* ```
|
|
620
|
+
*/
|
|
621
|
+
list(params) {
|
|
622
|
+
return this._list(params);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Get a single property by ID.
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* ```typescript
|
|
629
|
+
* const property = await booking.properties.get("prop_abc123");
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
632
|
+
get(propertyId) {
|
|
633
|
+
return this._get(this._buildPath(propertyId));
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Update an existing property.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```typescript
|
|
640
|
+
* const updated = await booking.properties.update("prop_abc123", {
|
|
641
|
+
* name: "Hotel Athena Deluxe",
|
|
642
|
+
* });
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
update(propertyId, input) {
|
|
646
|
+
return this._patch(this._buildPath(propertyId), input);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Delete a property.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* ```typescript
|
|
653
|
+
* await booking.properties.delete("prop_abc123");
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
656
|
+
delete(propertyId) {
|
|
657
|
+
return this._delete(this._buildPath(propertyId));
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
|
|
486
661
|
// src/client.ts
|
|
487
662
|
var BookingClient = class {
|
|
488
663
|
constructor(config) {
|
|
@@ -500,6 +675,16 @@ var BookingClient = class {
|
|
|
500
675
|
logger: validated.logger
|
|
501
676
|
});
|
|
502
677
|
}
|
|
678
|
+
/** Properties service — lazy-initialized on first access */
|
|
679
|
+
get properties() {
|
|
680
|
+
this._properties ?? (this._properties = new PropertiesService(this.httpClient));
|
|
681
|
+
return this._properties;
|
|
682
|
+
}
|
|
683
|
+
/** Categories service — lazy-initialized on first access */
|
|
684
|
+
get categories() {
|
|
685
|
+
this._categories ?? (this._categories = new CategoriesService(this.httpClient));
|
|
686
|
+
return this._categories;
|
|
687
|
+
}
|
|
503
688
|
setApiKey(key) {
|
|
504
689
|
if (!key || key.trim().length === 0) {
|
|
505
690
|
throw new Error("apiKey must be a non-empty string");
|
|
@@ -539,6 +724,30 @@ async function firstPage(fetcher, options) {
|
|
|
539
724
|
return fetcher({ ...options ?? {} });
|
|
540
725
|
}
|
|
541
726
|
|
|
727
|
+
// src/types/properties.ts
|
|
728
|
+
var PROPERTY_MODULES = [
|
|
729
|
+
"booking",
|
|
730
|
+
"concierge",
|
|
731
|
+
"intelligence",
|
|
732
|
+
"revenue",
|
|
733
|
+
"housekeeping",
|
|
734
|
+
"nightAudit",
|
|
735
|
+
"distribution",
|
|
736
|
+
"fiscal",
|
|
737
|
+
"pos"
|
|
738
|
+
];
|
|
739
|
+
var DEFAULT_MODULES = {
|
|
740
|
+
booking: false,
|
|
741
|
+
concierge: false,
|
|
742
|
+
intelligence: false,
|
|
743
|
+
revenue: false,
|
|
744
|
+
housekeeping: false,
|
|
745
|
+
nightAudit: false,
|
|
746
|
+
distribution: false,
|
|
747
|
+
fiscal: false,
|
|
748
|
+
pos: false
|
|
749
|
+
};
|
|
750
|
+
|
|
542
751
|
// src/index.ts
|
|
543
752
|
var VERSION = "0.1.0";
|
|
544
753
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -546,11 +755,15 @@ var VERSION = "0.1.0";
|
|
|
546
755
|
AuthenticationError,
|
|
547
756
|
BookingClient,
|
|
548
757
|
BookingError,
|
|
758
|
+
CategoriesService,
|
|
549
759
|
ConflictError,
|
|
760
|
+
DEFAULT_MODULES,
|
|
550
761
|
ForbiddenError,
|
|
551
762
|
HttpClient,
|
|
552
763
|
NotFoundError,
|
|
764
|
+
PROPERTY_MODULES,
|
|
553
765
|
PaymentError,
|
|
766
|
+
PropertiesService,
|
|
554
767
|
RateLimitError,
|
|
555
768
|
ServerError,
|
|
556
769
|
TimeoutError,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/errors.ts","../src/http.ts","../src/client.ts","../src/pagination.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\";\nexport type {\n HttpClientOptions,\n HttpMethod,\n HttpResponse,\n RequestOptions,\n} from \"./types/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 type { Logger, RetryConfig, RetryOptions } from \"./types/config.js\";\n\nexport { firstPage, paginate } from \"./pagination.js\";\nexport type {\n PageFetcher,\n Paginated,\n PaginationOptions,\n} from \"./types/pagination.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","// BookingClient — primary public entry point for @atzentis/booking-sdk\n\nimport { type BookingClientConfig, bookingClientConfigSchema } from \"./config.js\";\nimport { HttpClient } from \"./http.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\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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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,E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F;AAAA,IACF;AAAA,EACF;AACF;AAUA,eAAsB,UACpB,SACA,SACuB;AACvB,SAAO,QAAQ,EAAE,GAAI,WAAW,CAAC,EAAG,CAAC;AACvC;;;ALvDO,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/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,Q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