@ordinatio/scheduling-api 0.4.1 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 (prepared 2026-11-10)
4
+
5
+ - **New agent tools for the waitlist, data export and erasure, and booking analytics (6 more), which completes the agent tools.** Every staff-facing
6
+ route of the scheduling API now has an agent tool or a documented reason it has none. The new tools list the waitlist and take someone off it,
7
+ export or erase everything held about one person (erasing previews unless `confirm` is true, and cannot be undone), read the log of such
8
+ requests, and read booking analytics. The client-facing waitlist routes (join, leave, see and accept an offer) are not tools: they run from a
9
+ client's own private link.
10
+ - **New agent tools for webhooks and routing forms (12 more).** `createSchedulingAgentTools()` now also covers listing, adding, removing and
11
+ testing webhook endpoints, reading their delivery log and retrying a dead-lettered delivery; and listing, reading, creating, changing,
12
+ deleting and testing routing forms. Everything that is not a read carries an approval request. The webhook tool text warns that the
13
+ signing secret is shown once. Routing form questions, rules and fallback are taken as `json-array` and `json-object` parameters, and the
14
+ text lists every operator each question type allows. Both sets need the host to turn the feature on; otherwise the routes answer 501.
15
+ - **New agent tools for coupons, packages and package purchases (11 more).** `createSchedulingAgentTools()` now also covers listing, creating,
16
+ changing and deleting coupons and packages, and listing, giving, cancelling and correcting package purchases. Everything that changes
17
+ something carries an approval request. The text says plainly that giving a client a package records it and takes no payment. The public
18
+ coupon check (`POST /coupons/validate`) is not a tool: it is a POST that changes nothing, and only GET tools run without approval.
19
+ - **Fix: a package linked to an appointment type can now only be used to book that type.** `POST /appointments` with a `packagePurchaseId`
20
+ never compared the package's type with the booked one, so a package bought for one service could pay for any other. It now answers 409
21
+ ("This package cannot be used for this appointment type"). A package linked to no type still covers any type. If you relied on the old behaviour,
22
+ unlink the package from its type.
23
+ - **New agent tools for the cancellation policy (2 more).** `createSchedulingAgentTools()` now also covers reading the policy and saving
24
+ it. Saving asks a person first, takes the fees and the no-show rule as `json-object` parameters, and replaces the whole policy.
25
+ The tool text says plainly that this API stores the fees and the card-on-file switch but does not charge them. Needs the
26
+ `@ordinatio/scheduling` release that adds the organization `settings` column.
27
+ - **Fix: a coupon can no longer be edited into a percentage over 100.** `PUT /admin/coupons/[id]` checked nothing about the value after the edit, so
28
+ sending a new value of 150 for a percentage coupon, or changing a flat coupon of 500 to a percentage, was accepted and would make every
29
+ booking free. It now answers 400, as creating one already did.
30
+ - **Fix: renaming a coupon to a code that is already taken now answers 409 in plain words.** `PUT /admin/coupons/[id]` answered 500 with the database's message.
31
+ - **Fix: a package can only be linked to an appointment type of its own organization.** `POST /admin/packages` and `PUT /admin/packages/[id]`
32
+ accepted any type id, and the answer then named that type. They now answer 404.
33
+ - **Fix: `GET` and `PUT /admin/policy` need the next `@ordinatio/scheduling` release.** On a database built from the packaged schema they
34
+ answered 500, because the organization table had no `settings` or `updatedAt` column. The engine now has a migration that adds
35
+ them; run `prisma migrate deploy` after upgrading it. No change to this package was needed.
36
+ - **Changing a calendar's timezone now clears its stored free times.** `PUT /admin/calendars/[id]` already did this when the slot size
37
+ changed. After a timezone change, the booking page and `scheduling_check_availability` could keep offering the old times for up to a minute.
38
+
39
+ - **New agent tools for repeating bookings and group sessions (5 more).** `createSchedulingAgentTools()` now also covers listing and
40
+ reading repeating series, creating a series, cancelling one visit, the rest of a series or all of it, and listing group sessions with
41
+ their seats taken. Creating and cancelling carry an approval request.
42
+ - **Fix: a repeating series with a visit at exactly the time of an existing booking now answers 409 in plain words.**
43
+ `POST /admin/recurring` used to answer 500 with the database's own message. Nothing is saved either way.
44
+ - **New agent tools for categories, message templates and the brand (11 more).** `createSchedulingAgentTools()` now also covers
45
+ listing, creating, renaming and deleting appointment categories; listing, creating, changing and deleting the email and text
46
+ message templates; and reading, saving and removing the brand. Everything that changes something carries an approval request.
47
+ The template tools list every `{{value}}` a message can use.
48
+ - **Fix: an email template whose subject is only tags (such as `<b></b>`) is now refused as having no subject.**
49
+ `POST /admin/templates` used to save it with an empty subject; the update route already refused it.
50
+
3
51
  ## 0.4.1 (2026-11-07)
