@davidwoods/skylight-mcp 1.19.0 → 1.20.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 +51 -10
- 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/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/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 |
|
|
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) |
|
|
436
450
|
| Meals (Plus) | Read categories and meals; create, rename, move, delete one-off meals | All, delete included | Live-tested |
|
|
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
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -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 in the minutes after it (2026-11-09); whether their next token refresh survives is not yet verified.
|
|
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,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IAOhB,oFAAoF;YACtE,UAAU;IAexB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAuCrB;;;OAGG;YACW,cAAc;IAwC5B;;OAEG;YACW,YAAY;IAa1B;;;;OAIG;YACW,aAAa;IAU3B;;OAEG;IACH,OAAO,CAAC,QAAQ;IAoBhB;;OAEG;YACW,mBAAmB;IAyCjC;;OAEG;IACG,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;IAmD7F;;OAEG;IACG,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,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,EAA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D,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,kBAAkB,KAAK,MAAM,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC9B,CAAC;CACF;AAED,0EAA0E;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,EAC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,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"}
|
|
@@ -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,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAkBvD;;GAEG;AACH,SAAS,OAAO,CAAC,OAAe,EAAE,IAAY;IAC5C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAiC;IAEjC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,mFAAmF;IACnF,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAEpD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAC/B,uCAAuC,EACvC;QACE,QAAQ,EAAE,OAAO,CAAC,OAAO;QACzB,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ;QA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EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;KACpD,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,QAAgB;IAC7D,MAAM,CAAC,GAAG,qDAAqD,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACnF,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrB,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,QAAQ,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC;AACxF,CAAC"}
|
package/dist/api/oauth.d.ts
CHANGED
|
@@ -32,8 +32,11 @@ export interface PendingLogin {
|
|
|
32
32
|
fingerprint: string;
|
|
33
33
|
createdAt: number;
|
|
34
34
|
}
|
|
35
|
+
/** Why a login step failed, for callers that write their own message (the library setup entry). */
|
|
36
|
+
export type OAuthErrorKind = "expired" | "bad_url" | "state" | "token";
|
|
35
37
|
export declare class OAuthError extends Error {
|
|
36
|
-
|
|
38
|
+
readonly kind: OAuthErrorKind;
|
|
39
|
+
constructor(message: string, kind?: OAuthErrorKind);
|
|
37
40
|
}
|
|
38
41
|
type FetchLike = typeof fetch;
|
|
39
42
|
/** The S256 challenge for a verifier. */
|
package/dist/api/oauth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/api/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAOjD,qFAAqF;AACrF,eAAO,M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gBAAgB,EAAE,GAAG,GAAE,MAAmB,GAAG,OAAO,CAEzF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAe7E"}
|
package/dist/api/oauth.js
CHANGED
|
@@ -24,9 +24,11 @@ export const PENDING_LOGIN_TTL_MS = 10 * 60 * 1000;
|
|
|
24
24
|
/** Refresh this long before the access token actually expires. */
|
|
25
25
|
export const EXPIRY_SKEW_MS = 60 * 1000;
|
|
26
26
|
export class OAuthError extends Error {
|
|
27
|
-
|
|
27
|
+
kind;
|
|
28
|
+
constructor(message, kind = "token") {
|
|
28
29
|
super(message);
|
|
29
30
|
this.name = "OAuthError";
|
|
31
|
+
this.kind = kind;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
function base64url(bytes) {
|
|
@@ -91,33 +93,33 @@ function safeEqual(a, b) {
|
|
|
91
93
|
/** Extract and validate the authorization code from the pasted callback URL. */
|
|
92
94
|
export function parseCallbackUrl(callbackUrl, pending, now = Date.now()) {
|
|
93
95
|
if (now - pending.createdAt > PENDING_LOGIN_TTL_MS) {
|
|
94
|
-
throw new OAuthError("The login attempt expired. Run `skylight-mcp auth login` again.");
|
|
96
|
+
throw new OAuthError("The login attempt expired. Run `skylight-mcp auth login` again.", "expired");
|
|
95
97
|
}
|
|
96
98
|
let callback;
|
|
97
99
|
try {
|
|
98
100
|
callback = new URL(callbackUrl.trim());
|
|
99
101
|
}
|
|
100
102
|
catch {
|
|
101
|
-
throw new OAuthError("Paste the complete URL shown in your browser after signing in.");
|
|
103
|
+
throw new OAuthError("Paste the complete URL shown in your browser after signing in.", "bad_url");
|
|
102
104
|
}
|
|
103
105
|
const expected = new URL(REDIRECT_URI);
|
|
104
106
|
if (callback.protocol !== "https:" || callback.hostname !== expected.hostname || callback.pathname !== expected.pathname) {
|
|
105
|
-
throw new OAuthError(`The URL must start with ${REDIRECT_URI}
|
|
107
|
+
throw new OAuthError(`The URL must start with ${REDIRECT_URI}.`, "bad_url");
|
|
106
108
|
}
|
|
107
109
|
const error = callback.searchParams.get("error");
|
|
108
110
|
if (error) {
|
|
109
|
-
throw new OAuthError(`Skylight returned an error during sign-in: ${error.slice(0, 100)}
|
|
111
|
+
throw new OAuthError(`Skylight returned an error during sign-in: ${error.slice(0, 100)}`, "bad_url");
|
|
110
112
|
}
|
|
111
113
|
const code = callback.searchParams.get("code");
|
|
112
114
|
const state = callback.searchParams.get("state");
|
|
113
115
|
if (!code || !state) {
|
|
114
|
-
throw new OAuthError("The URL did not contain a code and state. Run `skylight-mcp auth login` again.");
|
|
116
|
+
throw new OAuthError("The URL did not contain a code and state. Run `skylight-mcp auth login` again.", "bad_url");
|
|
115
117
|
}
|
|
116
118
|
if (code.length > MAX_FIELD_LENGTH || state.length > MAX_FIELD_LENGTH) {
|
|
117
|
-
throw new OAuthError("The URL contained an unexpectedly long value.");
|
|
119
|
+
throw new OAuthError("The URL contained an unexpectedly long value.", "bad_url");
|
|
118
120
|
}
|
|
119
121
|
if (!safeEqual(state, pending.state)) {
|
|
120
|
-
throw new OAuthError("State mismatch: this URL does not belong to the pending login. Run `skylight-mcp auth login` again.");
|
|
122
|
+
throw new OAuthError("State mismatch: this URL does not belong to the pending login. Run `skylight-mcp auth login` again.", "state");
|
|
121
123
|
}
|
|
122
124
|
return code;
|
|
123
125
|
}
|
package/dist/api/oauth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/api/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AACjD,MAAM,KAAK,GAAG,YAAY,CAAC;AAC3B,M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AQ;QACpC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAClC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAA0B,CAAC;AACpC,CAAC"}
|
package/dist/lib.d.ts
CHANGED
|
@@ -119,10 +119,19 @@ export interface Skylight {
|
|
|
119
119
|
profiles: {
|
|
120
120
|
list(): Promise<ProfileDto[]>;
|
|
121
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* Chores for one day (`date`) or a range (`from` and `to`, both included, at most 31 days).
|
|
124
|
+
* Pass one or the other, not both. A repeating chore appears once per day it falls on; `date`
|
|
125
|
+
* on each item is that day.
|
|
126
|
+
*/
|
|
122
127
|
chores: {
|
|
123
128
|
list(options: {
|
|
124
129
|
date: string;
|
|
125
130
|
profile?: string;
|
|
131
|
+
} | {
|
|
132
|
+
from: string;
|
|
133
|
+
to: string;
|
|
134
|
+
profile?: string;
|
|
126
135
|
}): Promise<ChoreDto[]>;
|
|
127
136
|
};
|
|
128
137
|
meals: {
|
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAYjE,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,+FAA+F;AAC/F,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,kBAAkB,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IAC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AAC,WAAW,EAAE,CAAC,CAAC;KAC/C,CAAC;CACH;AA0ID,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,QAAQ,CA4GvE"}
|
package/dist/lib.js
CHANGED
|
@@ -25,7 +25,7 @@ import { getCategories } from "./api/endpoints/categories.js";
|
|
|
25
25
|
import { getChores } from "./api/endpoints/chores.js";
|
|
26
26
|
import { getListWithItems, getLists } from "./api/endpoints/lists.js";
|
|
27
27
|
import { getMealCategories, getMealSittings, getRecipes, mealCategoryName } from "./api/endpoints/meals.js";
|
|
28
|
-
import { isChoreDone } from "./api/endpoints/chores.js";
|
|
28
|
+
import { isChoreDone, parseOccurrenceId } from "./api/endpoints/chores.js";
|
|
29
29
|
import { addDays } from "./utils/schedule.js";
|
|
30
30
|
import { redactFeedUrl } from "./utils/redact.js";
|
|
31
31
|
// ---------------------------------------------------------------------------
|
|
@@ -46,6 +46,9 @@ function assertRange(range) {
|
|
|
46
46
|
throw new Error("to is before from.");
|
|
47
47
|
return { from, to };
|
|
48
48
|
}
|
|
49
|
+
function daysBetween(from, to) {
|
|
50
|
+
return Math.round((Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / 86_400_000);
|
|
51
|
+
}
|
|
49
52
|
function isStore(value) {
|
|
50
53
|
const v = value;
|
|
51
54
|
return !!v && typeof v === "object" && typeof v.read === "function" && typeof v.write === "function" && typeof v.delete === "function";
|
|
@@ -146,7 +149,9 @@ function toChore(chore, names) {
|
|
|
146
149
|
return {
|
|
147
150
|
id: String(chore.id),
|
|
148
151
|
title: str(a.summary) ?? "",
|
|
149
|
-
|
|
152
|
+
// An occurrence of a repeating chore carries its own day in its id ({series}-{YYYY-MM-DD}-{HHMM},
|
|
153
|
+
// verified live for completions); `start` may be the series' first day.
|
|
154
|
+
date: parseOccurrenceId(String(chore.id))?.instanceDate ?? str(a.start),
|
|
150
155
|
time: str(a.start_time),
|
|
151
156
|
status: str(a.status) ?? "",
|
|
152
157
|
done: isChoreDone(a.status),
|
|
@@ -160,7 +165,8 @@ function toChore(chore, names) {
|
|
|
160
165
|
// ---------------------------------------------------------------------------
|
|
161
166
|
export function createSkylight(options) {
|
|
162
167
|
const { config, store } = validateOptions(options);
|
|
163
|
-
|
|
168
|
+
// Quiet: no per-request trace lines in the importer's logs. Errors and warnings still print.
|
|
169
|
+
const client = new SkylightClient(config, store, { quiet: true });
|
|
164
170
|
const run = (fn) => runWithContext({ client, config }, fn);
|
|
165
171
|
return {
|
|
166
172
|
calendar: {
|
|
@@ -182,14 +188,31 @@ export function createSkylight(options) {
|
|
|
182
188
|
},
|
|
183
189
|
chores: {
|
|
184
190
|
list: (opts) => run(async () => {
|
|
185
|
-
const
|
|
186
|
-
const
|
|
191
|
+
const o = (opts ?? {});
|
|
192
|
+
for (const key of Object.keys(o)) {
|
|
193
|
+
if (!["date", "from", "to", "profile"].includes(key))
|
|
194
|
+
throw new Error(`Unknown option "${key}".`);
|
|
195
|
+
}
|
|
196
|
+
let from;
|
|
197
|
+
let to;
|
|
198
|
+
if (o.date !== undefined) {
|
|
199
|
+
if (o.from !== undefined || o.to !== undefined)
|
|
200
|
+
throw new Error("Pass date, or from and to, not both.");
|
|
201
|
+
from = to = assertDate(o.date, "date");
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
({ from, to } = assertRange({ from: o.from, to: o.to }));
|
|
205
|
+
if (daysBetween(from, to) > 30)
|
|
206
|
+
throw new Error("A chores range is at most 31 days.");
|
|
207
|
+
}
|
|
208
|
+
// `before` is inclusive: the one-day call has always sent after = before = the day.
|
|
209
|
+
const result = await getChores({ after: from, before: to, includeLate: false, includeUpForGrabs: true });
|
|
187
210
|
const names = new Map(result.categories.map((c) => [String(c.id), c.attributes.label ?? ""]));
|
|
188
211
|
let chores = result.chores.map((c) => toChore(c, names));
|
|
189
|
-
if (
|
|
190
|
-
if (typeof
|
|
212
|
+
if (o.profile !== undefined) {
|
|
213
|
+
if (typeof o.profile !== "string")
|
|
191
214
|
throw new Error("profile must be a profile name.");
|
|
192
|
-
const wanted =
|
|
215
|
+
const wanted = o.profile.trim().toLowerCase();
|
|
193
216
|
chores = chores.filter((c) => c.profile?.toLowerCase() === wanted);
|
|
194
217
|
}
|
|
195
218
|
return chores;
|