@zimmerstack/connect 0.4.0 → 0.5.0

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.
@@ -1,4 +1,4 @@
1
- import { type AvailabilityWrite, type BatchStatus, type Booking, type BookingCancel, type BookingCreate, type Catalog, type ChannelBooking, type DirectBookingCancel, type DirectBookingCancelResult, type ModifierResult, type OperationKey, type Operations, type RatePlansUpsert, type RatesResendAccepted, type RatesWrite, type RestrictionsWrite, type RoomTypesUpsert, type SandboxBookingCreate, type SandboxBookingModify, type WriteAccepted } from "./generated.js";
1
+ import { type AvailabilityWrite, type BatchStatus, type Booking, type BookingCancel, type BookingCreate, type Catalog, type CatalogDeleteResult, type CatalogUpsertResult, type ChannelBooking, type DirectBookingCancel, type DirectBookingCancelResult, type ModifierResult, type OperationKey, type Operations, type PropertyCreate, type PropertyCreated, type PropertyRemoved, type RatePlansUpsert, type RatesResendAccepted, type RatesWrite, type RestrictionsWrite, type RoomTypesUpsert, type SandboxBookingCreate, type SandboxBookingModify, type WriteAccepted } from "./generated.js";
2
2
  import { type Grid, type GridEdits, type ModifierStep } from "./grid.js";