4
52
 
5
53
  This release adds 20 agent tools and one fix. The tools that take a list of objects (weekly hours, intake form) need an agent runner
package/README.md CHANGED
@@ -356,12 +356,16 @@ const tools = createSchedulingAgentTools({ basePath: '/api/scheduling' }); // re
356
356
 
357
357
  Each tool maps to a route, says when to use it, lists its parameters and gives an example. Reads run freely. Every tool that
358
358
  changes something, sends a message or moves money carries an `requiresApproval` entry, so the runner asks a person first. The tools
359
- call your routes. Tools on staff routes use the signed-in person's session, so the usual sign-in, role and organization checks apply. Tools on the public booking routes (`auth: 'none'`: availability, appointment types, capacity and booking) behave exactly like the public widget: no staff sign-in, rate limited by address, and without the staff member's calendar visibility. Give those to an agent only if that is what you want. Parameter types are `string`, `number`, `boolean`, `string[]` and `json-object`. The booking tool's `intakeResponses` is a `json-object`: a runner that turns types it does not know into text cannot pass intake answers, so it needs to offer that type to the model as an object (`@ordinatio/agent` does, except for Gemini, where booking with intake answers does not work yet).
359
+ call your routes. Tools on staff routes use the signed-in person's session, so the usual sign-in, role and organization checks apply. Tools on the public booking routes (`auth: 'none'`: availability, appointment types, capacity and booking) behave exactly like the public widget: no staff sign-in, rate limited by address, and without the staff member's calendar visibility. Give those to an agent only if that is what you want. Parameter types are `string`, `number`, `boolean`, `string[]`, `json-object` and `json-array`. The booking tool's `intakeResponses` is a `json-object` (and the routing-form and cancellation-policy tools take objects and arrays too): a runner that turns types it does not know into text cannot pass them, so it needs to offer those types to the model as objects and arrays (`@ordinatio/agent` does, except for Gemini, where booking with intake answers does not work yet).
360
360
 
361
- Some routes are left out on purpose, such as the public booking widget, link-token self-service, worker entry points and browser
362
- sign-in steps; `SCHEDULING_AGENT_EXCLUDED` gives the reason for each. `SCHEDULING_AGENT_PENDING` lists the routes that do not have a
363
- tool yet (appointment types, availability rules, recurring series, coupons, packages, policy, webhooks, routing forms,
364
- waitlist, privacy, analytics). That list only gets shorter: a test fails if a route is in none of the three places.
361
+ Every staff-facing route has a tool: appointments, calendars, appointment types, opening hours, recurring series, settings,
362
+ cancellation policy, coupons, packages, webhooks, routing forms, waitlist, data export and erasure, and analytics. Tools for
363
+ webhooks, routing forms, waitlist and privacy need the host to turn that feature on; otherwise the route answers 501. Analytics is on unless
364
+ the host's `bookingAnalyticsEnabled` says no.
365
+
366
+ Some routes are left out on purpose, such as the public booking widget, client-link self-service (including the client-facing waitlist
367
+ routes), the public coupon check, worker entry points and browser sign-in steps; `SCHEDULING_AGENT_EXCLUDED` gives the reason for each.
368
+ `SCHEDULING_AGENT_PENDING` is empty, and a test fails if a new route is in neither the tools nor the excluded list.
365
369
 
366
370
  ## Serving the routes
367
371