@zimmerstack/connect 0.4.1 → 0.6.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 +63 -5
- package/README.md +356 -154
- package/dist/cjs/client.d.ts +139 -10
- package/dist/cjs/client.js +184 -6
- package/dist/cjs/generated.d.ts +115 -6
- package/dist/cjs/generated.js +15 -4
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/webhooks.d.ts +21 -11
- package/dist/cjs/webhooks.js +13 -6
- package/dist/esm/client.d.ts +139 -10
- package/dist/esm/client.js +183 -6
- package/dist/esm/generated.d.ts +115 -6
- package/dist/esm/generated.js +15 -4
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/mcp/reference.generated.d.ts +2 -0
- package/dist/esm/mcp/reference.generated.js +231 -16
- package/dist/esm/mcp/reference.js +5 -2
- package/dist/esm/webhooks.d.ts +21 -11
- package/dist/esm/webhooks.js +13 -6
- package/package.json +20 -3
package/AGENTS.md
CHANGED
|
@@ -52,12 +52,63 @@ https://docs.zimmerstack.com/llms-full.txt
|
|
|
52
52
|
- Writes may reach 365 days ahead. A write is accepted (202) when it is in ZimmerStack's record; it
|
|
53
53
|
reaches the channels in seconds to minutes. `zs.sync.get()` says how far along it is.
|
|
54
54
|
|
|
55
|
+
## Room types and rate plans
|
|
56
|
+
|
|
57
|
+
- A hotel sells room types ("Deluxe Room") through rate plans ("Bed and breakfast"). Create or change
|
|
58
|
+
one with `zs.roomTypes.save({ ref, name, roomCount, adults })` and
|
|
59
|
+
`zs.ratePlans.save({ ref, roomTypeRef, name, mealPlan, defaultRate })`. `ref` is the person's own
|
|
60
|
+
id for it: sending the same ref again changes that entity, it never makes a second one. Several in
|
|
61
|
+
one request: `zs.catalog.upsertRoomTypes` and `zs.catalog.upsertRatePlans`. All need the scope
|
|
62
|
+
`catalog:write`.
|
|
63
|
+
- Every later write names ZimmerStack's numeric `id`, not the ref: room counts name a room type's
|
|
64
|
+
id, prices and stay rules name a rate plan's id. `zs.roomTypes.list()` and `zs.ratePlans.list()`
|
|
65
|
+
give them, and so does the answer of each `save`.
|
|
66
|
+
- `zs.roomTypes.delete(idOrRef)` and `zs.ratePlans.delete(idOrRef)` delete for good, and a room
|
|
67
|
+
type takes its rate plans with it. Call them only when a person chose to delete that one entity on
|
|
68
|
+
a screen, after a confirmation that names it. Never from a loop, a sync job, a "reset" or a cleanup
|
|
69
|
+
script, and never to repair a mismatch: send the entity again with `save` instead. A hotel may
|
|
70
|
+
delete 60 entities a day.
|
|
71
|
+
- `CATALOG_CONFLICT` or `CHANNEL_MANAGER_ERROR` on a delete means the hotel still uses it: a
|
|
72
|
+
booking site still sells it, an upcoming stay holds one of its rooms, or rooms are still assigned
|
|
73
|
+
to the room type. Nothing was deleted. Show the message and stop; do not try another way round.
|
|
74
|
+
|
|
75
|
+
## Adding and removing a hotel (a software partner's company key)
|
|
76
|
+
|
|
77
|
+
- Only a COMPANY key with the scope `properties:write` can do either; a hotel's own key cannot
|
|
78
|
+
(`COMPANY_KEY_REQUIRED`). The person ticks "Also add and remove hotels" when making the key in the
|
|
79
|
+
partner portal; only the account's owner or an Admin is offered that tick box. Neither call names a
|
|
80
|
+
hotel with `forProperty`.
|
|
81
|
+
- `zs.properties.create({ name, owner, address, roomTypes })` adds a hotel and answers with its `id`:
|
|
82
|
+
act on it with `zs.forProperty(id)`. The owner gets the sign-in details by email, never the caller.
|
|
83
|
+
It joins the partner's monthly invoice. With a `zsk_test_` key the same call makes a sandbox, which
|
|
84
|
+
is never billed. A partner may add 20 hotels an hour.
|
|
85
|
+
- After adding: the hotel is not on the channel manager yet. The first `zs.roomTypes.save` (or
|
|
86
|
+
`zs.catalog.upsertRoomTypes`) with the same refs puts it there; then the rate plans, then room
|
|
87
|
+
counts and prices.
|
|
88
|
+
- `zs.properties.delete(propertyId, { confirm })` (also `zs.properties.remove`) removes a hotel the
|
|
89
|
+
partner added, FOR GOOD: its booking sites are disconnected, its rate plans and then its room types
|
|
90
|
+
are removed from the channel manager, the hotel is closed and it comes off the invoice from the next
|
|
91
|
+
1st. `confirm` is the hotel's exact name from `zs.properties.list()`. There is no undo, and a
|
|
92
|
+
removed hotel cannot be added again by API.
|
|
93
|
+
- Call `delete` only when a person chose to remove that one hotel on a screen, after typing or
|
|
94
|
+
confirming its name. Never from a loop, a timer, a sync job, a "reset", a cleanup or a test against
|
|
95
|
+
a live key, and never to fix a hotel that looks wrong. A partner may remove
|
|
96
|
+
10 hotels a day.
|
|
97
|
+
- The answer's `channelManager.state` is `REMOVED`, or `RETRYING` when one step is still finishing:
|
|
98
|
+
that is success, ZimmerStack retries it, do not call again in a loop. `PROPERTY_NOT_REMOVABLE` means
|
|
99
|
+
this key may not remove that hotel (its owner let the partner in, or it uses more than the channel
|
|
100
|
+
manager): show the message and stop.
|
|
101
|
+
- Both calls take longer than the others (a removal disconnects the booking sites one after another),
|
|
102
|
+
so the client waits up to 95 seconds for them whatever `timeoutMs` is. If `delete` ends in
|
|
103
|
+
`TIMEOUT` or `NETWORK_ERROR`, the person may press Remove again: a hotel already gone answers
|
|
104
|
+
`replay: true`, one still being removed answers `PROPERTY_BUSY`. Never retry it in a loop.
|
|
105
|
+
|
|
55
106
|
## A channel's price modifier
|
|
56
107
|
|
|
57
108
|
- `zs.channels.setModifier(channelId, steps)` moves EVERY price sent to that channel from then on.
|
|
58
109
|
Call it only when a person saved that setting on a screen. Never from a loop, a timer, a seed
|
|
59
110
|
script or a test against a live key. A hotel may change modifiers 6 times a day.
|
|
60
|
-
-
|
|
111
|
+
- Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.
|
|
61
112
|
Show that sentence where the person saves (`MODIFIER_TAKES_EFFECT`), and offer
|
|
62
113
|
`zs.rates.resend()` as a separate, deliberate button ("Apply to nights already on sale"): 3 a day
|
|
63
114
|
per hotel, never automatic.
|
|
@@ -67,10 +118,16 @@ https://docs.zimmerstack.com/llms-full.txt
|
|
|
67
118
|
## Website bookings: apply them before you push room counts
|
|
68
119
|
|
|
69
120
|
- When the hotel also sells on its own website through ZimmerStack's booking engine, those bookings
|
|
70
|
-
reach you as the webhooks `direct.booking.created
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
121
|
+
reach you as the webhooks `direct.booking.created`, `direct.booking.modified` and
|
|
122
|
+
`direct.booking.cancelled` (the endpoint receives each only when it lists that type) and by
|
|
123
|
+
`zs.directBookings.all({ since })` (scope `direct-bookings:read`). They are not OTA bookings:
|
|
124
|
+
`isWebsiteBookingEvent(event)` tells them apart, `channel.otaName` is `"Website"` and `finance` is null.
|
|
125
|
+
- `direct.booking.modified` is a no-show and its undo, nothing else yet: the hotel recorded that the guest
|
|
126
|
+
did not arrive, or undid that. It is NOT a cancellation: `status` stays CONFIRMED and the payment is
|
|
127
|
+
untouched, so never refund on it. Read `stayStatus` and each room's `status`: NOSHOW gives the nights
|
|
128
|
+
back (they are on sale again on every channel), UPCOMING again holds them. `changes` names what moved
|
|
129
|
+
(`"stayStatus"`, `"rooms[0].status"`); `previous` is the booking as it read before, `stayStatus`
|
|
130
|
+
included. The sandbox does not simulate one: the endpoint's Test button sends the sample.
|
|
74
131
|
- A website booking takes one room off the count the channels hold, at once. A PMS that pushes absolute
|
|
75
132
|
room counts must apply the booking to its own calendar BEFORE its next `zs.availability.set` or
|
|
76
133
|
`zs.grid.save`, or that push puts the sold room back on sale. Read `zs.directBookings.all` before a
|
|
@@ -129,3 +186,4 @@ these tools.
|
|
|
129
186
|
- [ ] Where a modifier is saved, the screen says when it takes effect, and the re-send is its own button.
|
|
130
187
|
- [ ] A PMS that pushes room counts applies every website booking to its own calendar before it pushes.
|
|
131
188
|
- [ ] A website booking is cancelled only from a person's own action, with the refund they chose.
|
|
189
|
+
- [ ] A room type or a rate plan is deleted only from a person's own action, after a confirmation that names it.
|