@zimmerstack/connect 0.7.0 → 0.9.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.
- package/AGENTS.md +269 -15
- package/README.md +444 -18
- package/dist/cjs/client.d.ts +503 -13
- package/dist/cjs/client.js +743 -45
- package/dist/cjs/doctor.d.ts +86 -0
- package/dist/cjs/doctor.js +689 -0
- package/dist/cjs/errors.d.ts +6 -2
- package/dist/cjs/errors.js +7 -2
- package/dist/cjs/generated.d.ts +2831 -205
- package/dist/cjs/generated.js +220 -8
- package/dist/cjs/grid.d.ts +6 -1
- package/dist/cjs/grid.js +8 -0
- package/dist/cjs/index.d.ts +14 -5
- package/dist/cjs/index.js +41 -1
- package/dist/cjs/key.d.ts +39 -0
- package/dist/cjs/key.js +85 -0
- package/dist/cjs/money.d.ts +81 -0
- package/dist/cjs/money.js +172 -0
- package/dist/cjs/notices.d.ts +44 -0
- package/dist/cjs/notices.js +64 -0
- package/dist/cjs/shownOnce.d.ts +42 -0
- package/dist/cjs/shownOnce.js +83 -0
- package/dist/cjs/webhooks.d.ts +182 -3
- package/dist/cjs/webhooks.js +75 -1
- package/dist/esm/client.d.ts +503 -13
- package/dist/esm/client.js +741 -45
- package/dist/esm/doctor.d.ts +86 -0
- package/dist/esm/doctor.js +685 -0
- package/dist/esm/errors.d.ts +6 -2
- package/dist/esm/errors.js +7 -2
- package/dist/esm/generated.d.ts +2831 -205
- package/dist/esm/generated.js +219 -7
- package/dist/esm/grid.d.ts +6 -1
- package/dist/esm/grid.js +7 -0
- package/dist/esm/index.d.ts +14 -5
- package/dist/esm/index.js +8 -3
- package/dist/esm/key.d.ts +39 -0
- package/dist/esm/key.js +81 -0
- package/dist/esm/mcp/cli.js +88 -9
- package/dist/esm/mcp/reference.generated.js +4457 -969
- package/dist/esm/mcp/server.d.ts +14 -6
- package/dist/esm/mcp/server.js +451 -25
- package/dist/esm/money.d.ts +81 -0
- package/dist/esm/money.js +161 -0
- package/dist/esm/notices.d.ts +44 -0
- package/dist/esm/notices.js +56 -0
- package/dist/esm/shownOnce.d.ts +42 -0
- package/dist/esm/shownOnce.js +77 -0
- package/dist/esm/webhooks.d.ts +182 -3
- package/dist/esm/webhooks.js +69 -0
- package/package.json +1 -1
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
1
|
+
import { type AvailabilityWrite, type BatchStatus, type Billing, type BillingInvoices, type BillingNextInvoice, type Booking, type BookingCancel, type BookingCreate, type Catalog, type CatalogDeleteResult, type CatalogUpsertResult, type ChannelBooking, type CloseResult, type CloseRoomType, type ConnectLink, type ConnectLinkCreate, type ConnectLinkCreated, type ConnectLinkList, type DirectBookingCancel, type DirectBookingCancelResult, type EventsList, type Explain, type GoLiveResult, type HotelKey, type HotelKeyCreate, type HotelKeyCreated, type HotelKeyList, type HotelKeyRevoke, type HotelKeyRotated, type Limits, type LoggedEvent, type ModifierResult, type OperationKey, type Operations, type PropertyCreate, type PropertyCreated, type PropertyRemoved, type RatePlansUpsert, type RatesResendAccepted, type RatesWrite, type Readiness, type ReopenRoomType, type RequestLog, type RestrictionsWrite, type RoomTypesUpsert, type SandboxBooking, type SandboxBookingCreate, type SandboxBookingModify, type SandboxFault, type SandboxFaultView, type SandboxNoShow, type SandboxSyncEvent, type SandboxSyncEventView, type Status, type SupportTicket, type SupportTicketCreate, type SupportTicketList, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryList, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointCreated, type WebhookEndpointDeleted, type WebhookEndpointList, type WebhookEndpointResumed, type WebhookEndpointUpdate, type WebhookRecoverResult, type WebhookSecretRotated, type WebhookTest, type WebhookTestQueued, type WriteAccepted, type WritePreview } from "./generated.js";
|
|
2
2
|
import { type Grid, type GridEdits, type ModifierStep } from "./grid.js";
|
|
3
3
|
export interface ZimmerStackOptions {
|
|
4
4
|
/**
|
|
@@ -16,7 +16,12 @@ export interface ZimmerStackOptions {
|
|
|
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;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The longest the client holds a call open for a budget before giving the refusal back to you. Default
|
|
21
|
+
* 120 s: a minute's budget is waited out, an hour's or a day's comes back as a retryable error that says
|
|
22
|
+
* when it frees (`retryAfterSeconds`, `freesAt`). Raise it (3600 for a nightly job) and the client holds
|
|
23
|
+
* the call across the longer budget and tells `onEvent` when it lands. Any call can set its own.
|
|
24
|
+
*/
|
|
20
25
|
maxWaitSeconds?: number;
|
|
21
26
|
/**
|
|
22
27
|
* A live key under a test runner (NODE_ENV=test, Vitest, Jest, node --test) may read but not write,
|
|
@@ -38,10 +43,31 @@ export type ClientEvent = {
|
|
|
38
43
|
attempt: number;
|
|
39
44
|
waitMs: number;
|
|
40
45
|
reason: string;
|
|
41
|
-
}
|
|
46
|
+
}
|
|
47
|
+
/** The client is waiting for a budget the last answers reported, before it sends. `scope` names the budget. */
|
|
48
|
+
| {
|
|
42
49
|
type: "pace";
|
|
43
50
|
operation: string;
|
|
44
51
|
waitMs: number;
|
|
52
|
+
scope?: string;
|
|
53
|
+
}
|
|
54
|
+
/** A wait of more than a minute that the client is holding the call for. `message` reads "PUT /rates lands in about 25 minutes (…)". */
|
|
55
|
+
| {
|
|
56
|
+
type: "wait";
|
|
57
|
+
operation: string;
|
|
58
|
+
scope: string | undefined;
|
|
59
|
+
waitMs: number;
|
|
60
|
+
landsAt: string;
|
|
61
|
+
message: string;
|
|
62
|
+
}
|
|
63
|
+
/** A budget frees too late to hold the call for: it comes back to you as a retryable error. `freesAt` is when to send it again. */
|
|
64
|
+
| {
|
|
65
|
+
type: "deferred";
|
|
66
|
+
operation: string;
|
|
67
|
+
scope: string | undefined;
|
|
68
|
+
retryAfterSeconds: number;
|
|
69
|
+
freesAt: string;
|
|
70
|
+
message: string;
|
|
45
71
|
};
|
|
46
72
|
/** Per-call options of a write. */
|
|
47
73
|
export interface WriteOptions {
|
|
@@ -52,10 +78,51 @@ export interface WriteOptions {
|
|
|
52
78
|
*/
|
|
53
79
|
idempotencyKey?: string;
|
|
54
80
|
signal?: AbortSignal;
|
|
81
|
+
/** The longest this call is held open for a budget, in seconds; the client's `maxWaitSeconds` when left out. */
|
|
82
|
+
maxWaitSeconds?: number;
|
|
83
|
+
/**
|
|
84
|
+
* A company key sending to a hotel that is NOT LIVE yet (`zs.readiness.get()` says `live: false`): true
|
|
85
|
+
* sends the header `X-ZS-Before-Go-Live: true`, which says you know. Prices and stay rules are then
|
|
86
|
+
* stored and wait for `zs.readiness.goLive()` (the answer says `heldUntilGoLive: true`).
|
|
87
|
+
*
|
|
88
|
+
* ROOM COUNTS ARE DIFFERENT. Until the hotel is live a room count may only LOWER what is on sale: a
|
|
89
|
+
* count at or below what is on sale is sent to the booking sites AT ONCE (a held count would oversell
|
|
90
|
+
* a room), and a count that RAISES it is refused, in the answer's `rejected` list (422
|
|
91
|
+
* NOTHING_ACCEPTED when nothing else in the request landed), because the hotel's own people may still
|
|
92
|
+
* be running its counts. So send your room counts again right after going live.
|
|
93
|
+
*
|
|
94
|
+
* Without the option such a hotel answers 409 ARI_NOT_AUTHORITATIVE. On a live hotel it changes nothing.
|
|
95
|
+
*/
|
|
96
|
+
beforeGoLive?: boolean;
|
|
55
97
|
}
|
|
56
98
|
export interface ReadOptions {
|
|
57
99
|
signal?: AbortSignal;
|
|
100
|
+
/** The longest this call is held open for a budget, in seconds; the client's `maxWaitSeconds` when left out. */
|
|
101
|
+
maxWaitSeconds?: number;
|
|
102
|
+
/** A company key reading the calendar of a hotel that is not live yet: see `WriteOptions.beforeGoLive`. */
|
|
103
|
+
beforeGoLive?: boolean;
|
|
58
104
|
}
|
|
105
|
+
/** The header a company key sends with what it writes ahead of go-live (`beforeGoLive: true` on a call). */
|
|
106
|
+
export declare const BEFORE_GO_LIVE_HEADER = "x-zs-before-go-live";
|
|
107
|
+
/** What `zs.availability.close` and `.closeDryRun` take: one room type, a range of nights, optionally only some weekdays. */
|
|
108
|
+
export type CloseRequest = Omit<CloseRoomType, "dryRun">;
|
|
109
|
+
/** What `zs.availability.reopen` and `.reopenDryRun` take: the same, and optionally the count to put on sale. */
|
|
110
|
+
export type ReopenRequest = Omit<ReopenRoomType, "dryRun">;
|
|
111
|
+
/** A close or a reopen that was DONE: `batches` names the writes to watch land. */
|
|
112
|
+
export type CloseDone = CloseResult & {
|
|
113
|
+
dryRun: false;
|
|
114
|
+
};
|
|
115
|
+
/** What a close or a reopen WOULD do. Nothing was written: `batches` is empty. */
|
|
116
|
+
export type ClosePreview = CloseResult & {
|
|
117
|
+
dryRun: true;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* What `zs.limits.get()` answers (GET /limits): every budget this key sits under, with what is left of it
|
|
121
|
+
* right now. The contract's own shape (`Limits`); the name is kept from 0.8.0, when it was written by hand.
|
|
122
|
+
*/
|
|
123
|
+
export type LimitsNow = Limits;
|
|
124
|
+
/** One budget of `zs.limits.get()`: a row of the API's limits table with what is left of it right now. */
|
|
125
|
+
export type LimitNow = Limits["budgets"][number];
|
|
59
126
|
/** One room type, as `zs.roomTypes.save` takes it. */
|
|
60
127
|
export type RoomTypeInput = RoomTypesUpsert["roomTypes"][number];
|
|
61
128
|
/** One rate plan, as `zs.ratePlans.save` takes it. */
|
|
@@ -83,6 +150,28 @@ export type RequestArgs<K extends OperationKey> = (Op<K>["path"] extends undefin
|
|
|
83
150
|
} : {
|
|
84
151
|
body: Op<K>["body"];
|
|
85
152
|
}) & WriteOptions;
|
|
153
|
+
/**
|
|
154
|
+
* Writes whose route keeps an idempotency key on the server although the contract copy this package was
|
|
155
|
+
* generated from did not say so yet (the API booking's cancel, the sandbox booking's cancel and modify).
|
|
156
|
+
* The client sends a key for them, so a cancel whose answer was lost can be sent again and never lands
|
|
157
|
+
* twice. Once the generated table (`OPERATIONS`) says the same, this list changes nothing.
|
|
158
|
+
*/
|
|
159
|
+
export declare const KEYED_WRITES: ReadonlySet<string>;
|
|
160
|
+
/** "about 40 seconds", "about 2 minutes", "about 3 hours": how long a wait is, for a person. */
|
|
161
|
+
export declare function aboutHowLong(ms: number): string;
|
|
162
|
+
/** One budget of an answer's headers: `"key";q=120;w=60` and `"key";r=117;t=42` read together. */
|
|
163
|
+
export interface BudgetSeen {
|
|
164
|
+
name: string;
|
|
165
|
+
/** The quota, when the policy header named it. */
|
|
166
|
+
quota: number | undefined;
|
|
167
|
+
/** The window in seconds; a minute when the policy header did not say. */
|
|
168
|
+
windowSeconds: number;
|
|
169
|
+
remaining: number;
|
|
170
|
+
/** Seconds until the budget has room again. */
|
|
171
|
+
resetSeconds: number;
|
|
172
|
+
}
|
|
173
|
+
/** Read `RateLimit-Policy` and `RateLimit` into one list. Unknown names are kept: a new budget is paced like any other. */
|
|
174
|
+
export declare function readBudgets(policy: string | null, state: string | null): BudgetSeen[];
|
|
86
175
|
/** How long one attempt of an operation may take: the client's `timeoutMs`, or longer for the slow ones above. */
|
|
87
176
|
export declare function attemptTimeoutMs(operation: string, timeoutMs: number): number;
|
|
88
177
|
/**
|
|
@@ -105,8 +194,9 @@ export declare class ZimmerStack {
|
|
|
105
194
|
readonly propertyId: number | undefined;
|
|
106
195
|
constructor(options?: ZimmerStackOptions);
|
|
107
196
|
/**
|
|
108
|
-
* A software vendor's company key: the same client, acting on one hotel.
|
|
109
|
-
* so
|
|
197
|
+
* A software vendor's company key: the same client, acting on one hotel. Each hotel has its own queue
|
|
198
|
+
* of writes and its own pace, so one hotel's budget never holds up another's calls; what all your hotels
|
|
199
|
+
* share (your company's budget) is paced for all of them together. Make as many as you have hotels.
|
|
110
200
|
*
|
|
111
201
|
* @example
|
|
112
202
|
* const { properties } = await zs.properties.list();
|
|
@@ -189,6 +279,277 @@ export declare class ZimmerStack {
|
|
|
189
279
|
/** The hotel: its timezone and currency, what this key may do, its own limits, what it has used, where it stands. */
|
|
190
280
|
get: (options?: ReadOptions) => Promise<import("./generated.js").Property>;
|
|
191
281
|
};
|
|
282
|
+
readonly limits: {
|
|
283
|
+
/**
|
|
284
|
+
* Every budget this key sits under, with what is left and when it refills: the key's, its hotel's and,
|
|
285
|
+
* on a company key, your company's, plus the budgets over an hour and a day with this hotel's own
|
|
286
|
+
* figures. Any key may call it, and reading uses up nothing but one request.
|
|
287
|
+
*
|
|
288
|
+
* You do not need it to stay inside the limits: the client paces itself from every answer. Use it to
|
|
289
|
+
* size a job before you start it, or to show a person why something waits.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* const { budgets, shield } = await zs.limits.get();
|
|
293
|
+
* const cells = shield?.budgets.find((b) => b.scope === "cells-day");
|
|
294
|
+
* if (cells?.remaining != null && cells.remaining < plannedCells) console.log(`Room again in ${cells.resetSeconds} s`);
|
|
295
|
+
*/
|
|
296
|
+
get: (options?: ReadOptions) => Promise<LimitsNow>;
|
|
297
|
+
};
|
|
298
|
+
readonly requests: {
|
|
299
|
+
/**
|
|
300
|
+
* This key's own requests of the last 7 days, newest first: when, the route's pattern, the status, the
|
|
301
|
+
* error code, the address it came from, how long it took and the request id. Never a body, a query or a
|
|
302
|
+
* guest's data. Any key may call it. A company key reads every call made with it across its hotels, or
|
|
303
|
+
* one hotel's through `zs.forProperty(id)`.
|
|
304
|
+
*
|
|
305
|
+
* `since` defaults to the last 24 hours. `status` is one code ("429"), a family ("4xx") or "errors"
|
|
306
|
+
* (400 and above). Use it to answer "did my push arrive" yourself, and to look for an address that is
|
|
307
|
+
* not yours: that is the first sign of a leaked key.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* const { items } = await zs.requests.list({ status: "errors" });
|
|
311
|
+
* for (const r of items) console.log(r.at, r.method, r.route, r.status, r.errorCode, r.requestId);
|
|
312
|
+
*/
|
|
313
|
+
list: (query?: Op<"GET /requests">["query"], options?: ReadOptions) => Promise<RequestLog>;
|
|
314
|
+
/**
|
|
315
|
+
* The same, page by page to the last one: every request since `since`, newest first.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* for await (const r of zs.requests.all({ status: "errors", since: yesterday })) count[r.errorCode ?? r.status]++;
|
|
319
|
+
*/
|
|
320
|
+
all: (query?: Omit<NonNullable<Op<"GET /requests">["query"]>, "cursor">, options?: ReadOptions) => AsyncGenerator<RequestLog["items"][number], void, undefined>;
|
|
321
|
+
};
|
|
322
|
+
readonly events: {
|
|
323
|
+
/**
|
|
324
|
+
* One page of the hotel's event log: every event a webhook can carry for it (OTA bookings, website
|
|
325
|
+
* bookings, channel alerts, drift), once, oldest first, starting after the sequence you pass. Each item
|
|
326
|
+
* is the webhook's own envelope with its `sequence`, so one parser serves both.
|
|
327
|
+
*
|
|
328
|
+
* Keep `nextAfter` as your place. `more: true` means ask again at once. When `earliestSequence` is more
|
|
329
|
+
* than one above the `after` you sent, the events in between are older than the log keeps (90 days):
|
|
330
|
+
* reconcile with `zs.channelBookings.all` and `zs.directBookings.all`, then carry on. Scope
|
|
331
|
+
* channel-bookings:read (the channel events) or direct-bookings:read (the website's). `all` does the paging.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* const page = await zs.events.list({ after: lastSequence });
|
|
335
|
+
*/
|
|
336
|
+
list: (query?: Op<"GET /events">["query"], options?: ReadOptions) => Promise<EventsList>;
|
|
337
|
+
/**
|
|
338
|
+
* Every event after a sequence you saved, in order, to the end of the log. Apply each one, then save its
|
|
339
|
+
* `sequence`: that is your place, and the next run starts from it. A webhook only tells you there is
|
|
340
|
+
* something to read; nothing depends on it having arrived, or on the order deliveries arrived in.
|
|
341
|
+
*
|
|
342
|
+
* `onGap` is called once, before the first event, when the log no longer holds what follows `after`
|
|
343
|
+
* (events are kept 90 days): read the bookings again with `zs.channelBookings.all({ since })` and
|
|
344
|
+
* `zs.directBookings.all({ since })` before you go on. A first run with `after: 0` is told too.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* for await (const event of zs.events.all({ after: await loadPlace() })) {
|
|
348
|
+
* await apply(event); // dedupe on event.id if your apply is not idempotent
|
|
349
|
+
* await savePlace(event.sequence);
|
|
350
|
+
* }
|
|
351
|
+
*/
|
|
352
|
+
all: (query?: {
|
|
353
|
+
after?: number;
|
|
354
|
+
limit?: number;
|
|
355
|
+
}, options?: ReadOptions & {
|
|
356
|
+
onGap?: (gap: {
|
|
357
|
+
after: number;
|
|
358
|
+
earliestSequence: number;
|
|
359
|
+
}) => void;
|
|
360
|
+
}) => AsyncGenerator<LoggedEvent, void, undefined>;
|
|
361
|
+
};
|
|
362
|
+
readonly webhookEndpoints: {
|
|
363
|
+
/** Your company webhook endpoints of this key's mode (a live key: live ones; a test key: test ones), each with its health. */
|
|
364
|
+
list: (options?: ReadOptions) => Promise<WebhookEndpointList>;
|
|
365
|
+
/**
|
|
366
|
+
* Create a company webhook endpoint. `dataAck: true` confirms that guest booking details will be sent
|
|
367
|
+
* to that address. Guest contact (phone, email) is off unless `includeGuestContact` is true.
|
|
368
|
+
*
|
|
369
|
+
* THE ANSWER'S `secret` IS SHOWN ONCE: store it in your server's settings at once (never in code or a
|
|
370
|
+
* log). No call reads it back; `rotateSecret` makes a new one. The call carries an idempotency key, so
|
|
371
|
+
* a retry after a lost answer gets the same endpoint and the same secret, never a second endpoint.
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* const { endpoint, secret } = await zs.webhookEndpoints.create({ url: "https://pms.example/zimmerstack", dataAck: true });
|
|
375
|
+
*/
|
|
376
|
+
create: (body: WebhookEndpointCreate, options?: WriteOptions) => Promise<WebhookEndpointCreated>;
|
|
377
|
+
get: (endpointId: number, options?: ReadOptions) => Promise<WebhookEndpoint>;
|
|
378
|
+
/** Change an endpoint: its address, its event types, the notify email or the guest-contact switch. Send only what changes. */
|
|
379
|
+
update: (endpointId: number, body: WebhookEndpointUpdate, options?: WriteOptions) => Promise<WebhookEndpoint>;
|
|
380
|
+
/**
|
|
381
|
+
* Delete an endpoint for good; its deliveries and their log go with it. THERE IS NO UNDO: call it when
|
|
382
|
+
* a person chose to, never from a loop or a cleanup script. To stop events for a while, `pause`.
|
|
383
|
+
*/
|
|
384
|
+
delete: (endpointId: number, options?: ReadOptions) => Promise<WebhookEndpointDeleted>;
|
|
385
|
+
/** Hold an endpoint's events (before planned downtime). Nothing is dropped: `resume` sends them, oldest first. */
|
|
386
|
+
pause: (endpointId: number, options?: WriteOptions) => Promise<WebhookEndpoint>;
|
|
387
|
+
/** Resume a paused endpoint. `heldEvents` says how many held events are going out now. */
|
|
388
|
+
resume: (endpointId: number, options?: WriteOptions) => Promise<WebhookEndpointResumed>;
|
|
389
|
+
/**
|
|
390
|
+
* A new signing secret, in this answer only. Both secrets sign every delivery until `previousExpiresAt`
|
|
391
|
+
* (24 hours), so switch your receiver to the new one inside that day and nothing is lost.
|
|
392
|
+
*/
|
|
393
|
+
rotateSecret: (endpointId: number, options?: WriteOptions) => Promise<WebhookSecretRotated>;
|
|
394
|
+
/**
|
|
395
|
+
* Send the endpoint a signed sample of any event type (`zimmerstack.ping` when none is named). The
|
|
396
|
+
* sample says `mode: "test"` and has no `sequence`: it is in no log. On a sandbox, make a real event
|
|
397
|
+
* instead with `zs.sandbox.bookings.create` and `zs.sandbox.syncEvents.create`.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* const { deliveryId } = await zs.webhookEndpoints.test(endpoint.id, { eventType: "channel.booking.created" });
|
|
401
|
+
* const delivery = await zs.webhookEndpoints.deliveries.get(endpoint.id, deliveryId); // what your receiver answered
|
|
402
|
+
*/
|
|
403
|
+
test: (endpointId: number, body?: WebhookTest, options?: WriteOptions) => Promise<WebhookTestQueued>;
|
|
404
|
+
/**
|
|
405
|
+
* Queue again every subscribed event since an instant that failed or never had a delivery: at most 90
|
|
406
|
+
* days back and 10,000 events a run (`truncated: true` means run it again for the rest). Reading the
|
|
407
|
+
* log with `zs.events.all` is the other way to catch up, and needs no endpoint.
|
|
408
|
+
*/
|
|
409
|
+
recover: (endpointId: number, since: string | Date, options?: WriteOptions) => Promise<WebhookRecoverResult>;
|
|
410
|
+
deliveries: {
|
|
411
|
+
/** An endpoint's delivery log, newest first. Filter with status, eventType, mode (TEST: what a test made), from and to. */
|
|
412
|
+
list: (endpointId: number, query?: Op<"GET /webhook-endpoints/{endpointId}/deliveries">["query"], options?: ReadOptions) => Promise<WebhookDeliveryList>;
|
|
413
|
+
/** One delivery: the body as it was sent, and every attempt with what your receiver answered. */
|
|
414
|
+
get: (endpointId: number, deliveryId: string, options?: ReadOptions) => Promise<WebhookDeliveryDetail>;
|
|
415
|
+
/** Send one delivery again: the same event, the same id and sequence. */
|
|
416
|
+
redeliver: (endpointId: number, deliveryId: string, options?: WriteOptions) => Promise<WebhookDelivery>;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
readonly connectLinks: {
|
|
420
|
+
/** Your connect links, newest first; `propertyId` narrows them to one hotel. */
|
|
421
|
+
list: (query?: Op<"GET /connect-links">["query"], options?: ReadOptions) => Promise<ConnectLinkList>;
|
|
422
|
+
/**
|
|
423
|
+
* Make a one-time link for ONE hotel and ONE booking site. Send the answer's `url` to the hotel's own
|
|
424
|
+
* person: on ZimmerStack's hosted page they sign in to the booking site, confirm every room and rate
|
|
425
|
+
* match and press Start selling. Your software never holds a booking site's password, and the call
|
|
426
|
+
* takes none. You hear `channel.connect.completed`, or `channel.connect.expired` if the link ran out.
|
|
427
|
+
*
|
|
428
|
+
* THE `url` IS SHOWN ONCE: it is in this answer only, and null on a replay of the same request
|
|
429
|
+
* (`shownOnce(answer)` returns it or says what to do). `hotelStep` is what the hotel does at the booking
|
|
430
|
+
* site first, for your own screen or message. A LIVE key only: a sandbox has no booking site, so a test
|
|
431
|
+
* key is refused (LIVE_KEY_REQUIRED). The hotel is `propertyId` in the body; `forProperty` is not read.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* const made = await zs.connectLinks.create({ propertyId: 61, channel: "bookingcom", returnUrl: "https://pms.example/hotels/61" });
|
|
435
|
+
* await sendToTheHotel(shownOnce(made), made.hotelStep);
|
|
436
|
+
*/
|
|
437
|
+
create: (body: ConnectLinkCreate, options?: WriteOptions) => Promise<ConnectLinkCreated>;
|
|
438
|
+
/** Where one link stands: pending, opened, completed, expired or revoked. Never its address again. */
|
|
439
|
+
get: (linkId: string, options?: ReadOptions) => Promise<ConnectLink>;
|
|
440
|
+
/** Withdraw a link. A page that is open stops at its next step. */
|
|
441
|
+
revoke: (linkId: string, options?: WriteOptions) => Promise<ConnectLink>;
|
|
442
|
+
};
|
|
443
|
+
readonly readiness: {
|
|
444
|
+
/**
|
|
445
|
+
* Is this hotel ready for your software to be its source of truth? Four checks, each passed or not,
|
|
446
|
+
* with a sentence and what to do: it is on the channel manager, every room type and rate plan is
|
|
447
|
+
* linked, ZimmerStack's own pricing will not overwrite your prices, and nothing stale would go out
|
|
448
|
+
* (the record matches the channels, or you sent a price for every rate plan and night of the year
|
|
449
|
+
* first). Room counts are no part of it: the report only says how many room-type nights your software
|
|
450
|
+
* has not written yet. Any key may read it, as often as you like. A hotel you added yourself is live
|
|
451
|
+
* from the start (`live: true`).
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* const report = await zs.forProperty(61).readiness.get();
|
|
455
|
+
* for (const check of report.checks) if (!check.passed) console.log(check.id, check.summary, check.action);
|
|
456
|
+
*/
|
|
457
|
+
get: (options?: ReadOptions) => Promise<Readiness>;
|
|
458
|
+
/**
|
|
459
|
+
* Make your software this hotel's source of truth: from then on every price, stay rule and room count
|
|
460
|
+
* you send is pushed to its booking sites, and what you sent ahead (`beforeGoLive: true`) goes out.
|
|
461
|
+
* Scope ari:write. Not ready is 409 NOT_READY with the checks that did not pass in `error.details`;
|
|
462
|
+
* that refusal is never kept under an idempotency key, so call again once they pass. Already live
|
|
463
|
+
* answers `replay: true`. Call it when a person decided to; only ZimmerStack support switches a hotel back.
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* const hotel = zs.forProperty(61);
|
|
467
|
+
* await hotel.rates.set(aYearOfPrices, { beforeGoLive: true }); // stored, and waits
|
|
468
|
+
* // Room counts are not sent ahead: until go-live a count may only lower what is on sale (it goes out at once), and a higher one is refused.
|
|
469
|
+
* if ((await hotel.readiness.get()).ready) await hotel.readiness.goLive();
|
|
470
|
+
* await hotel.availability.set(aYearOfCounts); // right after going live: your room counts
|
|
471
|
+
*/
|
|
472
|
+
goLive: (options?: WriteOptions) => Promise<GoLiveResult>;
|
|
473
|
+
};
|
|
474
|
+
readonly hotelKeys: {
|
|
475
|
+
/** The keys YOU made on a hotel you added. The hotel's own keys are its owner's and are never listed here. */
|
|
476
|
+
list: (propertyId: number, options?: ReadOptions) => Promise<HotelKeyList>;
|
|
477
|
+
/**
|
|
478
|
+
* Mint a key on a hotel you added (or, with a test key, on one of your sandboxes): any scope a
|
|
479
|
+
* hotel's own key may hold, never a company key's own.
|
|
480
|
+
*
|
|
481
|
+
* THE ANSWER'S `key` IS SHOWN ONCE: store it in the server's settings at once, never in code or a log.
|
|
482
|
+
* It is null on a replay of the same request: `shownOnce(answer)` returns it or says to rotate.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* const minted = await zs.hotelKeys.create(61, { name: "Night audit job", scopes: ["ari:read", "channel-bookings:read"] });
|
|
486
|
+
* await vault.put(`zimmerstack/hotel-61`, shownOnce(minted));
|
|
487
|
+
*/
|
|
488
|
+
create: (propertyId: number, body: HotelKeyCreate, options?: WriteOptions) => Promise<HotelKeyCreated>;
|
|
489
|
+
/**
|
|
490
|
+
* A new key with the same name, scopes, addresses and expiry, its secret shown once; the old key keeps
|
|
491
|
+
* answering for 24 hours (`retired.retireAt`), so switch inside that day and nothing stops.
|
|
492
|
+
*/
|
|
493
|
+
rotate: (propertyId: number, keyId: number, options?: WriteOptions) => Promise<HotelKeyRotated>;
|
|
494
|
+
/** Revoke a key you made: it stops at once. `reason` (3 to 500 characters) is written on the key and on the hotel's activity log. */
|
|
495
|
+
revoke: (propertyId: number, keyId: number, body: HotelKeyRevoke, options?: WriteOptions) => Promise<HotelKey>;
|
|
496
|
+
};
|
|
497
|
+
readonly billing: {
|
|
498
|
+
/**
|
|
499
|
+
* Your bills at a glance: what is owed, the one-time onboarding fee, your hotel quota and what opens
|
|
500
|
+
* the next level, what is left of money paid ahead, the days of an unpaid invoice, and `atCost`: what
|
|
501
|
+
* the channel manager charged above its included room types and rate plans for a hotel whose limit
|
|
502
|
+
* ZimmerStack raised. An at-cost line is a record: `status` says RECORDED until ZimmerStack's team has
|
|
503
|
+
* put it on one of your invoices (INVOICED) or waived it. Nothing here pays or changes anything.
|
|
504
|
+
*/
|
|
505
|
+
get: (options?: ReadOptions) => Promise<Billing>;
|
|
506
|
+
/** Your 24 most recent issued invoices, newest first, each before and after tax with its lines, then the recent payments. */
|
|
507
|
+
invoices: (options?: ReadOptions) => Promise<BillingInvoices>;
|
|
508
|
+
/**
|
|
509
|
+
* What your next monthly invoice is made of, hotel by hotel, read today: the rooms counted, the room
|
|
510
|
+
* band, the price list, the unit price. The invoice reads rooms, prices and the exchange rate again on
|
|
511
|
+
* the day it is made, and that is the bill.
|
|
512
|
+
*/
|
|
513
|
+
nextInvoice: (options?: ReadOptions) => Promise<BillingNextInvoice>;
|
|
514
|
+
};
|
|
515
|
+
readonly supportTickets: {
|
|
516
|
+
/** Your tickets of this key's mode, newest first. `status`: OPEN (waiting for ZimmerStack), ANSWERED (waiting for you), CLOSED. */
|
|
517
|
+
list: (query?: Op<"GET /support-tickets">["query"], options?: ReadOptions) => Promise<SupportTicketList>;
|
|
518
|
+
/** The same, page by page to the last one. */
|
|
519
|
+
all: (query?: Omit<NonNullable<Op<"GET /support-tickets">["query"]>, "cursor">, options?: ReadOptions) => AsyncGenerator<SupportTicketList["items"][number], void, undefined>;
|
|
520
|
+
/**
|
|
521
|
+
* Open a support ticket. `severity` follows from the hotels you name: `many_hotels` needs two or more
|
|
522
|
+
* `propertyIds` or `allProperties: true`, `one_hotel` exactly one, `question` any or none. ZimmerStack
|
|
523
|
+
* attaches what its own records show at that moment (`diagnostic`: ids, counts, states and times), so
|
|
524
|
+
* never paste a key, a secret or a guest's details into `message`. It opens whatever your
|
|
525
|
+
* integration's standing. The call carries an idempotency key: a retry never opens a second ticket.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* const ticket = await zs.supportTickets.create({ severity: "many_hotels", subject: "Prices are not going out", message: "Since 08:10 UTC every PUT /rates is accepted and its batch stays pending.", propertyIds: [61, 62, 70] });
|
|
529
|
+
* console.log(ticket.id, ticket.firstReply.target, ticket.firstReply.dueAt);
|
|
530
|
+
*/
|
|
531
|
+
create: (body: SupportTicketCreate, options?: WriteOptions) => Promise<SupportTicket>;
|
|
532
|
+
/** One ticket: its thread, oldest first, and the diagnostic taken when it opened. */
|
|
533
|
+
get: (ticketId: number, options?: ReadOptions) => Promise<SupportTicket>;
|
|
534
|
+
/** Write again on a ticket; it waits for ZimmerStack from then. A closed ticket takes no more messages (SUPPORT_TICKET_CLOSED): open a new one and name the old one. */
|
|
535
|
+
reply: (ticketId: number, message: string, options?: WriteOptions) => Promise<SupportTicket>;
|
|
536
|
+
/** Close your own ticket. */
|
|
537
|
+
close: (ticketId: number, options?: WriteOptions) => Promise<SupportTicket>;
|
|
538
|
+
};
|
|
539
|
+
readonly status: {
|
|
540
|
+
/**
|
|
541
|
+
* The components (the API, bookings coming in, prices and availability going out, each booking site),
|
|
542
|
+
* each operational or named in an open incident, and the incidents that touch YOUR hotels: the open
|
|
543
|
+
* ones and those resolved in the last 7 days. Any key. A company key reads all its hotels', or one
|
|
544
|
+
* hotel's through `zs.forProperty(id)`. An incident is opened and closed by ZimmerStack's staff:
|
|
545
|
+
* `operational` means nobody has reported a problem, not that a monitor measured none.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* const { overall, incidents } = await zs.status.get();
|
|
549
|
+
* for (const incident of incidents.open) console.log(incident.title, incident.status, incident.updates[0]?.message);
|
|
550
|
+
*/
|
|
551
|
+
get: (options?: ReadOptions) => Promise<Status>;
|
|
552
|
+
};
|
|
192
553
|
readonly catalog: {
|
|
193
554
|
/** Room types and rate plans, with the numeric ids every write uses. */
|
|
194
555
|
get: (options?: ReadOptions) => Promise<Catalog>;
|
|
@@ -271,21 +632,78 @@ export declare class ZimmerStack {
|
|
|
271
632
|
* ZimmerStack's record (one answer per request sent; a large write is split for you).
|
|
272
633
|
*/
|
|
273
634
|
set: (updates: AvailabilityWrite["updates"], options?: WriteOptions) => Promise<WriteAccepted[]>;
|
|
635
|
+
/**
|
|
636
|
+
* What `set` WOULD do with these updates, and nothing is written, queued or sent. The answer is a
|
|
637
|
+
* `WritePreview` (`dryRun: true`), never a `WriteAccepted`: `verdict` (would-write, nothing-to-write,
|
|
638
|
+
* would-refuse with the refusal a real write would get now), the ranges that would change, the ones
|
|
639
|
+
* already held, the ones held after a refusal, and the same `notices` the real write carries.
|
|
640
|
+
*
|
|
641
|
+
* It is not a free read: it spends the minute budgets like the write it previews (one request, one
|
|
642
|
+
* write, the same cells), and under a test runner a live key may not send it, like any write. It
|
|
643
|
+
* counts nothing against the hour and day budgets. To read the calendar use `get`.
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* const [preview] = await zs.availability.dryRun([{ roomTypeId: 412, dateFrom: "2026-12-31", dateTo: "2026-12-31", available: 0 }]);
|
|
647
|
+
* if (preview?.verdict === "would-write") await zs.availability.set(updates);
|
|
648
|
+
*/
|
|
649
|
+
dryRun: (updates: AvailabilityWrite["updates"], options?: ReadOptions) => Promise<WritePreview[]>;
|
|
650
|
+
/**
|
|
651
|
+
* Close one room type on a range of nights EVERYWHERE, in one call: its room count goes to 0 and
|
|
652
|
+
* stop-sell is switched on for every one of its rate plans. You do not need to know the hotel's
|
|
653
|
+
* plans. The count closes every rate of the room on every booking site; the stop-sell keeps it closed
|
|
654
|
+
* when a cancellation puts a room back.
|
|
655
|
+
*
|
|
656
|
+
* READ `notReached`: every plan that is not linked or that no booking site sells, and the one thing no
|
|
657
|
+
* stop-sell reaches, a rate a booking site links on its own side (only the count closes that).
|
|
658
|
+
* `batches` names the writes to watch land (`zs.batches.wait`). A close is accepted while your
|
|
659
|
+
* integration is paused or out of budget (`lane: true`): a hotel must never oversell.
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* const closed = await zs.availability.close({ roomTypeId: 412, dateFrom: "2026-12-30", dateTo: "2027-01-02" });
|
|
663
|
+
* for (const gap of closed.notReached) console.log(gap.what, gap.reason, gap.message);
|
|
664
|
+
*/
|
|
665
|
+
close: (body: CloseRequest, options?: WriteOptions) => Promise<CloseDone>;
|
|
666
|
+
/** What `close` would do, and nothing is done: the same answer with `dryRun: true` and no batches. Spends the minute budgets like the close. */
|
|
667
|
+
closeDryRun: (body: CloseRequest, options?: ReadOptions) => Promise<ClosePreview>;
|
|
668
|
+
/**
|
|
669
|
+
* Undo exactly what `close` did on these nights, and nothing else: the stop-sell is lifted on the plans
|
|
670
|
+
* the close switched on (a plan that was stop-sold before stays stopped), and each night gets back the
|
|
671
|
+
* count it held before. Pass `available` to put your own count on sale instead: only your software
|
|
672
|
+
* knows how many rooms are free now. A night whose count changed after the close is left as it is, and
|
|
673
|
+
* a night the close had not closed is skipped (`skippedNights`). A reopen opens inventory, so it waits
|
|
674
|
+
* like any other write while your integration is paused.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* const reopened = await zs.availability.reopen({ roomTypeId: 412, dateFrom: "2026-12-30", dateTo: "2027-01-02", available: 3 });
|
|
678
|
+
*/
|
|
679
|
+
reopen: (body: ReopenRequest, options?: WriteOptions) => Promise<CloseDone>;
|
|
680
|
+
/** What `reopen` would do, and nothing is done. */
|
|
681
|
+
reopenDryRun: (body: ReopenRequest, options?: ReadOptions) => Promise<ClosePreview>;
|
|
274
682
|
};
|
|
275
683
|
readonly rates: {
|
|
276
|
-
/** Nightly prices per rate plan, in
|
|
684
|
+
/** Nightly prices per rate plan, before any channel's modifier: `rate` (a decimal string in major units, with `currency` and `decimals`) beside `rateMinor` (hundredths of the major unit, in every currency). */
|
|
277
685
|
get: (range?: {
|
|
278
686
|
from?: string;
|
|
279
687
|
to?: string;
|
|
280
688
|
}, options?: ReadOptions) => Promise<import("./generated.js").RatesRead>;
|
|
281
689
|
/**
|
|
282
|
-
* Set nightly prices in MAJOR units over date ranges
|
|
283
|
-
*
|
|
284
|
-
*
|
|
690
|
+
* Set nightly prices in MAJOR units over date ranges: a number or a decimal string with the
|
|
691
|
+
* currency's own decimals (4500.5 or "4500.50"). `currency` may be left out: the hotel's own is
|
|
692
|
+
* filled in. What could not be kept as sent is named in the answer's `rounded` list. Never a zero
|
|
693
|
+
* price to stop selling: `restrictions.set` with stopSell closes one rate plan on a night, and
|
|
694
|
+
* `availability.set` with 0 rooms closes the room type on every booking site.
|
|
285
695
|
*/
|
|
286
696
|
set: (updates: Array<Omit<RatesWrite["updates"][number], "currency"> & {
|
|
287
697
|
currency?: string;
|
|
288
698
|
}>, options?: WriteOptions) => Promise<WriteAccepted[]>;
|
|
699
|
+
/**
|
|
700
|
+
* What `set` WOULD do with these prices, and nothing is written: a `WritePreview` per request, with what
|
|
701
|
+
* would change, what is already held, what would be rounded and the notices (a plan no booking site
|
|
702
|
+
* sells, an engine that will reprice). See `zs.availability.dryRun` for what it costs.
|
|
703
|
+
*/
|
|
704
|
+
dryRun: (updates: Array<Omit<RatesWrite["updates"][number], "currency"> & {
|
|
705
|
+
currency?: string;
|
|
706
|
+
}>, options?: ReadOptions) => Promise<WritePreview[]>;
|
|
289
707
|
/**
|
|
290
708
|
* Send the hotel's prices to its channels again, unchanged, so nights already there pick the
|
|
291
709
|
* current modifiers up. A hotel may ask a few times a day: make it a deliberate button, never
|
|
@@ -301,6 +719,39 @@ export declare class ZimmerStack {
|
|
|
301
719
|
}, options?: ReadOptions) => Promise<import("./generated.js").RestrictionsRead>;
|
|
302
720
|
/** Set stay rules over date ranges: stopSell, closedToArrival, closedToDeparture, minStayArrival, minStayThrough, maxStay. */
|
|
303
721
|
set: (updates: RestrictionsWrite["updates"], options?: WriteOptions) => Promise<WriteAccepted[]>;
|
|
722
|
+
/**
|
|
723
|
+
* What `set` WOULD do with these stay rules, and nothing is written. The notices are the point: a
|
|
724
|
+
* stop-sell on one rate plan answers ROOM_STILL_ON_SALE when the room keeps selling through its other
|
|
725
|
+
* plans. See `zs.availability.dryRun` for what it costs.
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* const [preview] = await zs.restrictions.dryRun([{ ratePlanId: 901, dateFrom: "2026-12-31", dateTo: "2026-12-31", stopSell: true }]);
|
|
729
|
+
* for (const notice of noticesOf(preview)) console.log(notice.code, notice.message, notice.action);
|
|
730
|
+
*/
|
|
731
|
+
dryRun: (updates: RestrictionsWrite["updates"], options?: ReadOptions) => Promise<WritePreview[]>;
|
|
732
|
+
};
|
|
733
|
+
readonly explain: {
|
|
734
|
+
/**
|
|
735
|
+
* Explain one night of one room type (optionally one of its rate plans), from ZimmerStack's record:
|
|
736
|
+
* what your software last sent, what the record holds and who set it, what the channel manager was
|
|
737
|
+
* last seen holding, every send still on file and how it ended, a held value in the channel manager's
|
|
738
|
+
* own words, which connections sell each plan, the rules in force, the bookings that moved the count
|
|
739
|
+
* (ids and times, never a guest), and `summary`: the same in plain sentences, for a person.
|
|
740
|
+
*
|
|
741
|
+
* What it cannot know: it reads the channel manager's copy as last seen, never a booking site's own
|
|
742
|
+
* screen. `seenAt: null` means that night was never read back; `lastSent: null` means the write is older
|
|
743
|
+
* than the ones whose values are kept (`searched` says how far it looked); `channels.known: false` means
|
|
744
|
+
* the hotel's connections have not been read yet. Scope ari:read; it calls no channel, so ask freely.
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* const night = await zs.explain.night({ roomTypeId: 412, date: "2026-12-31" });
|
|
748
|
+
* for (const sentence of night.summary) console.log(sentence);
|
|
749
|
+
*/
|
|
750
|
+
night: (query: {
|
|
751
|
+
roomTypeId: number;
|
|
752
|
+
date: string;
|
|
753
|
+
ratePlanId?: number;
|
|
754
|
+
}, options?: ReadOptions) => Promise<Explain>;
|
|
304
755
|
};
|
|
305
756
|
readonly sync: {
|
|
306
757
|
/** How far what you sent has travelled: cells still on their way, the last error, where the integration stands. */
|
|
@@ -346,7 +797,7 @@ export declare class ZimmerStack {
|
|
|
346
797
|
create: (body: BookingCreate, options?: WriteOptions) => Promise<Booking>;
|
|
347
798
|
get: (bookingId: number, options?: ReadOptions) => Promise<Booking>;
|
|
348
799
|
/** Cancel a booking this integration created; its nights open again on the channels. */
|
|
349
|
-
cancel: (bookingId: number, body?: BookingCancel, options?:
|
|
800
|
+
cancel: (bookingId: number, body?: BookingCancel, options?: WriteOptions) => Promise<Booking>;
|
|
350
801
|
};
|
|
351
802
|
readonly channelBookings: {
|
|
352
803
|
/** OTA bookings the channel manager delivered, in the webhook's shape. Follow `nextCursor`, or use `all`. */
|
|
@@ -406,9 +857,47 @@ export declare class ZimmerStack {
|
|
|
406
857
|
* With `otaName: "Website"` it pretends a guest booked on the hotel's own website instead, and the webhook
|
|
407
858
|
* is `direct.booking.created`.
|
|
408
859
|
*/
|
|
409
|
-
create: (body: SandboxBookingCreate, options?: WriteOptions) => Promise<
|
|
410
|
-
cancel: (bookingId: number, options?:
|
|
411
|
-
modify: (bookingId: number, body: SandboxBookingModify, options?:
|
|
860
|
+
create: (body: SandboxBookingCreate, options?: WriteOptions) => Promise<SandboxBooking>;
|
|
861
|
+
cancel: (bookingId: number, options?: WriteOptions) => Promise<SandboxBooking>;
|
|
862
|
+
modify: (bookingId: number, body: SandboxBookingModify, options?: WriteOptions) => Promise<SandboxBooking>;
|
|
863
|
+
/**
|
|
864
|
+
* Pretend the hotel recorded that a WEBSITE booking's guest did not arrive (one made with
|
|
865
|
+
* `otaName: "Website"`): the stay and its rooms go NOSHOW, the nights come back on the sandbox's
|
|
866
|
+
* availability, and your endpoint receives the real `direct.booking.modified`. `{ undo: true }` takes
|
|
867
|
+
* it back. The booking is not cancelled.
|
|
868
|
+
*/
|
|
869
|
+
noShow: (bookingId: number, body?: SandboxNoShow, options?: WriteOptions) => Promise<SandboxBooking>;
|
|
870
|
+
};
|
|
871
|
+
syncEvents: {
|
|
872
|
+
/**
|
|
873
|
+
* Pretend a channel problem, or its end: the real `channel.sync.alert` or `channel.sync.recovered`
|
|
874
|
+
* to your endpoint, and a line in the event log. `event` says which problem (rate_error when left
|
|
875
|
+
* out); the problem sits on one of the sandbox's pretend channels and `zs.channels.list()` shows it
|
|
876
|
+
* until a recovered clears it.
|
|
877
|
+
*
|
|
878
|
+
* @example
|
|
879
|
+
* await zs.sandbox.syncEvents.create({ type: "channel.sync.alert", event: "disconnect_channel" });
|
|
880
|
+
* await zs.sandbox.syncEvents.create({ type: "channel.sync.recovered" });
|
|
881
|
+
*/
|
|
882
|
+
create: (body: SandboxSyncEvent, options?: WriteOptions) => Promise<SandboxSyncEventView>;
|
|
883
|
+
};
|
|
884
|
+
faults: {
|
|
885
|
+
/** The fault in force on this sandbox's pretend channel; `active: false` when there is none. */
|
|
886
|
+
get: (options?: ReadOptions) => Promise<SandboxFaultView>;
|
|
887
|
+
/**
|
|
888
|
+
* Make the sandbox's pretend channel misbehave, to watch your software meet a bad day: `refuse` (the
|
|
889
|
+
* next `values` nights of prices or stay rules are refused, with your `message` as the channel
|
|
890
|
+
* manager's words), `throttle` ("too many requests" for `minutes`) or `outage` (no answer for
|
|
891
|
+
* `minutes`). One fault at a time: a new one replaces it. Prices and stay rules only: room counts land
|
|
892
|
+
* as before. The answer's `watch` says what to do next and what you should then see, step by step.
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* const fault = await zs.sandbox.faults.set({ kind: "refuse", values: 2, message: "Rate is below the channel's minimum" });
|
|
896
|
+
* for (const step of fault.watch) console.log(step);
|
|
897
|
+
*/
|
|
898
|
+
set: (body: SandboxFault, options?: WriteOptions) => Promise<SandboxFaultView>;
|
|
899
|
+
/** End the fault: the pretend channel answers normally from the next push. Values already held stay held until a different value is sent. */
|
|
900
|
+
clear: (options?: ReadOptions) => Promise<SandboxFaultView>;
|
|
412
901
|
};
|
|
413
902
|
};
|
|
414
903
|
readonly grid: {
|
|
@@ -425,6 +914,7 @@ export declare class ZimmerStack {
|
|
|
425
914
|
*/
|
|
426
915
|
save: (edits: GridEdits, options?: {
|
|
427
916
|
signal?: AbortSignal;
|
|
917
|
+
beforeGoLive?: boolean;
|
|
428
918
|
}) => Promise<WriteAccepted[]>;
|
|
429
919
|
};
|
|
430
920
|
}
|