@davidwoods/skylight-mcp 1.19.0 → 1.21.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/README.md +57 -16
- package/dist/api/client.d.ts +7 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +20 -8
- package/dist/api/client.js.map +1 -1
- package/dist/api/endpoints/calendar.d.ts +13 -0
- package/dist/api/endpoints/calendar.d.ts.map +1 -1
- package/dist/api/endpoints/calendar.js +26 -0
- package/dist/api/endpoints/calendar.js.map +1 -1
- package/dist/api/endpoints/meals.d.ts +23 -0
- package/dist/api/endpoints/meals.d.ts.map +1 -1
- package/dist/api/endpoints/meals.js +49 -8
- package/dist/api/endpoints/meals.js.map +1 -1
- package/dist/api/oauth.d.ts +4 -1
- package/dist/api/oauth.d.ts.map +1 -1
- package/dist/api/oauth.js +10 -8
- package/dist/api/oauth.js.map +1 -1
- package/dist/lib.d.ts +9 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +31 -8
- package/dist/lib.js.map +1 -1
- package/dist/setup.d.ts +51 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +164 -0
- package/dist/setup.js.map +1 -0
- package/dist/tools/calendar.d.ts.map +1 -1
- package/dist/tools/calendar.js +23 -4
- package/dist/tools/calendar.js.map +1 -1
- package/dist/tools/meals.d.ts.map +1 -1
- package/dist/tools/meals.js +24 -8
- package/dist/tools/meals.js.map +1 -1
- package/dist/tools/planning.d.ts.map +1 -1
- package/dist/tools/planning.js +54 -16
- package/dist/tools/planning.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +12 -1
- package/dist/tools/registry.js.map +1 -1
- package/dist/utils/errors.d.ts +9 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +13 -0
- package/dist/utils/errors.js.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -10,6 +10,14 @@ calendar, chores, lists, meals and rewards.
|
|
|
10
10
|
> blocked at any time, without notice. Use it with your own account, at your
|
|
11
11
|
> own risk, and keep request volume modest.
|
|
12
12
|
>
|
|
13
|
+
> Sign-in reuses the Skylight mobile app's own OAuth flow: it presents the app's
|
|
14
|
+
> client ID (`skylight-mobile`) and redirect, because Skylight issues no client
|
|
15
|
+
> of its own to third parties. Skylight's
|
|
16
|
+
> [Terms of Service](https://myskylight.com/tos/) prohibit access by means other
|
|
17
|
+
> than its supported interfaces and reverse engineering (§5.4), and let Skylight
|
|
18
|
+
> suspend accounts with or without cause (§16). Using this project is a risk to
|
|
19
|
+
> the Skylight account you sign in with, not only to the integration.
|
|
20
|
+
>
|
|
13
21
|
> Forked from [TheEagleByte/skylight-mcp](https://github.com/TheEagleByte/skylight-mcp)
|
|
14
22
|
> (MIT). The sign-in and credential-store design follows
|
|
15
23
|
> [kamilio/skylight-calendar-agent](https://github.com/kamilio/skylight-calendar-agent)
|
|
@@ -246,6 +254,12 @@ Sources are tried in this order:
|
|
|
246
254
|
|
|
247
255
|
If none is present the server fails with instructions rather than starting.
|
|
248
256
|
|
|
257
|
+
The browser sign-in is the mobile app's flow, not one Skylight offers to third
|
|
258
|
+
parties: the server opens Skylight's own sign-in page with the app's client ID
|
|
259
|
+
(`skylight-mobile`), PKCE (S256) and a state check, and you paste back the
|
|
260
|
+
`ourskylight.com/welcome` address it lands on. Your password never reaches this
|
|
261
|
+
project. Skylight could change or block this flow at any time.
|
|
262
|
+
|
|
249
263
|
Where the credential lives:
|
|
250
264
|
|
|
251
265
|
| Platform | Location | Protection |
|
|
@@ -431,16 +445,16 @@ last captured are recorded in the repository's build log.
|
|
|
431
445
|
|
|
432
446
|
| Area | What works | Hosted server (Claude Duet) | Status |
|
|
433
447
|
|------|------------|------------------------------|--------|
|
|
434
|
-
| Calendar | Read events and source calendars; create (with profiles), update, delete events |
|
|
435
|
-
| Planning | Week overview, conflicts, free slots, bulk meal plan | All four |
|
|
436
|
-
| Meals (Plus) | Read categories and meals; create, rename, move, delete one-off meals | All, delete included | Live-tested |
|
|
448
|
+
| Calendar | Read events and source calendars; create (with profiles), update, delete events | All, delete included (preview first; never subscribed feed events). Removing a synced calendar or a label is local only | Read, create, update and delete live-tested, including repeating events (edit scopes one and all; delete scopes one, future and all), all-day series and a one-off event written to a Google calendar. Not yet live: a series written to Google |
|
|
449
|
+
| Planning | Week overview, conflicts, free slots, bulk meal plan | All four | All four live-tested (conflicts and free slots as reads; the bulk meal plan through the hosted server) |
|
|
450
|
+
| Meals (Plus) | Read categories and meals, with who each meal is for; create, rename, move, delete one-off meals | All, delete included | Live-tested, except the "who it is for" read, which is tested only against mocked responses until it is run on a real frame |
|
|
437
451
|
| Recipes (Plus) | Read, create, update, delete recipes; push ingredients to the grocery list | All, delete included | Inherited |
|
|
438
452
|
| Messages | Read; post to everyone or to named profiles (silent by default); edit text and sender (everyone-messages only); delete | All four, delete included | Live-tested |
|
|
439
|
-
| Chores and routines | Read (routines marked, Up for Grabs included); create, update, delete chores; mark one occurrence of a routine or recurring chore done or not done | All, delete included | Read live-tested; completion captured live, tool not yet run live; the rest inherited |
|
|
440
|
-
| Task box | List items; add a task | Yes | List live-tested; add inherited |
|
|
453
|
+
| Chores and routines | Read (routines marked, Up for Grabs included); create, update, delete chores; mark one occurrence of a routine or recurring chore done or not done | All, delete included | Read, create and delete live-tested; completion captured live, tool not yet run live; the rest inherited |
|
|
454
|
+
| Task box | List items; add a task; delete a template by id | Yes, delete included | List and delete live-tested; add inherited |
|
|
441
455
|
| Lists | Read lists and items; create, update, delete lists and items | All, delete included | Inherited |
|
|
442
456
|
| Family and devices | Profiles with IDs, avatars, colours, household info, devices | Yes | Profiles live-tested; the rest inherited |
|
|
443
|
-
| Rewards (Plus) | Read points (by profile) and rewards; create, update, redeem, unredeem, delete | All, delete included |
|
|
457
|
+
| Rewards (Plus) | Read points (by profile) and rewards; create, update, redeem, unredeem, delete | All, delete included | Points read, create and delete live-tested; the rest inherited |
|
|
444
458
|
| Photos (Plus) | List albums | No | Inherited |
|
|
445
459
|
|
|
446
460
|
### Not supported
|
|
@@ -448,7 +462,7 @@ last captured are recorded in the repository's build log.
|
|
|
448
462
|
Nothing here is hidden behind a flag. It is either unavailable from Skylight or not yet captured.
|
|
449
463
|
|
|
450
464
|
- **Messages**: sending to specific devices, scheduling, repeating, voice notes, and read-aloud (the option exists on `send_message` but was not tested live). Deleting works but the app has no delete button.
|
|
451
|
-
- **Meals**: editing a repeating meal (refused), repeat rules other than weekly, deleting a meal that was edited on its own after being in a series (refused), saving a meal to the recipe box from the edit form, and Skylight's own "Plan Meals" feature.
|
|
465
|
+
- **Meals**: editing a repeating meal (refused), repeat rules other than weekly, deleting a meal that was edited on its own after being in a series (refused), saving a meal to the recipe box from the edit form, assigning a meal to a label or anything but a profile (`profiles` takes profile names only; the typed argument was run live on 2026-11-13 for create, rename, unassign and the planner, but not for repeating or multi-profile meals), assigning every profile at once (Skylight has no "everyone" option, so name them), and Skylight's own "Plan Meals" feature.
|
|
452
466
|
- **Task box**: editing or completing tasks, and saving a routine template to it.
|
|
453
467
|
- **Chores**: completing a one-off (non-recurring) chore, Skip, daily or monthly routine schedules (only the weekly format has been captured), and editing a recurring chore's date, time, assignee or stars. Un-completing a routine cannot reduce its `longest_streak`. Whether "this and future" from a later day keeps the earlier days has not been checked (the capture started from the first day).
|
|
454
468
|
- **Profiles**: creating or editing them. Read-only.
|
|
@@ -468,7 +482,9 @@ tool, update this section in the same change.
|
|
|
468
482
|
|
|
469
483
|
Effects: **read** changes nothing; **write** creates or edits and can be edited
|
|
470
484
|
again; **destructive** cannot be undone from the API. The hosted server registers
|
|
471
|
-
read and write
|
|
485
|
+
read and write tools plus a fixed list of deletes, each preview-first (see "Which tools the hosted server exposes, and why"); `delete_source_calendar` and `delete_label` exist on the local server alone.
|
|
486
|
+
|
|
487
|
+
Every tool refuses an argument it does not know and names it, so a misspelt argument is an error, never a call that quietly ran with defaults.
|
|
472
488
|
|
|
473
489
|
### Planning Tools
|
|
474
490
|
|
|
@@ -477,7 +493,7 @@ One call returns calendar, chores/tasks, meals and lists, merged per day.
|
|
|
477
493
|
|
|
478
494
|
| Tool | Effect | Description |
|
|
479
495
|
|------|--------|-------------|
|
|
480
|
-
| `get_week_overview` | read | Per-day events, chores/tasks (status, assignee, points), meals, overdue chores, conflicts and list summaries in one compact call. Omits owner emails and calendar IDs. |
|
|
496
|
+
| `get_week_overview` | read | Per-day events, chores/tasks (status, assignee, points), meals (every meal in a slot, with who it is for), overdue chores, conflicts and list summaries in one compact call. Omits owner emails and calendar IDs. |
|
|
481
497
|
| `find_conflicts` | read | Timed events that overlap in a date range. All-day events never conflict. A subscribed feed that lists the same event twice (same start, end and title apart from a trailing note such as "Arrive 20 minutes early") is reported separately as a duplicate, not a conflict. |
|
|
482
498
|
| `find_free_slots` | read | Gaps of at least N minutes inside a daily window (default 08:00 to 21:00). |
|
|
483
499
|
| `plan_week_meals` | write | Fill several meal slots at once. `dryRun` previews; occupied slots are skipped, never overwritten; all entries are validated before anything is written, and the text is checked: a placeholder such as `(plan doc URL)` refuses a real write, while an over-long name, a dessert over two words, non-ASCII characters or a cooking step in a note are reported as warnings that never block; optional grocery push for recipes. Entries can carry `note` and `description` (the app's "Instructions or ingredients" field), attached after the meal is created. |
|
|
@@ -504,7 +520,7 @@ Messages are the notes shown on the frame (Skylight's web app calls them "nudges
|
|
|
504
520
|
| `delete_source_calendar` | destructive | Stop syncing a subscribed calendar feed (a team, school or league schedule). Preview first, then `confirm: true`. Its events leave the family calendar and wall display until it is added again. Feeds only (`kind: webcal`); account calendars are refused. Local server only. |
|
|
505
521
|
| `update_source_calendar_profiles` | write | Link a subscribed calendar feed to family profiles, or unlink it (the "Link profiles" checkboxes). Preview first, then `confirm: true`; it sends the complete set so the calendar's label is kept, then reads it back. Feeds only (`kind: webcal`); a calendar can never be left with no profile or label. |
|
|
506
522
|
| `rename_source_calendar` | write | Rename a subscribed calendar feed as it appears in Skylight (feeds are named from the feed itself, often at length). Preview first, then `confirm: true`; reads it back and checks the linked profiles did not change. Feeds only (`kind: webcal`). |
|
|
507
|
-
| `create_calendar_event` | write | Add an event. `profiles` assigns it to named family members. Local times are sent with the frame's UTC offset. `repeat` (daily or weekly, ends by `until` or `count`, at most 104 occurrences) makes a series; a series is only previewed until `confirm: true`, is created on Skylight's own calendar by default (not written to Google), and is refused for multi-profile. An all-day series (`allDay: true`, one day per occurrence, `endsAt` the day after `startsAt`) is allowed
|
|
523
|
+
| `create_calendar_event` | write | Add an event. `profiles` assigns it to named family members. Local times are sent with the frame's UTC offset. `repeat` (daily or weekly, ends by `until` or `count`, at most 104 occurrences) makes a series; a series is only previewed until `confirm: true`, is created on Skylight's own calendar by default (not written to Google), and is refused for multi-profile. An all-day series (`allDay: true`, one day per occurrence, `endsAt` the day after `startsAt`) is allowed (verified live 2026-11-09 on Skylight's own calendar). `calendar` (the name of a linked Google calendar, only when asked for) writes a one-off event or a series to that Google calendar instead, shows for everyone who shares it, and is also previewed until `confirm: true`; it refuses a read-only calendar and one whose account cannot be determined. A one-off event written to Google is verified live (2026-11-09); a series written to Google is not yet. `dinner: true` makes a free-tier "Dinner plan" instead (Skylight's stand-in for Meals on an account without Plus: an all-day event of kind `meal`, tagged "Dinner Plan" by Skylight; date only, no profiles, calendar or repeat); shape captured from the web app; the same request body verified live on a free account 2026-11-10 (create, read back, delete), the tool call itself not yet. |
|
|
508
524
|
| `update_calendar_event` | write | Change an event, including who it is assigned to (`profiles`). For a repeating event give the occurrence's `date` and a `scope`: `one` (that occurrence only, which becomes its own event) or `all` (the whole series; overwrites earlier single-occurrence edits). On a series you can change the title, the assignment and the time of day (`startsAt` and `endsAt` together, on the occurrence's date); the time change is verified live for both scopes (`one` detaches that occurrence as its own event; ids change, so re-read before the next call). Notes, location and all-day stay refused. There is no `future` scope: Skylight's API refuses it. Events on a Google calendar change at Google too. |
|
|
509
525
|
| `delete_calendar_event` | destructive | Delete one event, or part of a repeating one. Needs the event's `date`; preview first, then `confirm: true`. A repeating event needs a `scope`: `one`, `future` (this and later occurrences) or `all` (the whole series); the preview says which. Events on a Google calendar are deleted at Google too, for everyone who shares it. Refuses subscribed-feed events, non-editable events, an occurrence that was edited on its own, and a repeating event with no scope. Reads the day back to confirm it is gone. Also on the hosted server. |
|
|
510
526
|
|
|
@@ -559,9 +575,9 @@ Meals and recipes need Skylight Plus.
|
|
|
559
575
|
| Tool | Effect | Description |
|
|
560
576
|
|------|--------|-------------|
|
|
561
577
|
| `get_meal_categories` | read | Breakfast, Lunch, Dinner, Snack and their IDs |
|
|
562
|
-
| `get_meal_sittings` | read | Scheduled meals in a date range, with sitting IDs; `details: true` also prints notes and instructions |
|
|
563
|
-
| `create_meal_sitting` | write | Schedule a meal on a date (free text or a saved recipe). `repeat: "weekly"` repeats it every week on that weekday. |
|
|
564
|
-
| `update_meal_sitting` | write | Rename, re-categorise, or set the note or the instructions (`description`) of a meal, by sitting ID and its current date; one-offs can also be moved. Repeating meals need `scope` (`one`, `future`, `all`), are preview-first and need `confirm: true`; they cannot be moved. `one` and `future` return a new sitting ID. |
|
|
578
|
+
| `get_meal_sittings` | read | Scheduled meals in a date range, with sitting IDs and who each is for (`for: name, name`; none printed means unassigned); `details: true` also prints notes and instructions |
|
|
579
|
+
| `create_meal_sitting` | write | Schedule a meal on a date (free text or a saved recipe). `repeat: "weekly"` repeats it every week on that weekday. `profiles` names who it is for (exact profile names; an unknown name changes nothing); one meal per person can share a day and category. Run live 2026-11-13: assigned create, and `plan_week_meals` with one meal per person. Not run live: weekly plus profiles. |
|
|
580
|
+
| `update_meal_sitting` | write | Rename, re-categorise, or set the note or the instructions (`description`) of a meal, by sitting ID and its current date; one-offs can also be moved. `profiles` replaces who it is for (`[]` unassigns; omitted keeps it). Repeating meals need `scope` (`one`, `future`, `all`), are preview-first and need `confirm: true`; they cannot be moved. `one` and `future` return a new sitting ID. |
|
|
565
581
|
| `delete_meal_sitting` | destructive | Delete a meal. For a repeating meal, `scope` is `one` (default), `future` or `all` (whole series). Previews unless `confirm: true`; reports success only when Skylight confirms the removal. A meal edited on its own after being in a series is refused. |
|
|
566
582
|
| `get_recipes` / `get_recipe` | read | Browse saved recipes |
|
|
567
583
|
| `create_recipe` / `update_recipe` | write | Add or change a recipe |
|
|
@@ -608,7 +624,32 @@ const events = await skylight.calendar.events({ from: "2026-11-09", to: "2026-11
|
|
|
608
624
|
|
|
609
625
|
Read methods only: `calendar.events`, `calendar.sources`, `profiles.list`, `chores.list`, `meals.sittings`, `meals.recipes`, `meals.categories`, `lists.list`, `lists.items`. They return plain objects, never raw Skylight records: no emails, event uids, calendar or account ids, or subscription feed addresses (a feed shows only its host; an email-shaped calendar label is replaced). Event ids are opaque: a repeating event's occurrence ids change after a time edit, so do not store or compare them.
|
|
610
626
|
|
|
611
|
-
|
|
627
|
+
Behaviour an importer should plan for:
|
|
628
|
+
- `chores.list` takes one day (`{ date }`) or a range (`{ from, to }`, both included, at most 31 days), plus an optional `profile`. A repeating chore appears once per day it falls on, and each item's `date` is that day. The range is not yet verified against live Skylight.
|
|
629
|
+
- One `createSkylight` client holds one sign-in and caches what it read from your store, including "nothing stored". After `completeLogin` writes a new credential, or after any `AuthenticationError`, make a new client.
|
|
630
|
+
- Profile names and colours are cached for up to 5 minutes per client, so a renamed profile can show its old name for up to 5 minutes.
|
|
631
|
+
- If a refreshed credential cannot be written to your store, the call fails with `CredentialSaveError` (an `AuthenticationError`, `code` `CREDENTIAL_SAVE_FAILED`). Refresh tokens rotate, so the old one in your store is already spent: treat it as signed out and sign in again. The error never includes your store's own message.
|
|
632
|
+
- The library writes no per-request log lines. Errors and warnings still go to `console.error`.
|
|
633
|
+
|
|
634
|
+
What is not there, on purpose: writes, deletes, messages, source-calendar and feed management, and any function that takes a URL or a feed address (sign-in lives in the separate setup entry below, which accepts exactly one address: the Skylight redirect you paste). There is no host or fetch option; the API host is fixed in code and an unknown option is refused. Only the package root and `/setup` are importable (deep imports such as `dist/api/client.js` fail). The library holds a live sign-in, so it stops accidents and token leaks, not a malicious importer. Verified read-only against a real frame on 2026-11-09 (chores and list items were empty that day).
|
|
635
|
+
|
|
636
|
+
### Signing in from your own app (setup entry, experimental)
|
|
637
|
+
|
|
638
|
+
An app that keeps its own credential store signs in with the same browser-paste flow as the CLI, through a separate entry. Call it from a setup page only, and protect that page yourself.
|
|
639
|
+
|
|
640
|
+
```ts
|
|
641
|
+
import { beginLogin, completeLogin, loginStatus } from "@davidwoods/skylight-mcp/setup";
|
|
642
|
+
|
|
643
|
+
const { loginUrl } = await beginLogin({ pending }); // show loginUrl; the person signs in at Skylight
|
|
644
|
+
await completeLogin({ pending, credential, redirectUrl }); // the https://ourskylight.com/welcome?code=... address they paste
|
|
645
|
+
await loginStatus({ credential }); // { signedIn, expired, expiresAt }
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
- `pending` is your store for the ten-minute pending sign-in: `save(value)` and an atomic `take()` (read and delete in one step). `credential` is the same store you give `createSkylight`.
|
|
649
|
+
- Nothing secret is returned: the credential is written straight into your store. PKCE (S256) and the state check are always on, and a pending sign-in works once.
|
|
650
|
+
- The pasted address must be the Skylight redirect (`https://ourskylight.com/welcome`); anything else is refused before any request and is never echoed in an error. There is no host or fetch option.
|
|
651
|
+
- Give each app its own sign-in. Refresh tokens rotate, so two apps sharing one credential break each other. A new sign-in did not interrupt two other sessions on the same account: both kept reading in the minutes after it (2026-11-09) and again about 36 hours later, after at least one token refresh each (2026-11-11), with a further sign-in in between. This is one account observed on two days, not a guarantee from Skylight.
|
|
652
|
+
- Verified against live Skylight under Node on 2026-11-09, and inside the Workers runtime (`nodejs_compat`) against a stubbed token endpoint. Not yet run with a Durable Object store.
|
|
612
653
|
|
|
613
654
|
## Skylight API calls used
|
|
614
655
|
|
|
@@ -622,7 +663,7 @@ All calls go to `https://app.ourskylight.com/api` (pinned in code). `{f}` is the
|
|
|
622
663
|
| Recipes | `GET/POST /meals/recipes`, `GET/PATCH/DELETE /meals/recipes/{id}`, `POST /meals/recipes/{id}/add_to_grocery_list` |
|
|
623
664
|
| Profiles and family | `GET /frames/{f}/categories` (live), `GET /frames/{f}`, `GET /frames/{f}/devices`, `GET /api/avatars`, `GET /api/colors` |
|
|
624
665
|
| Chores and routines | `GET /frames/{f}/chores` (live; `include_up_for_grabs`), `POST /chores`, `PUT/DELETE /chores/{id}` (one-off), `PUT /chores/{occurrence id}` (flat `{summary}` or `{recurrence_set}`; re-keys the chore), `DELETE /chores/{occurrence id}?apply_to=future\|all`, `PUT /chores/{series id}/completions` (body `status` `complete`/`pending`, `instance_date`, `instance_time`), `POST /chores/create_multiple`. All routine calls captured from the web app; the tools are not yet run live |
|
|
625
|
-
| Task box | `GET /frames/{f}/task_box/items` (live), `POST /frames/{f}/task_box/items` |
|
|
666
|
+
| Task box | `GET /frames/{f}/task_box/items` (live), `POST /frames/{f}/task_box/items`, `DELETE /frames/{f}/task_box/items/{id}` (live) |
|
|
626
667
|
| Lists | `GET/POST /lists`, `GET/PUT/DELETE /lists/{id}`, `POST /lists/{id}/list_items`, `PUT/DELETE /lists/{id}/list_items/{itemId}` |
|
|
627
668
|
| Rewards | `GET/POST /rewards`, `PATCH/DELETE /rewards/{id}`, `POST /rewards/{id}/redeem`, `POST /rewards/{id}/unredeem`, `GET /reward_points` |
|
|
628
669
|
| Photos | `GET /frames/{f}/albums` (local only) |
|
|
@@ -729,4 +770,4 @@ MIT
|
|
|
729
770
|
|
|
730
771
|
## Disclaimer
|
|
731
772
|
|
|
732
|
-
This is an unofficial integration. The Skylight API is reverse-engineered and may change without notice. Use at your own risk.
|
|
773
|
+
This is an unofficial integration, not affiliated with or endorsed by Skylight. The Skylight API is reverse-engineered from observed app and web traffic and may change without notice. Sign-in reuses the mobile app's OAuth client. Skylight's [Terms of Service](https://myskylight.com/tos/) prohibit unsupported access and reverse engineering (§5.4) and allow account suspension (§16); you take that risk for the account you use. This project only exposes features your Skylight subscription includes. Use at your own risk.
|
package/dist/api/client.d.ts
CHANGED
|
@@ -23,11 +23,17 @@ export declare class SkylightClient {
|
|
|
23
23
|
private stored;
|
|
24
24
|
private storedLoaded;
|
|
25
25
|
private refreshPromise;
|
|
26
|
+
private readonly quiet;
|
|
26
27
|
/**
|
|
27
28
|
* @param store Where the OAuth credential lives. `null` means "no stored
|
|
28
29
|
* credential is available" (hosted mode, where the token arrives in config).
|
|
30
|
+
* @param options.quiet No per-request trace lines (the library sets this; an importer's
|
|
31
|
+
* logs are not ours to fill). Errors and warnings still print.
|
|
29
32
|
*/
|
|
30
|
-
constructor(config?: Config, store?: CredentialStore | null
|
|
33
|
+
constructor(config?: Config, store?: CredentialStore | null, options?: {
|
|
34
|
+
quiet?: boolean;
|
|
35
|
+
});
|
|
36
|
+
private get traceOff();
|
|
31
37
|
private getStore;
|
|
32
38
|
/** Load the stored OAuth credential once. Fails closed if the store is unusable. */
|
|
33
39
|
private loadStored;
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAGrE,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAGrE,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAWnF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,G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AAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1G;;OAEG;IACG,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1D;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,qBAAqB,IAAI,kBAAkB;IAI3C;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlC;AAMD,wBAAgB,SAAS,IAAI,cAAc,CAO1C;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,eAAe,GAAG,IAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAIrH"}
|
package/dist/api/client.js
CHANGED
|
@@ -4,7 +4,7 @@ import { SKYLIGHT_API_VERSION, SKYLIGHT_BASE_URL } from "./constants.js";
|
|
|
4
4
|
import { CredentialStoreError } from "./credential-types.js";
|
|
5
5
|
import { currentContext } from "../context.js";
|
|
6
6
|
import { OAuthError, isExpired, refreshCredential } from "./oauth.js";
|
|
7
|
-
import { AuthenticationError, NotFoundError, RateLimitError, SkylightError, } from "../utils/errors.js";
|
|
7
|
+
import { AuthenticationError, CredentialSaveError, NotFoundError, RateLimitError, SkylightError, } from "../utils/errors.js";
|
|
8
8
|
/**
|
|
9
9
|
* Skylight API Client
|
|
10
10
|
* Handles authentication and HTTP requests to the Skylight API
|
|
@@ -30,13 +30,20 @@ export class SkylightClient {
|
|
|
30
30
|
stored = null;
|
|
31
31
|
storedLoaded = false;
|
|
32
32
|
refreshPromise = null;
|
|
33
|
+
quiet;
|
|
33
34
|
/**
|
|
34
35
|
* @param store Where the OAuth credential lives. `null` means "no stored
|
|
35
36
|
* credential is available" (hosted mode, where the token arrives in config).
|
|
37
|
+
* @param options.quiet No per-request trace lines (the library sets this; an importer's
|
|
38
|
+
* logs are not ours to fill). Errors and warnings still print.
|
|
36
39
|
*/
|
|
37
|
-
constructor(config, store = null) {
|
|
40
|
+
constructor(config, store = null, options = {}) {
|
|
38
41
|
this.config = config ?? getConfig();
|
|
39
42
|
this.store = store;
|
|
43
|
+
this.quiet = options.quiet === true;
|
|
44
|
+
}
|
|
45
|
+
get traceOff() {
|
|
46
|
+
return quietRequestLog || this.quiet;
|
|
40
47
|
}
|
|
41
48
|
getStore() {
|
|
42
49
|
if (!this.store) {
|
|
@@ -88,14 +95,19 @@ export class SkylightClient {
|
|
|
88
95
|
}
|
|
89
96
|
throw error;
|
|
90
97
|
}
|
|
91
|
-
this.stored = next;
|
|
92
98
|
try {
|
|
93
99
|
await this.getStore().write(next);
|
|
94
100
|
}
|
|
95
|
-
catch
|
|
96
|
-
// The
|
|
97
|
-
|
|
101
|
+
catch {
|
|
102
|
+
// Fail closed. The store's message is not printed: it could contain the credential.
|
|
103
|
+
// Forget everything held in memory so no later call quietly keeps a session that a
|
|
104
|
+
// restart could not recover; the next call re-reads the store and asks for a sign-in.
|
|
105
|
+
console.error("[client] Could not save the refreshed credential; this session has ended.");
|
|
106
|
+
this.stored = null;
|
|
107
|
+
this.storedLoaded = false;
|
|
108
|
+
throw new CredentialSaveError();
|
|
98
109
|
}
|
|
110
|
+
this.stored = next;
|
|
99
111
|
return next;
|
|
100
112
|
})().finally(() => {
|
|
101
113
|
this.refreshPromise = null;
|
|
@@ -230,7 +242,7 @@ export class SkylightClient {
|
|
|
230
242
|
// Replace {frameId} placeholder with actual frame ID
|
|
231
243
|
const resolvedEndpoint = endpoint.replace("{frameId}", this.config.frameId);
|
|
232
244
|
const url = this.buildUrl(resolvedEndpoint, params);
|
|
233
|
-
if (!
|
|
245
|
+
if (!this.traceOff)
|
|
234
246
|
console.error(`[client] ${method} ${redactForLog(url)}`);
|
|
235
247
|
const headers = {
|
|
236
248
|
Authorization: await this.getAuthHeader(),
|
|
@@ -246,7 +258,7 @@ export class SkylightClient {
|
|
|
246
258
|
headers,
|
|
247
259
|
body: body ? JSON.stringify(body) : undefined,
|
|
248
260
|
});
|
|
249
|
-
if (!
|
|
261
|
+
if (!this.traceOff)
|
|
250
262
|
console.error(`[client] Response: ${response.status}`);
|
|
251
263
|
if (!response.ok) {
|
|
252
264
|
// Retry once on 401 with a fresh credential (not for an explicit token)
|
package/dist/api/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAe,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAwB,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAyB,MAAM,YAAY,CAAC;AAC7F,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,oBAAoB,CAAC;AAe5B;;;GAGG;AACH;;;GAGG;AACH,IAAI,eAAe,GAAG,KAAK,CAAC;AAC5B,wHAAwH;AACxH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,eAAe,GAAG,KAAK,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,OAAO,cAAc;IACjB,MAAM,CAAS;IACf,aAAa,GAAkB,IAAI,C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E;AAC1E,0DAA0D;AAC1D,IAAI,cAAc,GAA0B,IAAI,CAAC;AAEjD,MAAM,UAAU,SAAS;IACvB,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IACnC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAmB,CAAC,2CAA2C,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAe,EAAE,QAAgC,IAAI;IAC1F,cAAc,GAAG,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnD,MAAM,cAAc,CAAC,UAAU,EAAE,CAAC;IAClC,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -14,6 +14,19 @@ export declare function getCalendarEvents(options: GetCalendarEventsOptions): Pr
|
|
|
14
14
|
* Get source calendars (connected calendar accounts)
|
|
15
15
|
*/
|
|
16
16
|
export declare function getSourceCalendars(): Promise<SourceCalendarResource[]>;
|
|
17
|
+
/**
|
|
18
|
+
* A free-tier "Dinner plan": what the Skylight web app sends on an account without Plus, where
|
|
19
|
+
* the calendar's + button offers "Dinner plan" in place of Meals (captured 2026-11-10, 200). It
|
|
20
|
+
* is an ordinary all-day calendar event with kind "meal"; the server tags it with a "Dinner Plan"
|
|
21
|
+
* label itself. Dates only (YYYY-MM-DD), one day, no profiles, no synced calendar, no repeat:
|
|
22
|
+
* only that shape was captured.
|
|
23
|
+
*/
|
|
24
|
+
export declare function dinnerPlanEvent(options: {
|
|
25
|
+
title: string;
|
|
26
|
+
date: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
timeZone: string;
|
|
29
|
+
}): CreateCalendarEventRequest;
|
|
17
30
|
/**
|
|
18
31
|
* Create a calendar event
|
|
19
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/calendar.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,qBAAqB,EAGrB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAWD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAkBlC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAM5E;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAOhC;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;AAElD;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,GACtC,OAAO,CAAC,qBAAqB,CAAC,CAOhC;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKvE"}
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/calendar.ts"],"names":[],"mappings":"AAGA,OAAO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AAM,GAAG,MAAM,CAKvE"}
|
|
@@ -35,6 +35,32 @@ export async function getSourceCalendars() {
|
|
|
35
35
|
const response = await client.get("/api/frames/{frameId}/source_calendars");
|
|
36
36
|
return response.data;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A free-tier "Dinner plan": what the Skylight web app sends on an account without Plus, where
|
|
40
|
+
* the calendar's + button offers "Dinner plan" in place of Meals (captured 2026-11-10, 200). It
|
|
41
|
+
* is an ordinary all-day calendar event with kind "meal"; the server tags it with a "Dinner Plan"
|
|
42
|
+
* label itself. Dates only (YYYY-MM-DD), one day, no profiles, no synced calendar, no repeat:
|
|
43
|
+
* only that shape was captured.
|
|
44
|
+
*/
|
|
45
|
+
export function dinnerPlanEvent(options) {
|
|
46
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(options.date) || Number.isNaN(Date.parse(`${options.date}T00:00:00Z`))) {
|
|
47
|
+
throw new Error("A dinner plan needs a date, YYYY-MM-DD.");
|
|
48
|
+
}
|
|
49
|
+
const next = new Date(Date.parse(`${options.date}T00:00:00Z`) + 86_400_000).toISOString().slice(0, 10);
|
|
50
|
+
return {
|
|
51
|
+
summary: options.title,
|
|
52
|
+
kind: "meal",
|
|
53
|
+
starts_at: options.date,
|
|
54
|
+
ends_at: next,
|
|
55
|
+
all_day: true,
|
|
56
|
+
timezone: options.timeZone,
|
|
57
|
+
description: options.description ?? "",
|
|
58
|
+
location: "",
|
|
59
|
+
category_ids: [],
|
|
60
|
+
rrule: null,
|
|
61
|
+
countdown_enabled: false,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
38
64
|
/**
|
|
39
65
|
* Create a calendar event
|
|
40
66
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../src/api/endpoints/calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,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AC,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,QAAQ,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -54,6 +54,13 @@ export interface MealSittingResource {
|
|
|
54
54
|
id: string;
|
|
55
55
|
} | null;
|
|
56
56
|
};
|
|
57
|
+
/** Who the meal is for (Skylight's "Assign Meals to Profiles", 2026-11-12). Empty or absent: unassigned. */
|
|
58
|
+
profiles?: {
|
|
59
|
+
data: Array<{
|
|
60
|
+
type: string;
|
|
61
|
+
id: string;
|
|
62
|
+
}>;
|
|
63
|
+
};
|
|
57
64
|
};
|
|
58
65
|
}
|
|
59
66
|
/**
|
|
@@ -105,6 +112,18 @@ export interface GetMealSittingsOptions {
|
|
|
105
112
|
* Get meal sittings (scheduled meals)
|
|
106
113
|
*/
|
|
107
114
|
export declare function getMealSittings(options?: GetMealSittingsOptions): Promise<MealSittingResource[]>;
|
|
115
|
+
/**
|
|
116
|
+
* Meals for a range, with who each one is for. Reads under the API version the
|
|
117
|
+
* Skylight apps send and asks for `include=profiles`, which is how the app reads
|
|
118
|
+
* them (captured 2026-11-12). `getMealSittings` above is left as it was, because
|
|
119
|
+
* the library entry reads through it and its output is a public contract.
|
|
120
|
+
*/
|
|
121
|
+
export declare function getMealSittingsWithProfiles(options?: GetMealSittingsOptions): Promise<{
|
|
122
|
+
sittings: MealSittingResource[];
|
|
123
|
+
profileLabels: Map<string, string>;
|
|
124
|
+
}>;
|
|
125
|
+
/** Names of the profiles a meal is assigned to; empty when it is unassigned. An id with no label reads "someone". */
|
|
126
|
+
export declare function mealProfileNames(sitting: MealSittingResource, profileLabels: Map<string, string>): string[];
|
|
108
127
|
export interface CreateMealSittingOptions {
|
|
109
128
|
date: string;
|
|
110
129
|
mealCategoryId: string;
|
|
@@ -113,6 +132,8 @@ export interface CreateMealSittingOptions {
|
|
|
113
132
|
recipeId?: string;
|
|
114
133
|
/** Repeat weekly on the weekday of `date`. Only this shape was captured. */
|
|
115
134
|
repeat?: "weekly";
|
|
135
|
+
/** Profile (category) ids the meal is for. Empty or missing: unassigned. Sends the app's whole form under MEAL_EDIT_API_VERSION. */
|
|
136
|
+
profileIds?: string[];
|
|
116
137
|
}
|
|
117
138
|
/** Weekday code (SU..SA) of a YYYY-MM-DD date, independent of time zone. */
|
|
118
139
|
export declare function weekdayCode(date: string): string;
|
|
@@ -169,6 +190,8 @@ export interface UpdateMealSittingOptions {
|
|
|
169
190
|
/** The "Instructions or ingredients" field in the app. */
|
|
170
191
|
description?: string;
|
|
171
192
|
mealCategoryId?: string;
|
|
193
|
+
/** Replace who the meal is for. Omitted: keep as is. Empty array: unassign. */
|
|
194
|
+
profileIds?: string[];
|
|
172
195
|
/** Required for a repeating meal: which occurrences the change applies to. */
|
|
173
196
|
scope?: MealEditScope;
|
|
174
197
|
/** For scope "all": the series' original start date, from findSeriesStart. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meals.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/meals.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE;QACV,0EAA0E;QAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,CAEvE;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,aAAa,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,C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,MAAM,CAAC;IACd,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiDpG;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,eAAuB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAoBlB"}
|
|
@@ -86,6 +86,36 @@ export async function getMealSittings(options = {}) {
|
|
|
86
86
|
const response = await client.get("/api/frames/{frameId}/meals/sittings", params);
|
|
87
87
|
return response.data;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Meals for a range, with who each one is for. Reads under the API version the
|
|
91
|
+
* Skylight apps send and asks for `include=profiles`, which is how the app reads
|
|
92
|
+
* them (captured 2026-11-12). `getMealSittings` above is left as it was, because
|
|
93
|
+
* the library entry reads through it and its output is a public contract.
|
|
94
|
+
*/
|
|
95
|
+
export async function getMealSittingsWithProfiles(options = {}) {
|
|
96
|
+
const params = { include: "meal_category,meal_recipe,profiles" };
|
|
97
|
+
if (options.dateMin)
|
|
98
|
+
params.date_min = options.dateMin;
|
|
99
|
+
if (options.dateMax)
|
|
100
|
+
params.date_max = options.dateMax;
|
|
101
|
+
const response = await getClient().request("/api/frames/{frameId}/meals/sittings", {
|
|
102
|
+
method: "GET",
|
|
103
|
+
params,
|
|
104
|
+
apiVersion: MEAL_EDIT_API_VERSION,
|
|
105
|
+
});
|
|
106
|
+
const profileLabels = new Map();
|
|
107
|
+
for (const inc of response.included ?? []) {
|
|
108
|
+
const label = inc.attributes?.label;
|
|
109
|
+
if (inc.type === "category" && typeof label === "string" && label.trim())
|
|
110
|
+
profileLabels.set(inc.id, label.trim());
|
|
111
|
+
}
|
|
112
|
+
return { sittings: response.data, profileLabels };
|
|
113
|
+
}
|
|
114
|
+
/** Names of the profiles a meal is assigned to; empty when it is unassigned. An id with no label reads "someone". */
|
|
115
|
+
export function mealProfileNames(sitting, profileLabels) {
|
|
116
|
+
const ids = sitting.relationships?.profiles?.data ?? [];
|
|
117
|
+
return ids.map((p) => profileLabels.get(p.id) ?? "someone");
|
|
118
|
+
}
|
|
89
119
|
const WEEKDAY_CODES = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
90
120
|
/** Weekday code (SU..SA) of a YYYY-MM-DD date, independent of time zone. */
|
|
91
121
|
export function weekdayCode(date) {
|
|
@@ -112,9 +142,13 @@ export async function createMealSitting(options) {
|
|
|
112
142
|
if (options.recipeId) {
|
|
113
143
|
body.meal_recipe_id = options.recipeId;
|
|
114
144
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//
|
|
145
|
+
const profileIds = [...new Set(options.profileIds ?? [])];
|
|
146
|
+
if (options.repeat === "weekly" || profileIds.length > 0) {
|
|
147
|
+
// A repeating or assigned create sends the web app's whole form (repeat captured 2026-11-01,
|
|
148
|
+
// assignment 2026-11-12 under API version 2026-10-15). Not verified live from this code path.
|
|
149
|
+
for (const id of profileIds)
|
|
150
|
+
if (!/^\d{1,12}$/.test(id))
|
|
151
|
+
throw new Error("Profile IDs must be numeric.");
|
|
118
152
|
const form = {
|
|
119
153
|
date: options.date,
|
|
120
154
|
summary: options.summary ?? "",
|
|
@@ -122,15 +156,20 @@ export async function createMealSitting(options) {
|
|
|
122
156
|
note: "",
|
|
123
157
|
meal_category_id: options.mealCategoryId,
|
|
124
158
|
meal_recipe_id: options.recipeId ?? null,
|
|
125
|
-
profile_ids:
|
|
126
|
-
rrule: weeklyRrule(options.date),
|
|
159
|
+
profile_ids: profileIds,
|
|
160
|
+
rrule: options.repeat === "weekly" ? weeklyRrule(options.date) : null,
|
|
127
161
|
add_to_grocery_list: false,
|
|
128
162
|
saveToRecipeBox: false,
|
|
129
163
|
};
|
|
130
|
-
const created = await client.request("/api/frames/{frameId}/meals/sittings", {
|
|
164
|
+
const created = await client.request("/api/frames/{frameId}/meals/sittings", {
|
|
165
|
+
method: "POST",
|
|
166
|
+
body: form,
|
|
167
|
+
apiVersion: MEAL_EDIT_API_VERSION,
|
|
168
|
+
...(profileIds.length > 0 ? { params: { include: "meal_category,meal_recipe,profiles" } } : {}),
|
|
169
|
+
});
|
|
131
170
|
const first = Array.isArray(created.data) ? created.data[0] : created.data;
|
|
132
171
|
if (!first)
|
|
133
|
-
throw new Error("Skylight returned an empty response when creating the
|
|
172
|
+
throw new Error("Skylight returned an empty response when creating the meal");
|
|
134
173
|
return first;
|
|
135
174
|
}
|
|
136
175
|
// The API answers a create with a list envelope (one element), unlike GET by id.
|
|
@@ -271,7 +310,9 @@ export async function updateMealSitting(options) {
|
|
|
271
310
|
description: options.description ?? (typeof a.description === "string" ? a.description : ""),
|
|
272
311
|
meal_category_id: options.mealCategoryId ?? existing.relationships?.meal_category?.data?.id ?? null,
|
|
273
312
|
meal_recipe_id: existing.relationships?.meal_recipe?.data?.id ?? null,
|
|
274
|
-
profile_ids:
|
|
313
|
+
profile_ids: options.profileIds !== undefined
|
|
314
|
+
? [...new Set(options.profileIds)]
|
|
315
|
+
: (existing.relationships?.profiles?.data ?? []).map((p) => p.id),
|
|
275
316
|
saveToRecipeBox: false,
|
|
276
317
|
};
|
|
277
318
|
const params = instanceQuery(date);
|