3
3
  export interface ZimmerStackOptions {
4
4
  /**
@@ -12,7 +12,7 @@ export interface ZimmerStackOptions {
12
12
  baseUrl?: string;
13
13
  /** A replacement for the global `fetch`, for tests. */
14
14
  fetch?: typeof fetch;
15
- /** How long one attempt may take. Default 30 s. */
15
+ /** How long one attempt may take. Default 30 s. Adding a hotel and removing one are given at least 95 s. */
16
16
  timeoutMs?: number;
17
17
  /** How many times a request that may pass later is sent again. Default 3 (four attempts in all), at most 5. */
18
18
  maxRetries?: number;
@@ -56,6 +56,18 @@ export interface WriteOptions {
56
56
  export interface ReadOptions {
57
57
  signal?: AbortSignal;
58
58
  }
59
+ /** One room type, as `zs.roomTypes.save` takes it. */
60
+ export type RoomTypeInput = RoomTypesUpsert["roomTypes"][number];
61
+ /** One rate plan, as `zs.ratePlans.save` takes it. */
62
+ export type RatePlanInput = RatePlansUpsert["ratePlans"][number];
63
+ /**
64
+ * What saving one room type or one rate plan answers: its ZimmerStack `id`, what was done (`action`),
65
+ * how far it has travelled (`sync`), anything to know (`notice`), and where the hotel stands on its
66
+ * channels after the save (`channelManager`).
67
+ */
68
+ export type StructureSaved = CatalogUpsertResult["items"][number] & {
69
+ channelManager: CatalogUpsertResult["channelManager"];
70
+ };
59
71
  type Op<K extends OperationKey> = Operations[K];
60
72
  /** What `request` takes for an operation: its path values, its query, its body. */
61
73
  export type RequestArgs<K extends OperationKey> = (Op<K>["path"] extends undefined ? {
@@ -71,6 +83,8 @@ export type RequestArgs<K extends OperationKey> = (Op<K>["path"] extends undefin
71
83
  } : {
72
84
  body: Op<K>["body"];
73
85
  }) & WriteOptions;
86
+ /** How long one attempt of an operation may take: the client's `timeoutMs`, or longer for the slow ones above. */
87
+ export declare function attemptTimeoutMs(operation: string, timeoutMs: number): number;
74
88
  /**
75
89
  * The ZimmerStack Connect API, from your server.
76
90
  *
@@ -115,6 +129,61 @@ export declare class ZimmerStack {
115
129
  readonly properties: {
116
130
  /** The hotels this key may act on. A company key names one of them on every other call (`forProperty`). */
117
131
  list: (options?: ReadOptions) => Promise<import("./generated.js").Properties>;
132
+ /**
133
+ * Add a hotel. Only a software partner's COMPANY key that holds the scope properties:write can; tick
134
+ * "Also add and remove hotels" when you make the key in the partner portal. A hotel's own key is refused.
135
+ *
136
+ * The answer's `id` is the hotel: act on it with `zs.forProperty(id)`. Its owner gets the sign-in details
137
+ * by email; they are never sent to you. `billing.state` says whether it is on your invoice yet, and
138
+ * `channelManager` turns true with your first `roomTypes.save` or `catalog.upsertRoomTypes` for it.
139
+ *
140
+ * With a test key (zsk_test_) the same call makes a sandbox instead: a practice hotel no booking site
141
+ * sees, never billed. Safe to retry: the same `idempotencyKey` answers with the same hotel and
142
+ * `replay: true`, and never makes a second one.
143
+ *
144
+ * @example
145
+ * const hotel = await zs.properties.create({
146
+ * name: "Sea Breeze Apartments",
147
+ * owner: { name: "Nimal Perera", email: "nimal@seabreeze.example", phone: "+94 77 123 4567" },
148
+ * address: { line1: "12 Beach Road", city: "Galle", country: "LK" },
149
+ * roomTypes: [{ ref: "deluxe", name: "Deluxe Room", roomCount: 6, defaultRate: "90.00" }],
150
+ * });
151
+ * const seaBreeze = zs.forProperty(hotel.id);
152
+ */
153
+ create: (hotel: PropertyCreate, options?: WriteOptions) => Promise<PropertyCreated>;
154
+ /**
155
+ * Remove a hotel YOU ADDED, for good. A company key with the scope properties:write.
156
+ *
157
+ * One call does what ZimmerStack does when a hotel's service ends, in this order: its booking sites
158
+ * are disconnected, its rate plans are removed from the channel manager, then its room types, then the
159
+ * hotel is closed (its owner can no longer sign in, and no key reaches it). It comes off your invoice
160
+ * from the next 1st; the month already billed is not refunded. Bookings already made stay with the
161
+ * booking sites and the hotel.
162
+ *
163
+ * THERE IS NO UNDO. Call it when a person chose to remove that hotel; never from a loop, a timer or a
164
+ * sync job. `confirm` is the hotel's exact name, as `zs.properties.list()` prints it, so a wrong id never
165
+ * removes a hotel. Move the hotel's booking sites to its next channel manager first, so it keeps selling.
166
+ *
167
+ * The answer: `channelManager.state` is REMOVED when nothing is left on the channel manager, or
168
+ * RETRYING when the hotel is closed and off your bill but one step there is still finishing (ZimmerStack
169
+ * retries it; you do nothing). Calling it again later answers `replay: true`. A hotel you did not add,
170
+ * or one that uses more than the channel manager, is refused with PROPERTY_NOT_REMOVABLE and who can do
171
+ * it. With a test key it deletes a sandbox.
172
+ *
173
+ * @example
174
+ * const { properties } = await zs.properties.list();
175
+ * const hotel = properties.find((p) => p.id === 61);
176
+ * if (hotel) await zs.properties.delete(hotel.id, { confirm: hotel.name });
177
+ */
178
+ delete: (propertyId: number, options: {
179
+ confirm: string;
180
+ signal?: AbortSignal;
181
+ }) => Promise<PropertyRemoved>;
182
+ /** The same as `delete`, under the word the partner portal uses ("Remove hotel"). */
183
+ remove: (propertyId: number, options: {
184
+ confirm: string;
185
+ signal?: AbortSignal;
186
+ }) => Promise<PropertyRemoved>;
118
187
  };
119
188
  readonly property: {
120
189
  /** The hotel: its timezone and currency, what this key may do, its own limits, what it has used, where it stands. */
@@ -124,12 +193,72 @@ export declare class ZimmerStack {
124
193
  /** Room types and rate plans, with the numeric ids every write uses. */
125
194
  get: (options?: ReadOptions) => Promise<Catalog>;
126
195
  /** Create or change room types by your own `ref`. Needs the scope catalog:write. */
127
- upsertRoomTypes: (body: RoomTypesUpsert, options?: WriteOptions) => Promise<import("./generated.js").CatalogUpsertResult>;
196
+ upsertRoomTypes: (body: RoomTypesUpsert, options?: WriteOptions) => Promise<CatalogUpsertResult>;
128
197
  /** Delete a room type; its rate plans go with it. */
129
- deleteRoomType: (roomTypeId: number, options?: ReadOptions) => Promise<import("./generated.js").CatalogDeleteResult>;
198
+ deleteRoomType: (roomTypeId: number, options?: ReadOptions) => Promise<CatalogDeleteResult>;
130
199
  /** Create or change rate plans by your own `ref`. */
131
- upsertRatePlans: (body: RatePlansUpsert, options?: WriteOptions) => Promise<import("./generated.js").CatalogUpsertResult>;
132
- deleteRatePlan: (ratePlanId: number, options?: ReadOptions) => Promise<import("./generated.js").CatalogDeleteResult>;
200
+ upsertRatePlans: (body: RatePlansUpsert, options?: WriteOptions) => Promise<CatalogUpsertResult>;
201
+ /** Delete a rate plan. Refused while a channel still sells it. */
202
+ deleteRatePlan: (ratePlanId: number, options?: ReadOptions) => Promise<CatalogDeleteResult>;
203
+ };
204
+ readonly roomTypes: {
205
+ /** Every room type of the hotel, each with the numeric `id` that room counts and bookings name. */
206
+ list: (options?: ReadOptions) => Promise<Catalog["roomTypes"]>;
207
+ /**
208
+ * Create a room type, or change it if you sent this `ref` before. `ref` is your own id for it; the
209
+ * answer's `id` is ZimmerStack's, the one every later call names. Needs the scope catalog:write.
210
+ * To send several in one request use `catalog.upsertRoomTypes`.
211
+ *
212
+ * @example
213
+ * const room = await zs.roomTypes.save({ ref: "deluxe", name: "Deluxe Room", roomCount: 8, adults: 2 });
214
+ * room.id; // use it in availability.set and in a rate plan's roomTypeId
215
+ */
216
+ save: (roomType: RoomTypeInput, options?: WriteOptions) => Promise<StructureSaved>;
217
+ /**
218
+ * Delete a room type for good, by its `id` (a number) or by your own `ref` (a string). Its rate
219
+ * plans are deleted with it; the answer's `deletedRatePlanIds` names them. Needs the scope
220
+ * catalog:write.
221
+ *
222
+ * THERE IS NO UNDO. Call it when a person chose to delete; never from a loop, a timer or a sync job.
223
+ * It is refused while a booking site still sells one of its rate plans (unmap the plan on the
224
+ * channel first), while an upcoming stay holds one of its rooms, or while rooms are still assigned
225
+ * to it on a hotel that runs the ZimmerStack PMS: CATALOG_CONFLICT, or CHANNEL_MANAGER_ERROR when
226
+ * the refusal is the channel manager's. Show the message; nothing was deleted. Deletes have a daily
227
+ * budget per hotel (RATE_LIMITED, scope structure-deletes-day).
228
+ *
229
+ * @example
230
+ * await zs.roomTypes.delete("deluxe"); // by your ref
231
+ * await zs.roomTypes.delete(412); // by ZimmerStack's id
232
+ */
233
+ delete: (idOrRef: number | string, options?: ReadOptions) => Promise<CatalogDeleteResult>;
234
+ };
235
+ readonly ratePlans: {
236
+ /** Every rate plan of the hotel, each with the numeric `id` that prices and stay rules name. */
237
+ list: (options?: ReadOptions) => Promise<Catalog["ratePlans"]>;
238
+ /**
239
+ * Create a rate plan, or change it if you sent this `ref` before. Name its room type by
240
+ * `roomTypeRef` (the ref you gave the room type) or by `roomTypeId`. `defaultRate` is its standing
241
+ * price in major units (4500 = 4,500.00). Needs the scope catalog:write. To send several in one
242
+ * request use `catalog.upsertRatePlans`.
243
+ *
244
+ * @example
245
+ * const plan = await zs.ratePlans.save({ ref: "deluxe-bb", roomTypeRef: "deluxe", name: "Bed and breakfast", mealPlan: "CP", defaultRate: 4500 });
246
+ * plan.id; // use it in rates.set and restrictions.set
247
+ */
248
+ save: (ratePlan: RatePlanInput, options?: WriteOptions) => Promise<StructureSaved>;
249
+ /**
250
+ * Delete a rate plan for good, by its `id` (a number) or by your own `ref` (a string). Needs the
251
+ * scope catalog:write.
252
+ *
253
+ * THERE IS NO UNDO. Call it when a person chose to delete; never from a loop, a timer or a sync job.
254
+ * It is refused with CATALOG_CONFLICT while a booking site still sells the plan: unmap it on the
255
+ * channel first. Deletes have a daily budget per hotel (RATE_LIMITED, scope structure-deletes-day).
256
+ *
257
+ * @example
258
+ * await zs.ratePlans.delete("deluxe-bb"); // by your ref
259
+ * await zs.ratePlans.delete(901); // by ZimmerStack's id
260
+ */
261
+ delete: (idOrRef: number | string, options?: ReadOptions) => Promise<CatalogDeleteResult>;
133
262
  };
134
263
  readonly availability: {
135
264
  /** Rooms left to sell per room type per night, as ZimmerStack's record holds them. Up to 500 days. */
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZimmerStack = void 0;
4
+ exports.attemptTimeoutMs = attemptTimeoutMs;
4
5
  const errors_ts_1 = require("./errors.js");
5
6
  const generated_ts_1 = require("./generated.js");
6
7
  const grid_ts_1 = require("./grid.js");
8
+ /** One entity was sent, so the answer names exactly one. */
9
+ function savedOne(result) {
10
+ const item = result.items[0];
11
+ if (!item)
12
+ throw new Error("ZimmerStack's answer named no entity for this save. Read zs.catalog.get() to see what the hotel holds before sending it again.");
13
+ return { ...item, channelManager: result.channelManager };
14
+ }
7
15
  /* ───────────────────────────── the shared core ───────────────────────────── */
8
16
  /** Requests in flight at once. Writes go one at a time on top of that. */
9
17
  const PARALLEL = 4;
@@ -49,6 +57,20 @@ function resolveBase(baseUrl) {
49
57
  }
50
58
  return url.origin;
51
59
  }
60
+ /**
61
+ * Operations that do a long thing while you wait: adding a hotel creates its account, and removing one takes
62
+ * it off its booking sites one step at a time. One attempt of these is given at least this long, however
63
+ * short `timeoutMs` is, because giving up early leaves you not knowing whether a hotel was added or removed.
64
+ * (The API's own edge answers within 100 s.)
65
+ */
66
+ const PATIENCE_MS = {
67
+ "POST /properties": 95_000,
68
+ "DELETE /properties/{propertyId}": 95_000,
69
+ };
70
+ /** How long one attempt of an operation may take: the client's `timeoutMs`, or longer for the slow ones above. */
71
+ function attemptTimeoutMs(operation, timeoutMs) {
72
+ return Math.max(timeoutMs, PATIENCE_MS[operation] ?? 0);
73
+ }
52
74
  class Core {
53
75
  #key;
54
76
  mode;
@@ -182,7 +204,7 @@ class Core {
182
204
  let res;
183
205
  let json;
184
206
  try {
185
- const timeout = AbortSignal.timeout(this.#timeoutMs);
207
+ const timeout = AbortSignal.timeout(attemptTimeoutMs(wire.operation, this.#timeoutMs));
186
208
  res = await this.#fetch(wire.url, {
187
209
  method: wire.method,
188
210
  headers: wire.headers,
@@ -337,7 +359,10 @@ class ZimmerStack {
337
359
  if (value !== undefined && value !== null)
338
360
  url.searchParams.set(name, String(value));
339
361
  const headers = { authorization: this.#core.authorization(), accept: "application/json", "user-agent": `zimmerstack-connect-node/${generated_ts_1.SDK_VERSION}` };
340
- const hotel = this.propertyId ?? (operation === "GET /properties" ? undefined : this.#core.soleSandboxId);
362
+ // Adding a hotel and removing one name no hotel in the header: the one to add does not exist yet, and the
363
+ // one to remove is in the path. Listing them sends the header only when this client was made for one hotel.
364
+ const aboutTheList = operation === "POST /properties" || operation === "DELETE /properties/{propertyId}";
365
+ const hotel = aboutTheList ? undefined : (this.propertyId ?? (operation === "GET /properties" ? undefined : this.#core.soleSandboxId));
341
366
  if (hotel)
342
367
  headers[generated_ts_1.PROPERTY_HEADER] = String(hotel);
343
368
  const body = args.body === undefined ? undefined : JSON.stringify(args.body);
@@ -396,7 +421,78 @@ class ZimmerStack {
396
421
  properties = {
397
422
  /** The hotels this key may act on. A company key names one of them on every other call (`forProperty`). */
398
423
  list: (options) => this.request("GET /properties", options),
424
+ /**
425
+ * Add a hotel. Only a software partner's COMPANY key that holds the scope properties:write can; tick
426
+ * "Also add and remove hotels" when you make the key in the partner portal. A hotel's own key is refused.
427
+ *
428
+ * The answer's `id` is the hotel: act on it with `zs.forProperty(id)`. Its owner gets the sign-in details
429
+ * by email; they are never sent to you. `billing.state` says whether it is on your invoice yet, and
430
+ * `channelManager` turns true with your first `roomTypes.save` or `catalog.upsertRoomTypes` for it.
431
+ *
432
+ * With a test key (zsk_test_) the same call makes a sandbox instead: a practice hotel no booking site
433
+ * sees, never billed. Safe to retry: the same `idempotencyKey` answers with the same hotel and
434
+ * `replay: true`, and never makes a second one.
435
+ *
436
+ * @example
437
+ * const hotel = await zs.properties.create({
438
+ * name: "Sea Breeze Apartments",
439
+ * owner: { name: "Nimal Perera", email: "nimal@seabreeze.example", phone: "+94 77 123 4567" },
440
+ * address: { line1: "12 Beach Road", city: "Galle", country: "LK" },
441
+ * roomTypes: [{ ref: "deluxe", name: "Deluxe Room", roomCount: 6, defaultRate: "90.00" }],
442
+ * });
443
+ * const seaBreeze = zs.forProperty(hotel.id);
444
+ */
445
+ create: async (hotel, options) => {
446
+ const created = await this.request("POST /properties", { body: hotel, ...options });
447
+ this.#forgetWhichHotels();
448
+ return created;
449
+ },
450
+ /**
451
+ * Remove a hotel YOU ADDED, for good. A company key with the scope properties:write.
452
+ *
453
+ * One call does what ZimmerStack does when a hotel's service ends, in this order: its booking sites
454
+ * are disconnected, its rate plans are removed from the channel manager, then its room types, then the
455
+ * hotel is closed (its owner can no longer sign in, and no key reaches it). It comes off your invoice
456
+ * from the next 1st; the month already billed is not refunded. Bookings already made stay with the
457
+ * booking sites and the hotel.
458
+ *
459
+ * THERE IS NO UNDO. Call it when a person chose to remove that hotel; never from a loop, a timer or a
460
+ * sync job. `confirm` is the hotel's exact name, as `zs.properties.list()` prints it, so a wrong id never
461
+ * removes a hotel. Move the hotel's booking sites to its next channel manager first, so it keeps selling.
462
+ *
463
+ * The answer: `channelManager.state` is REMOVED when nothing is left on the channel manager, or
464
+ * RETRYING when the hotel is closed and off your bill but one step there is still finishing (ZimmerStack
465
+ * retries it; you do nothing). Calling it again later answers `replay: true`. A hotel you did not add,
466
+ * or one that uses more than the channel manager, is refused with PROPERTY_NOT_REMOVABLE and who can do
467
+ * it. With a test key it deletes a sandbox.
468
+ *
469
+ * @example
470
+ * const { properties } = await zs.properties.list();
471
+ * const hotel = properties.find((p) => p.id === 61);
472
+ * if (hotel) await zs.properties.delete(hotel.id, { confirm: hotel.name });
473
+ */
474
+ delete: (propertyId, options) => this.#removeProperty(propertyId, options),
475
+ /** The same as `delete`, under the word the partner portal uses ("Remove hotel"). */
476
+ remove: (propertyId, options) => this.#removeProperty(propertyId, options),
399
477
  };
478
+ async #removeProperty(propertyId, options) {
479
+ if (!Number.isInteger(propertyId) || propertyId <= 0) {
480
+ throw new errors_ts_1.ZimmerStackUsageError("zs.properties.delete needs the hotel's numeric id (zs.properties.list() names them)");
481
+ }
482
+ const confirm = typeof options?.confirm === "string" ? options.confirm.trim() : "";
483
+ if (!confirm) {
484
+ throw new errors_ts_1.ZimmerStackUsageError("zs.properties.delete needs { confirm: <the hotel's exact name> }, as zs.properties.list() prints it. Removing a hotel cannot be undone, so the name is asked for.");
485
+ }
486
+ const removed = await this.request("DELETE /properties/{propertyId}", { path: { propertyId }, query: { confirm }, signal: options.signal });
487
+ this.#core.catalogs.delete(propertyId);
488
+ this.#forgetWhichHotels();
489
+ return removed;
490
+ }
491
+ /** The hotels this key reaches just changed: the one sandbox a test key was assumed to act on is looked up afresh. */
492
+ #forgetWhichHotels() {
493
+ this.#core.soleSandboxProperty = undefined;
494
+ this.#core.soleSandboxId = undefined;
495
+ }
400
496
  property = {
401
497
  /** The hotel: its timezone and currency, what this key may do, its own limits, what it has used, where it stands. */
402
498
  get: (options) => this.request("GET /property", options),
@@ -415,8 +511,90 @@ class ZimmerStack {
415
511
  deleteRoomType: (roomTypeId, options) => this.#structure("DELETE /catalog/room-types/{roomTypeId}", { path: { roomTypeId }, ...options }),
416
512
  /** Create or change rate plans by your own `ref`. */
417
513
  upsertRatePlans: (body, options) => this.#structure("PUT /catalog/rate-plans", { body, ...options }),
514
+ /** Delete a rate plan. Refused while a channel still sells it. */
418
515
  deleteRatePlan: (ratePlanId, options) => this.#structure("DELETE /catalog/rate-plans/{ratePlanId}", { path: { ratePlanId }, ...options }),
419
516
  };
517
+ /* ── the same room types and rate plans, one at a time, under the names you would look for ── */
518
+ roomTypes = {
519
+ /** Every room type of the hotel, each with the numeric `id` that room counts and bookings name. */
520
+ list: async (options) => (await this.catalog.get(options)).roomTypes,
521
+ /**
522
+ * Create a room type, or change it if you sent this `ref` before. `ref` is your own id for it; the
523
+ * answer's `id` is ZimmerStack's, the one every later call names. Needs the scope catalog:write.
524
+ * To send several in one request use `catalog.upsertRoomTypes`.
525
+ *
526
+ * @example
527
+ * const room = await zs.roomTypes.save({ ref: "deluxe", name: "Deluxe Room", roomCount: 8, adults: 2 });
528
+ * room.id; // use it in availability.set and in a rate plan's roomTypeId
529
+ */
530
+ save: async (roomType, options) => savedOne(await this.catalog.upsertRoomTypes({ roomTypes: [roomType] }, options)),
531
+ /**
532
+ * Delete a room type for good, by its `id` (a number) or by your own `ref` (a string). Its rate
533
+ * plans are deleted with it; the answer's `deletedRatePlanIds` names them. Needs the scope
534
+ * catalog:write.
535
+ *
536
+ * THERE IS NO UNDO. Call it when a person chose to delete; never from a loop, a timer or a sync job.
537
+ * It is refused while a booking site still sells one of its rate plans (unmap the plan on the
538
+ * channel first), while an upcoming stay holds one of its rooms, or while rooms are still assigned
539
+ * to it on a hotel that runs the ZimmerStack PMS: CATALOG_CONFLICT, or CHANNEL_MANAGER_ERROR when
540
+ * the refusal is the channel manager's. Show the message; nothing was deleted. Deletes have a daily
541
+ * budget per hotel (RATE_LIMITED, scope structure-deletes-day).
542
+ *
543
+ * @example
544
+ * await zs.roomTypes.delete("deluxe"); // by your ref
545
+ * await zs.roomTypes.delete(412); // by ZimmerStack's id
546
+ */
547
+ delete: async (idOrRef, options) => this.catalog.deleteRoomType(await this.#structureId("roomTypes", idOrRef, options?.signal), options),
548
+ };
549
+ ratePlans = {
550
+ /** Every rate plan of the hotel, each with the numeric `id` that prices and stay rules name. */
551
+ list: async (options) => (await this.catalog.get(options)).ratePlans,
552
+ /**
553
+ * Create a rate plan, or change it if you sent this `ref` before. Name its room type by
554
+ * `roomTypeRef` (the ref you gave the room type) or by `roomTypeId`. `defaultRate` is its standing
555
+ * price in major units (4500 = 4,500.00). Needs the scope catalog:write. To send several in one
556
+ * request use `catalog.upsertRatePlans`.
557
+ *
558
+ * @example
559
+ * const plan = await zs.ratePlans.save({ ref: "deluxe-bb", roomTypeRef: "deluxe", name: "Bed and breakfast", mealPlan: "CP", defaultRate: 4500 });
560
+ * plan.id; // use it in rates.set and restrictions.set
561
+ */
562
+ save: async (ratePlan, options) => savedOne(await this.catalog.upsertRatePlans({ ratePlans: [ratePlan] }, options)),
563
+ /**
564
+ * Delete a rate plan for good, by its `id` (a number) or by your own `ref` (a string). Needs the
565
+ * scope catalog:write.
566
+ *
567
+ * THERE IS NO UNDO. Call it when a person chose to delete; never from a loop, a timer or a sync job.
568
+ * It is refused with CATALOG_CONFLICT while a booking site still sells the plan: unmap it on the
569
+ * channel first. Deletes have a daily budget per hotel (RATE_LIMITED, scope structure-deletes-day).
570
+ *
571
+ * @example
572
+ * await zs.ratePlans.delete("deluxe-bb"); // by your ref
573
+ * await zs.ratePlans.delete(901); // by ZimmerStack's id
574
+ */
575
+ delete: async (idOrRef, options) => this.catalog.deleteRatePlan(await this.#structureId("ratePlans", idOrRef, options?.signal), options),
576
+ };
577
+ /**
578
+ * The id a delete acts on. A number is ZimmerStack's id already. A string is your own `ref`: it is
579
+ * looked up in a fresh read of the catalog, never a kept copy, because a delete must act on what
580
+ * exists now.
581
+ */
582
+ async #structureId(kind, idOrRef, signal) {
583
+ const what = kind === "roomTypes" ? "room type" : "rate plan";
584
+ if (typeof idOrRef === "number") {
585
+ if (!Number.isInteger(idOrRef) || idOrRef <= 0)
586
+ throw new errors_ts_1.ZimmerStackUsageError(`A ${what}'s id is a whole number above 0; zs.${kind}.list() names them`);
587
+ return idOrRef;
588
+ }
589
+ if (typeof idOrRef !== "string" || idOrRef.trim() === "") {
590
+ throw new errors_ts_1.ZimmerStackUsageError(`zs.${kind}.delete takes the ${what}'s id (a number) or your own ref for it (a string)`);
591
+ }
592
+ const hit = (await this.catalog.get({ signal }))[kind].find((entity) => entity.ref === idOrRef);
593
+ if (!hit) {
594
+ throw new errors_ts_1.ZimmerStackUsageError(`This hotel has no ${what} with the ref "${idOrRef}". zs.${kind}.list() names every one with its id and ref; a ${what} made on ZimmerStack's own screens has no ref, so delete it by its id.`);
595
+ }
596
+ return hit.id;
597
+ }
420
598
  async #structure(operation, args) {
421
599
  try {
422
600
  return await this.request(operation, ...[args]);
@@ -1,5 +1,5 @@
1
1
  /** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
2
- export declare const SDK_VERSION = "0.4.0";
2
+ export declare const SDK_VERSION = "0.5.0";
3
3
  /** Where the API lives. The key is sent nowhere else. */
4
4
  export declare const API_ORIGIN = "https://api.zimmerstack.com";
5
5
  export declare const API_PREFIX = "/api/v1/connect-api/v1";
@@ -27,10 +27,10 @@ export declare const LIMITS: {
27
27
  readonly maxNightsPerBooking: 90;
28
28
  };
29
29
  /** Every stable error code (`error.code`). Messages are for people and may change; branch on these. */
30
- export declare const ERROR_CODES: readonly ["API_KEY_INVALID", "API_KEY_REVOKED", "API_KEY_EXPIRED", "CONNECT_API_NOT_CONFIGURED", "IP_NOT_ALLOWED", "SCOPE_MISSING", "PROPERTY_UNAVAILABLE", "CHANNEL_MANAGER_DISABLED", "PMS_NOT_AVAILABLE", "VALIDATION", "RANGE_INVALID", "HORIZON", "TOO_MANY_UPDATES", "TOO_MANY_CELLS", "UNKNOWN_ROOM_TYPE", "UNKNOWN_RATE_PLAN", "CURRENCY_MISMATCH", "RATE_LIMITED", "NOTHING_ACCEPTED", "BATCH_NOT_FOUND", "IDEMPOTENCY_KEY_INVALID", "IDEMPOTENCY_KEY_REUSED", "IDEMPOTENCY_IN_FLIGHT", "STAY_INVALID", "UNKNOWN_ROOM_TYPE_FOR_PLAN", "OCCUPANCY_EXCEEDED", "NO_AVAILABILITY", "EXTERNAL_REFERENCE_REUSED", "PAYMENT_NOT_ALLOWED", "PAYMENT_EXCEEDS_TOTAL", "BOOKING_NOT_FOUND", "BOOKING_NOT_CANCELLABLE", "MODULE_NOT_ENTITLED", "SANDBOX_ONLY", "ROOM_TYPE_NOT_FOUND", "RATE_PLAN_NOT_FOUND", "CATALOG_CONFLICT", "CATALOG_BUSY", "CHANNEL_MANAGER_ERROR", "PROPERTY_REQUIRED", "PROPERTY_NOT_FOUND", "ARI_NOT_AUTHORITATIVE", "ROUTE_NOT_FOUND", "PAYLOAD_TOO_LARGE", "AUTH_BACKEND_UNAVAILABLE", "BOOKING_NOT_MODIFIABLE", "SANDBOX_NOT_FOUND", "SANDBOX_INCOMPLETE", "WRITES_FROZEN", "WRITES_SUSPENDED", "SHIELD_UNAVAILABLE", "CATALOG_LIMIT_REACHED", "TOO_MANY_NEW_ENTITIES", "RATE_OUT_OF_BAND", "CHANNEL_NOT_FOUND", "CHANNEL_SHARED", "MODIFIER_OUT_OF_BAND"];
30
+ export declare const ERROR_CODES: readonly ["API_KEY_INVALID", "API_KEY_REVOKED", "API_KEY_EXPIRED", "CONNECT_API_NOT_CONFIGURED", "IP_NOT_ALLOWED", "SCOPE_MISSING", "PROPERTY_UNAVAILABLE", "CHANNEL_MANAGER_DISABLED", "PMS_NOT_AVAILABLE", "VALIDATION", "RANGE_INVALID", "HORIZON", "TOO_MANY_UPDATES", "TOO_MANY_CELLS", "UNKNOWN_ROOM_TYPE", "UNKNOWN_RATE_PLAN", "CURRENCY_MISMATCH", "RATE_LIMITED", "NOTHING_ACCEPTED", "BATCH_NOT_FOUND", "IDEMPOTENCY_KEY_INVALID", "IDEMPOTENCY_KEY_REUSED", "IDEMPOTENCY_IN_FLIGHT", "STAY_INVALID", "UNKNOWN_ROOM_TYPE_FOR_PLAN", "OCCUPANCY_EXCEEDED", "NO_AVAILABILITY", "EXTERNAL_REFERENCE_REUSED", "PAYMENT_NOT_ALLOWED", "PAYMENT_EXCEEDS_TOTAL", "BOOKING_NOT_FOUND", "BOOKING_NOT_CANCELLABLE", "MODULE_NOT_ENTITLED", "SANDBOX_ONLY", "ROOM_TYPE_NOT_FOUND", "RATE_PLAN_NOT_FOUND", "CATALOG_CONFLICT", "CATALOG_BUSY", "CHANNEL_MANAGER_ERROR", "PROPERTY_REQUIRED", "PROPERTY_NOT_FOUND", "ARI_NOT_AUTHORITATIVE", "ROUTE_NOT_FOUND", "PAYLOAD_TOO_LARGE", "AUTH_BACKEND_UNAVAILABLE", "BOOKING_NOT_MODIFIABLE", "SANDBOX_NOT_FOUND", "SANDBOX_INCOMPLETE", "WRITES_FROZEN", "WRITES_SUSPENDED", "SHIELD_UNAVAILABLE", "CATALOG_LIMIT_REACHED", "TOO_MANY_NEW_ENTITIES", "RATE_OUT_OF_BAND", "CHANNEL_NOT_FOUND", "CHANNEL_SHARED", "MODIFIER_OUT_OF_BAND", "COMPANY_KEY_REQUIRED", "BILLING_SETUP_REQUIRED", "OWNER_HAS_ACCOUNT", "SANDBOX_LIMIT", "CONFIRMATION_MISMATCH", "PROPERTY_NOT_REMOVABLE", "PROPERTY_BUSY", "PRICE_UNAVAILABLE"];
31
31
  export type ErrorCode = (typeof ERROR_CODES)[number];
32
32
  /** What a key may do. The hotel's owner (or, for a vendor's key, the vendor) chose them when the key was made. */
33
- export declare const SCOPES: readonly ["ari:read", "ari:write", "catalog:write", "channel-modifiers:write", "channel-bookings:read", "direct-bookings:read", "direct-bookings:cancel", "bookings:read", "bookings:write", "bookings:payments"];
33
+ export declare const SCOPES: readonly ["ari:read", "ari:write", "catalog:write", "channel-modifiers:write", "channel-bookings:read", "direct-bookings:read", "direct-bookings:cancel", "bookings:read", "bookings:write", "bookings:payments", "properties:write"];
34
34
  export type Scope = (typeof SCOPES)[number];
35
35
  /** When a channel's price modifier takes effect. Show it where a person saves one. */
36
36
  export declare const MODIFIER_TAKES_EFFECT = "A modifier applies to prices sent to the channel after the change. Prices already on the channel stay as they are until those nights are sent again.";
@@ -39,7 +39,7 @@ export interface Error {
39
39
  /** Human-readable, may change; branch on data.code */
40
40
  message: string;
41
41
  data: {
42
- code: "API_KEY_INVALID" | "API_KEY_REVOKED" | "API_KEY_EXPIRED" | "CONNECT_API_NOT_CONFIGURED" | "IP_NOT_ALLOWED" | "SCOPE_MISSING" | "PROPERTY_UNAVAILABLE" | "CHANNEL_MANAGER_DISABLED" | "PMS_NOT_AVAILABLE" | "VALIDATION" | "RANGE_INVALID" | "HORIZON" | "TOO_MANY_UPDATES" | "TOO_MANY_CELLS" | "UNKNOWN_ROOM_TYPE" | "UNKNOWN_RATE_PLAN" | "CURRENCY_MISMATCH" | "RATE_LIMITED" | "NOTHING_ACCEPTED" | "BATCH_NOT_FOUND" | "IDEMPOTENCY_KEY_INVALID" | "IDEMPOTENCY_KEY_REUSED" | "IDEMPOTENCY_IN_FLIGHT" | "STAY_INVALID" | "UNKNOWN_ROOM_TYPE_FOR_PLAN" | "OCCUPANCY_EXCEEDED" | "NO_AVAILABILITY" | "EXTERNAL_REFERENCE_REUSED" | "PAYMENT_NOT_ALLOWED" | "PAYMENT_EXCEEDS_TOTAL" | "BOOKING_NOT_FOUND" | "BOOKING_NOT_CANCELLABLE" | "MODULE_NOT_ENTITLED" | "SANDBOX_ONLY" | "ROOM_TYPE_NOT_FOUND" | "RATE_PLAN_NOT_FOUND" | "CATALOG_CONFLICT" | "CATALOG_BUSY" | "CHANNEL_MANAGER_ERROR" | "PROPERTY_REQUIRED" | "PROPERTY_NOT_FOUND" | "ARI_NOT_AUTHORITATIVE" | "ROUTE_NOT_FOUND" | "PAYLOAD_TOO_LARGE" | "AUTH_BACKEND_UNAVAILABLE" | "BOOKING_NOT_MODIFIABLE" | "SANDBOX_NOT_FOUND" | "SANDBOX_INCOMPLETE" | "WRITES_FROZEN" | "WRITES_SUSPENDED" | "SHIELD_UNAVAILABLE" | "CATALOG_LIMIT_REACHED" | "TOO_MANY_NEW_ENTITIES" | "RATE_OUT_OF_BAND" | "CHANNEL_NOT_FOUND" | "CHANNEL_SHARED" | "MODIFIER_OUT_OF_BAND";
42
+ code: "API_KEY_INVALID" | "API_KEY_REVOKED" | "API_KEY_EXPIRED" | "CONNECT_API_NOT_CONFIGURED" | "IP_NOT_ALLOWED" | "SCOPE_MISSING" | "PROPERTY_UNAVAILABLE" | "CHANNEL_MANAGER_DISABLED" | "PMS_NOT_AVAILABLE" | "VALIDATION" | "RANGE_INVALID" | "HORIZON" | "TOO_MANY_UPDATES" | "TOO_MANY_CELLS" | "UNKNOWN_ROOM_TYPE" | "UNKNOWN_RATE_PLAN" | "CURRENCY_MISMATCH" | "RATE_LIMITED" | "NOTHING_ACCEPTED" | "BATCH_NOT_FOUND" | "IDEMPOTENCY_KEY_INVALID" | "IDEMPOTENCY_KEY_REUSED" | "IDEMPOTENCY_IN_FLIGHT" | "STAY_INVALID" | "UNKNOWN_ROOM_TYPE_FOR_PLAN" | "OCCUPANCY_EXCEEDED" | "NO_AVAILABILITY" | "EXTERNAL_REFERENCE_REUSED" | "PAYMENT_NOT_ALLOWED" | "PAYMENT_EXCEEDS_TOTAL" | "BOOKING_NOT_FOUND" | "BOOKING_NOT_CANCELLABLE" | "MODULE_NOT_ENTITLED" | "SANDBOX_ONLY" | "ROOM_TYPE_NOT_FOUND" | "RATE_PLAN_NOT_FOUND" | "CATALOG_CONFLICT" | "CATALOG_BUSY" | "CHANNEL_MANAGER_ERROR" | "PROPERTY_REQUIRED" | "PROPERTY_NOT_FOUND" | "ARI_NOT_AUTHORITATIVE" | "ROUTE_NOT_FOUND" | "PAYLOAD_TOO_LARGE" | "AUTH_BACKEND_UNAVAILABLE" | "BOOKING_NOT_MODIFIABLE" | "SANDBOX_NOT_FOUND" | "SANDBOX_INCOMPLETE" | "WRITES_FROZEN" | "WRITES_SUSPENDED" | "SHIELD_UNAVAILABLE" | "CATALOG_LIMIT_REACHED" | "TOO_MANY_NEW_ENTITIES" | "RATE_OUT_OF_BAND" | "CHANNEL_NOT_FOUND" | "CHANNEL_SHARED" | "MODIFIER_OUT_OF_BAND" | "COMPANY_KEY_REQUIRED" | "BILLING_SETUP_REQUIRED" | "OWNER_HAS_ACCOUNT" | "SANDBOX_LIMIT" | "CONFIRMATION_MISMATCH" | "PROPERTY_NOT_REMOVABLE" | "PROPERTY_BUSY" | "PRICE_UNAVAILABLE";
43
43
  details?: unknown;
44
44
  };
45
45
  }
@@ -161,6 +161,97 @@ export interface Properties {
161
161
  sandbox: boolean;
162
162
  }>;
163
163
  }
164
+ export interface PropertyCreate {
165
+ /** The hotel's name, as its guests know it */
166
+ name: string;
167
+ /** The person who owns the hotel's account */
168
+ owner: {
169
+ name: string;
170
+ /** The owner's own address. The sign-in details are sent here, never to you */
171
+ email: string;
172
+ /** Digits, with an optional + and spaces, dots, dashes or brackets */
173
+ phone: string;
174
+ };
175
+ address: {
176
+ line1: string;
177
+ city: string;
178
+ state?: string;
179
+ postalCode?: string;
180
+ /** ISO 3166-1 alpha-2, for example IN, LK, PT */
181
+ country: string;
182
+ };
183
+ /** ISO 4217: what the hotel sells in. Default: the country's own currency. A hotel in India sells in INR */
184
+ currency?: string;
185
+ /** An IANA zone of the hotel's country. Default: the country's main zone */
186
+ timezone?: string;
187
+ /** India only: the hotel's GSTIN when it is registered under GST. Leave it out when it is not, and for a hotel in any other country */
188
+ taxId?: string;
189
+ /** At least one. Each is born with one room-only rate plan at its defaultRate */
190
+ roomTypes: Array<{
191
+ /** Your own id for this room type. Send the same ref to PUT /catalog/room-types later and it updates this one instead of making a second */
192
+ ref?: string;
193
+ /** Shown to the owner and sent to the channel manager as the title; each name once per request */
194
+ name: string;
195
+ /** Sellable rooms of this type */
196
+ roomCount: number;
197
+ /** Most adults one room takes; default 2 */
198
+ adults?: number;
199
+ /** The nightly price new dates open at, in MAJOR units of the hotel's currency (e.g. 4500 or "4500.00") */
200
+ defaultRate: number | string;
201
+ }>;
202
+ }
203
+ export interface PropertyCreated {
204
+ /** The id your company key names in the X-ZS-Property header from now on */
205
+ id: number;
206
+ /** As stored. A sandbox's name ends in (sandbox) and is at most 60 characters */
207
+ name: string;
208
+ timezone: string;
209
+ currency: string;
210
+ /** The property publishes to its channels. false for a new hotel until your first PUT /catalog/room-types puts it on the channel manager; always true for a sandbox */
211
+ channelManager: boolean;
212
+ /** true when a test key made it: everything lands locally, nothing reaches a channel and nothing is billed */
213
+ sandbox: boolean;
214
+ billing: {
215
+ /** ACTIVE: its billing has started, it is on your next monthly invoice · WAITING: the hotel is live, its billing has not started yet · NOT_BILLED: a sandbox */
216
+ state: "ACTIVE" | "WAITING" | "NOT_BILLED";
217
+ /** Why billing waits; null otherwise. SETUP: your billing setup is not complete · OVERDUE: one of your invoices is overdue · UNPAID_LIMIT: you have added as many hotels as you may before your first paid invoice · REVIEW: ZimmerStack starts it */
218
+ reason: "SETUP" | "OVERDUE" | "UNPAID_LIMIT" | "REVIEW" | null;
219
+ /** The same in one sentence, with what to do next; may change, branch on state and reason */
220
+ message: string;
221
+ };
222
+ /** true: an earlier request with this X-Idempotency-Key already added this hotel; nothing new was made */
223
+ replay: boolean;
224
+ }
225
+ export interface PropertyRemoved {
226
+ id: number;
227
+ /** The hotel's name; null only for a sandbox removed before its name was recorded */
228
+ name: string | null;
229
+ removed: true;
230
+ /** true: it was already removed before this request; the rest of the answer is where it stands now */
231
+ replay: boolean;
232
+ sandbox: boolean;
233
+ /** Nobody signs in to the hotel's account any more and no key reaches it */
234
+ access: "CLOSED";
235
+ billing: {
236
+ /** CANCELLED: the hotel's subscription is cancelled · NOT_BILLED: a sandbox, never billed */
237
+ state: "CANCELLED" | "NOT_BILLED";
238
+ /** ISO 8601 instant the subscription was cancelled; null for a sandbox */
239
+ cancelledAt: string | null;
240
+ };
241
+ channelManager: {
242
+ /** REMOVED: its channel connections, rate plans, room types and listing are gone from the channel manager · RETRYING: a step is still pending; ZimmerStack retries it and nothing is needed from you · NOT_CONNECTED: it was never on the channel manager */
243
+ state: "REMOVED" | "RETRYING" | "NOT_CONNECTED";
244
+ /** While RETRYING, the step that is pending, in the order they run: the channel connections, then the rate plans, then the room types, then the property. null otherwise, and on a replay */
245
+ step: "CHANNELS" | "RATE_PLANS" | "ROOM_TYPES" | "PROPERTY" | null;
246
+ /** While RETRYING, what was still on the channel manager when this request ended; null otherwise, and on a replay */
247
+ stillConnected: {
248
+ channels: number;
249
+ ratePlans: number | null;
250
+ roomTypes: number | null;
251
+ property: boolean;
252
+ } | null;
253
+ };
254
+ }
164
255
  export interface RoomTypesUpsert {
165
256
  /** Each ref once per request */
166
257
  roomTypes: Array<{
@@ -1013,6 +1104,24 @@ export interface Operations {
1013
1104
  body: undefined;
1014
1105
  response: Properties;
1015
1106
  };
1107
+ /** Add a hotel (a software partner's company key) */
1108
+ "POST /properties": {
1109
+ path: undefined;
1110
+ query: undefined;
1111
+ body: PropertyCreate;
1112
+ response: PropertyCreated;
1113
+ };
1114
+ /** Remove a hotel you added (a software partner's company key) */
1115
+ "DELETE /properties/{propertyId}": {
1116
+ path: {
1117
+ propertyId: string | number;
1118
+ };
1119
+ query: {
1120
+ confirm: string;
1121
+ };
1122
+ body: undefined;
1123
+ response: PropertyRemoved;
1124
+ };
1016
1125
  /** The property this key is for */
1017
1126
  "GET /property": {
1018
1127
  path: undefined;
@@ -4,7 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.OPERATIONS = exports.MODIFIER_TAKES_EFFECT = exports.SCOPES = exports.ERROR_CODES = exports.LIMITS = exports.PROPERTY_HEADER = exports.IDEMPOTENCY_HEADER = exports.API_PREFIX = exports.API_ORIGIN = exports.SDK_VERSION = void 0;
6
6
  /** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
7
- exports.SDK_VERSION = "0.4.0";
7
+ exports.SDK_VERSION = "0.5.0";
8
8
  /** Where the API lives. The key is sent nowhere else. */
9
9
  exports.API_ORIGIN = "https://api.zimmerstack.com";
10
10
  exports.API_PREFIX = "/api/v1/connect-api/v1";
@@ -89,7 +89,15 @@ exports.ERROR_CODES = [
89
89
  "RATE_OUT_OF_BAND",
90
90
  "CHANNEL_NOT_FOUND",
91
91
  "CHANNEL_SHARED",
92
- "MODIFIER_OUT_OF_BAND"
92
+ "MODIFIER_OUT_OF_BAND",
93
+ "COMPANY_KEY_REQUIRED",
94
+ "BILLING_SETUP_REQUIRED",
95
+ "OWNER_HAS_ACCOUNT",
96
+ "SANDBOX_LIMIT",
97
+ "CONFIRMATION_MISMATCH",
98
+ "PROPERTY_NOT_REMOVABLE",
99
+ "PROPERTY_BUSY",
100
+ "PRICE_UNAVAILABLE"
93
101
  ];
94
102
  /** What a key may do. The hotel's owner (or, for a vendor's key, the vendor) chose them when the key was made. */
95
103
  exports.SCOPES = [
@@ -102,13 +110,16 @@ exports.SCOPES = [
102
110
  "direct-bookings:cancel",
103
111
  "bookings:read",
104
112
  "bookings:write",
105
- "bookings:payments"
113
+ "bookings:payments",
114
+ "properties:write"
106
115
  ];
107
116
  /** When a channel's price modifier takes effect. Show it where a person saves one. */
108
117
  exports.MODIFIER_TAKES_EFFECT = "A modifier applies to prices sent to the channel after the change. Prices already on the channel stay as they are until those nights are sent again.";
109
118
  /** idempotent: the server replays the stored answer when the idempotency key repeats, so the client may resend the request after a network failure. */
110
119
  exports.OPERATIONS = {
111
120
  "GET /properties": { idempotent: false, bodyRequired: false },
121
+ "POST /properties": { idempotent: true, bodyRequired: true },
122
+ "DELETE /properties/{propertyId}": { idempotent: false, bodyRequired: false },
112
123
  "GET /property": { idempotent: false, bodyRequired: false },
113
124
  "GET /catalog": { idempotent: false, bodyRequired: false },
114
125
  "PUT /catalog/room-types": { idempotent: true, bodyRequired: true },
@@ -5,7 +5,7 @@
5
5
  * mobile app, a repository or a log line.
6
6
  */
7
7
  export { ZimmerStack } from "./client.js";
8
- export type { ClientEvent, ReadOptions, RequestArgs, WriteOptions, ZimmerStackOptions } from "./client.js";
8
+ export type { ClientEvent, RatePlanInput, ReadOptions, RequestArgs, RoomTypeInput, StructureSaved, WriteOptions, ZimmerStackOptions } from "./client.js";
9
9
  export { ZimmerStackError, ZimmerStackUsageError } from "./errors.js";
10
10
  export type { LocalErrorCode } from "./errors.js";
11
11
  export { addDays, buildGrid, channelPrice, chunk, eachDate, toRanges } from "./grid.js";