@vermeulen.solutions/eventual 0.18.6 → 0.19.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.
@@ -8,7 +8,7 @@ Eventual RSVP – Core requires EmDash **>=1.2.0 <2.0.0**; it is tested on **1.2
8
8
  2. Open **Event settings**, select the event and venue/organizer collections, and choose **Save settings**. Selection connects collections; it does not create them or move entries.
9
9
  3. Create a draft, save it, set its schedule in **Dates, venue & repeat**, and publish it. Check it on your site's calendar.
10
10
 
11
- A **content type/collection** is simply the place under **Content** where entries are listed and edited. If compatible collections are missing, ask your site builder to create them with the blueprint below. Your builder adds visitor pages using Eventual's feeds; the [Astro showcase](../examples/astro-events/README.md) is an optional website design.
11
+ A **content type/collection** is simply the place under **Content** where entries are listed and edited. If compatible collections are missing, ask your site builder to create them with the blueprint below. Your builder adds the visitor pages with the package's [event page components](./developer-guide.md#event-pages).
12
12
 
13
13
  ## Agent tools (optional)
14
14
 
@@ -36,7 +36,7 @@ After `npm ci` and `npm run build` in this repository, using Node 24+:
36
36
  node scripts/export-native-schema.mjs --locale fr --output eventual-schema.json
37
37
  ```
38
38
 
39
- From an installed source package, use `node node_modules/@vermeulen.solutions/eventual/scripts/export-native-schema.mjs` with the same options. The exporter writes schema JSON only and refuses to overwrite an output file.
39
+ New events start in this computer's time zone; add `--timezone Europe/London` (any IANA name) for another one. From an installed source package, use `node node_modules/@vermeulen.solutions/eventual/scripts/export-native-schema.mjs` with the same options. The exporter writes schema JSON only and refuses to overwrite an output file.
40
40
 
41
41
  Defaults are `events`, `venues`, and `organizers` (19/8/3 fields). Custom names and directory reuse:
42
42
 
@@ -128,7 +128,81 @@ if (!result.success) throw new Error(result.error?.message ?? 'Event feed unavai
128
128
 
129
129
  Each feed event carries `calendarLinks` (Google, Outlook, Office 365 and `.ics`), already built with the installed ID. The `.ics` link downloads that event only (`calendar?eventId=…`); before 0.18.5 it returned the whole calendar. `buildCalendarLinks(event, siteUrl, pluginId)` builds the same links on your side and takes the ID as its third argument.
130
130
 
131
- `@vermeulen.solutions/eventual/astro/EventList.astro` is an optional unstyled list. JSON-LD helpers are eventToJsonLd and serializeJsonLd; use the safe serializer. The [showcase](../examples/astro-events/README.md) supplies seven complete visitor layouts.
131
+ `@vermeulen.solutions/eventual/astro/EventList.astro` is an optional plain list (title, status, date, venue and, with `showCalendarLinks`, calendar buttons). Since 0.18.7 it has light default styles in the `eventual` cascade layer, so your own CSS always wins: neutral colours follow the surrounding text colour, and the link and status colours follow the page's `color-scheme` (set `color-scheme: dark` where it sits on a dark surface). Adjust them with `--eventual-list-accent`, `--eventual-list-muted`, `--eventual-list-border`, `--eventual-list-radius`, `--eventual-list-cancelled` and `--eventual-list-rescheduled`. JSON-LD helpers are eventToJsonLd and serializeJsonLd; use the safe serializer. For full events pages, use the components below.
132
+
133
+ ## Event pages
134
+
135
+ Since 0.19.0 the package has two complete page bodies: `EventBrowser` (the events page, with seven views) and `EventDetail` (one event). A loader fetches the feed and returns everything a page needs, including the HTTP status; you render the component inside your own layout. They are site code: nothing here counts towards the plugin's sandbox size.
136
+
137
+ `src/pages/events.astro`:
138
+
139
+ ```astro
140
+ ---
141
+ import EventBrowser from "@vermeulen.solutions/eventual/astro/EventBrowser.astro";
142
+ import { loadEventBrowser } from "@vermeulen.solutions/eventual/astro/events";
143
+ import Layout from "../layouts/Layout.astro";
144
+
145
+ export const prerender = false;
146
+ const data = await loadEventBrowser(Astro.url, { pluginId: "eventual", locale: "fr-CH", timeZone: "Europe/Zurich" });
147
+ Astro.response.status = data.status;
148
+ ---
149
+ <Layout title={data.pageTitle}><EventBrowser data={data} /></Layout>
150
+ ```
151
+
152
+ `src/pages/events/[id].astro`:
153
+
154
+ ```astro
155
+ ---
156
+ import EventDetail from "@vermeulen.solutions/eventual/astro/EventDetail.astro";
157
+ import { eventContentId, loadEventDetail, occurrenceStart } from "@vermeulen.solutions/eventual/astro/events";
158
+ import RsvpForm from "@vermeulen.solutions/eventual-attendance/astro/RsvpForm.astro";
159
+ import Layout from "../../layouts/Layout.astro";
160
+
161
+ export const prerender = false;
162
+ const data = await loadEventDetail(Astro.url, Astro.params.id, { pluginId: "eventual", locale: "fr-CH" });
163
+ Astro.response.status = data.status;
164
+ ---
165
+ <Layout title={data.pageTitle}>
166
+ <EventDetail data={data}>
167
+ {data.event && <RsvpForm eventId={eventContentId(data.event)} occurrenceStart={occurrenceStart(data.event)} />}
168
+ </EventDetail>
169
+ </Layout>
170
+ ```
171
+
172
+ Anything inside `EventDetail` (Registrations' `RsvpForm`, Tickets' `TicketCheckout`) appears after the description. On a static site keep `prerender = false` on both pages, since they read the month and the view from the address.
173
+
174
+ **Loader options** (both loaders):
175
+
176
+ | Option | Default | What it does |
177
+ |---|---|---|
178
+ | `pluginId` | `eventual` | The installed ID; `r_…` for a Registry install ([how to find it](#installation-and-plugin-id)). |
179
+ | `origin` | the page's own | The EmDash site that serves the feed, when the pages run elsewhere. |
180
+ | `locale` | `en` | Page texts (21 languages), date formats, first day of the week, and the content language asked from the feed. Arabic and Hebrew pages are right to left. |
181
+ | `contentLocale`, `strict` | language of `locale`, `false` | The feed's content language, and whether to leave out events not translated into it. |
182
+ | `timeZone` | `UTC` | The zone for "this month" and "today". Each event keeps its own zone. |
183
+ | `basePath` | `/events` | The events page's address; detail links are `<basePath>/<slug>`. |
184
+ | `linkTo` | `detail` | `cms` links to the entry's own public page when it has one. |
185
+ | `views`, `defaultView` | all seven, `list` | The views offered, in order: `list`, `timeline`, `cards`, `schedule`, `dates`, `month`, `locations`. |
186
+ | `view`, `month`, `category` | from the address | Fix a value instead of reading `?view=`, `?month=` or `?category=`. |
187
+
188
+ **Component props:** `EventBrowser` takes `headingLevel` (1, or 2 inside another page), `title`, `intro` (`false` for none), `id`, `showFilter`, `showViewSwitch` and `scheme`. `EventDetail` takes `headingLevel`, `backHref` (`false` for none), `showSubscribe`, `jsonLd` (Event structured data, on by default) and `scheme`.
189
+
190
+ **Look and theming.** The styles are in the `eventual` cascade layer, so any CSS of your own wins. Neutral colours follow the surrounding text colour, so the pages suit any background; the accent and status colours follow the page's `color-scheme` (set `color-scheme: light dark` on your page, or pass `scheme="dark"` where a block sits on a dark surface). Override these properties on the component or any ancestor; Registrations and Tickets read the same names:
191
+
192
+ | Property | Default |
193
+ |---|---|
194
+ | `--eventual-primary`, `--eventual-on-primary` | blue (`light-dark(#075985, #7dd3fc)`) and the text on it |
195
+ | `--eventual-text-muted`, `--eventual-border`, `--eventual-surface` | the text colour at 72%, 14% and 3% |
196
+ | `--eventual-cancelled`, `--eventual-changed`, `--eventual-error` | red, amber, red |
197
+ | `--eventual-radius`, `--eventual-control-radius`, `--eventual-focus`, `--eventual-gap` | `0.875rem`, `0.5rem`, the primary colour, `1rem` |
198
+
199
+ Layouts adapt to the width of the component, not the window (container queries): the month grid becomes a day list below about 700 pixels, and images drop out of narrow rows. All classes start with `eventual-`.
200
+
201
+ **Accessibility.** Status (cancelled, postponed, rescheduled) shows in every view, each event's content language is marked, the month grid reads full day names and dates, today is marked, and links that open a new tab say so. Checked with axe (WCAG 2.2 AA) in all views in light and dark, and on a 375-pixel screen at 200% text size.
202
+
203
+ **Lower level.** `buildEventBrowserData(events, url, options)` and `buildEventDetailData(events, id, url, options)` do the same without fetching, for example when you call the SSR dispatcher yourself. `eventPageText(locale)` gives the translated texts. The texts live in the `core-site` namespace of `@vermeulen.solutions/eventual-locales`.
204
+
205
+ The [example site](../examples/astro-events/README.md) uses both pages with a green accent.
132
206
 
133
207
  ## Settings, tools and transfer
134
208
 
@@ -146,7 +220,7 @@ exportRecords follows cursors (default 5, maximum 10). Native native-content-v1
146
220
 
147
221
  ## Limits and checks
148
222
 
149
- The host's ten-bridge-call budget can constrain feeds, dependency checks and migration even with few displayed events. Smaller date windows or publicUrls=false help some JSON requests; complete-source scans still cost calls. Native exceptions/occurrence copy are bounded at 500 items; calendar group/state/output bounds also apply and fail explicitly. Background migration jobs and bulk APIs remain pending: [Eventual #5](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/issues/5), [EmDash #4004](https://github.com/emdash-cms/emdash/issues/4004).
223
+ Each request may make a limited number of calls to EmDash. The two public feeds (`publicEvents`, `calendar`) use up to 30, which EmDash allows on Cloudflare since 1.5 and which Node does not limit; on Cloudflare with EmDash 1.4 or older a very large feed fails with the host's error instead. Everything else stays within 10. Measured on a Node test site with 0.18.7: both feeds served 714 upcoming one-off events, and the calendar's saved state takes about 540 bytes per event against its 1 MiB limit (roughly 1,900 events). A weekly series counts once, however many dates it has. The budget can still constrain dependency checks and migration. Smaller date windows or publicUrls=false help some JSON requests; complete-source scans still cost calls. Native exceptions/occurrence copy are bounded at 500 items; calendar group/state/output bounds also apply and fail explicitly. Background migration jobs and bulk APIs remain pending: [Eventual #5](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/issues/5), [EmDash #4004](https://github.com/emdash-cms/emdash/issues/4004).
150
224
 
151
225
  Calendar UIDs, monotonic SEQUENCE and 366-day cancellation retention support reconciliation. Preserve migrated calendar_uid values. Publication shares schedule fields across languages; pending drafts stay separate. Stale-form checks are not an atomic write lock. Some settings copy remains English in the French admin; stock development-renderer diagnostics are recorded in acceptance.
152
226
 
@@ -1,8 +1,8 @@
1
- # Eventual RSVP – Core 0.18.6
1
+ # Eventual RSVP – Core 0.19.0
2
2
 
3
3
  Requires EmDash **>=1.2.0 <2.0.0**; tested on 1.2.0, 1.4.0, 1.5.0 and 1.6.0. **1.4.0 or newer is recommended** for nested forms and Cloudflare plugin mutations, and required for the optional cache integration.
4
4
 
5
- In **Plugins → Registry**, find **Eventual RSVP – Core** by **vermeulen.solutions**, review permissions and install or update. 0.18.6 needs no new permissions; since 0.18.0 Core uses `network:request` to `cdn.jsdelivr.net` for the admin's language packs. Agent tools stay off until you expand the plugin under **Plugins** and switch on **Agent access**.
5
+ In **Plugins → Registry**, find **Eventual RSVP – Core** by **vermeulen.solutions**, review permissions and install or update. 0.19.0 needs no new permissions; since 0.18.0 Core uses `network:request` to `cdn.jsdelivr.net` for the admin's language packs. Agent tools stay off until you expand the plugin under **Plugins** and switch on **Agent access**.
6
6
 
7
7
  Open **Event settings**, select compatible event, venue and organizer collections, then **Save settings**. Installation does not create schemas or migrate content. Site builders: [collection setup](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/main/docs/collection-setup.md).
8
8
 
@@ -0,0 +1,13 @@
1
+ # Eventual RSVP – Core 0.18.7 — review fixes
2
+
3
+ Fixes for points from an independent review of 0.18.4, each checked on a local EmDash 1.5.0 site.
4
+
5
+ - **Readable calendar links.** Google, Outlook and Office 365 entries show the event's description as text, not as raw rich-text code.
6
+ - **Admin links on staging copies.** Links on the Eventual RSVP page open the admin of the site you are on, not the live site configured as the site address.
7
+ - **Larger feeds.** Both public feeds served 714 upcoming one-off events on the test site (0.18.4: about 300 for the calendar, 600 for JSON). The feeds may now make 30 calls per request where EmDash allows it, and the calendar's saved state is about four times smaller. Existing subscriptions keep their update numbers.
8
+ - **Clean refusal when deleting a venue or organizer in use,** instead of an error page.
9
+ - **Event settings** offers only collections that can work, and says what is missing when there is no event collection yet.
10
+ - **One sidebar entry each** for venues and organizers.
11
+ - **`EventList`:** event-specific names for the calendar links, link names that match their text, a "Cancelled" or "Rescheduled" label, and light default styles that work on light and dark pages. Your site's CSS always overrides them; see the [developer guide](developer-guide.md#astro-integration).
12
+ - **Schema exporter:** `--timezone`, defaulting to the computer's own time zone.
13
+ - **Nothing else changes:** no permission or schema changes, and no new MCP tools. EmDash `>=1.2.0 <2.0.0` (tested on 1.2.0, 1.4.0, 1.5.0 and 1.6.0).
@@ -0,0 +1,12 @@
1
+ # Eventual RSVP – Core 0.19.0 — event pages in the package
2
+
3
+ Visitor pages no longer have to be built by your developer. The package now has a complete events page and an event page, ready to put in an Astro site.
4
+
5
+ - **Events page (`EventBrowser`):** seven views (list, timeline, cards, schedule, date strip, month and locations), month navigation, a category filter and a calendar subscription link. Cancelled, postponed and rescheduled events are marked in every view.
6
+ - **Event page (`EventDetail`):** date, time, place with directions, organizer, website, the description, an "Add to calendar" menu (Google, Outlook, Office 365, iCal file), a subscription link and Event structured data for search engines. Registrations' or Tickets' form goes inside it.
7
+ - **Two short pages:** a loader fetches the feed and gives the page its texts, data and HTTP status (502 when the feed cannot be reached, 404 for an unknown event). See [Event pages](developer-guide.md#event-pages).
8
+ - **21 languages:** English, French, German, Dutch, Spanish, Italian, Portuguese (Portugal and Brazil), Polish, Czech, Swedish, Danish, Norwegian, Finnish, Japanese, Chinese, Korean, Turkish, Ukrainian, Arabic and Hebrew, with right-to-left layout for Arabic and Hebrew. The texts come with `@vermeulen.solutions/eventual-locales` 0.1.12.
9
+ - **Light and dark:** a neutral look with a blue accent that follows the page's text colour and colour scheme. Your own CSS always wins, and `--eventual-*` properties (shared with Registrations and Tickets) change the colours, corners and spacing.
10
+ - **Accessible and responsive:** no axe (WCAG 2.2 AA) violations in any view in light or dark; nothing runs off a 375-pixel screen at 200% text size. Layouts follow the space the component has, so the month grid becomes a day list in narrow columns.
11
+ - **The Astro example site** in `examples/astro-events` now uses these components; its own copies of the code are gone.
12
+ - **The plugin itself is unchanged:** same permissions, schema and MCP tools as 0.18.7. The Registry bundle only fetches its admin language packs from locales 0.1.12 (the same texts). EmDash `>=1.2.0 <2.0.0`.
@@ -24,7 +24,7 @@ To reuse an announcement, choose **Duplicate** in Eventual's event list. The cop
24
24
 
25
25
  ## Venues, organizers and languages
26
26
 
27
- **Eventual → Venues** and **Organizers** link to their collections. Create and publish referenced entries before publishing an event that uses them. Published meeting/contact URLs appear in public feeds; use links intended for visitors.
27
+ Venues and organizers are ordinary EmDash collections: open them from the sidebar, or from the links on the **Eventual RSVP** page. Create and publish referenced entries before publishing an event that uses them. Published meeting/contact URLs appear in public feeds; use links intended for visitors.
28
28
 
29
29
  Use EmDash's translation controls for other languages. Each language has its own title, description and individual-date announcement. Published schedules and venue/organizer selections are shared across translations. Your site's translation service is a separate choice.
30
30
 
@@ -64,8 +64,6 @@
64
64
  ],
65
65
  "pages": [
66
66
  { "path": "/events", "label": "Eventual RSVP", "icon": "calendar" },
67
- { "path": "/venues", "label": "Venues", "icon": "map-pin" },
68
- { "path": "/organizers", "label": "Organizers", "icon": "users" },
69
67
  { "path": "/settings", "label": "Event settings", "icon": "settings" }
70
68
  ],
71
69
  "editorPanels": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vermeulen.solutions/eventual",
3
- "version": "0.18.6",
3
+ "version": "0.19.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://eventual.rsvp/",
6
6
  "type": "module",
@@ -22,6 +22,9 @@
22
22
  "./astro": "./astro/feed.ts",
23
23
  "./astro/schema": "./astro/schema.ts",
24
24
  "./astro/EventList.astro": "./astro/EventList.astro",
25
+ "./astro/events": "./astro/events/index.ts",
26
+ "./astro/EventBrowser.astro": "./astro/events/EventBrowser.astro",
27
+ "./astro/EventDetail.astro": "./astro/events/EventDetail.astro",
25
28
  "./transfer": {
26
29
  "types": "./transfer/index.d.mts",
27
30
  "import": "./transfer/index.mjs"
@@ -68,7 +71,9 @@
68
71
  "docs/release-notes-0.18.3.md",
69
72
  "docs/release-notes-0.18.4.md",
70
73
  "docs/release-notes-0.18.5.md",
71
- "docs/release-notes-0.18.6.md"
74
+ "docs/release-notes-0.18.6.md",
75
+ "docs/release-notes-0.18.7.md",
76
+ "docs/release-notes-0.19.0.md"
72
77
  ],
73
78
  "scripts": {
74
79
  "validate": "emdash-plugin validate",
@@ -116,7 +121,7 @@
116
121
  "dependencies": {
117
122
  "@lingui/core": "5.9.5",
118
123
  "zod": "4.5.4",
119
- "@vermeulen.solutions/eventual-locales": "0.1.10"
124
+ "@vermeulen.solutions/eventual-locales": "0.1.12"
120
125
  },
121
126
  "allowScripts": {
122
127
  "esbuild": true,
@@ -3,22 +3,26 @@
3
3
  import { writeFileSync } from 'node:fs';
4
4
  import {createEventsCollectionBlueprint,createVenuesCollectionBlueprint,createOrganizersCollectionBlueprint} from '../astro/blueprint.mjs';
5
5
  const args=process.argv.slice(2);
6
- let eventCollection='events',venueCollection='venues',organizerCollection='organizers',locale='fr',output,reuseVenues=false,reuseOrganizers=false,legacyCompatibility=false;
6
+ // New events start in this time zone: the computer's own unless --timezone names another.
7
+ let eventCollection='events',venueCollection='venues',organizerCollection='organizers',locale='fr',defaultTimezone=Intl.DateTimeFormat().resolvedOptions().timeZone||'UTC',output,reuseVenues=false,reuseOrganizers=false,legacyCompatibility=false;
7
8
  for(let i=0;i<args.length;i++) {
8
9
  if(args[i]==='--event-collection') eventCollection=args[++i];
9
10
  else if(args[i]==='--venue-collection') venueCollection=args[++i];
10
11
  else if(args[i]==='--organizer-collection') organizerCollection=args[++i];
11
12
  else if(args[i]==='--locale') locale=args[++i];
13
+ else if(args[i]==='--timezone') defaultTimezone=args[++i];
12
14
  else if(args[i]==='--reuse-venues') reuseVenues=true;
13
15
  else if(args[i]==='--reuse-organizers') reuseOrganizers=true;
14
16
  else if(args[i]==='--legacy-compatibility') legacyCompatibility=true;
15
17
  else if(args[i]==='--output') output=args[++i];
16
- else throw new Error('Use --event-collection, --venue-collection, --organizer-collection, --locale, --reuse-venues, --reuse-organizers, --legacy-compatibility and/or --output.');
18
+ else throw new Error('Use --event-collection, --venue-collection, --organizer-collection, --locale, --timezone, --reuse-venues, --reuse-organizers, --legacy-compatibility and/or --output.');
17
19
  }
18
20
  for(const slug of [eventCollection,venueCollection,organizerCollection]) if(!slug || !/^[a-z][a-z0-9_]{0,62}$/.test(slug)) throw new Error('Invalid collection slug.');
19
21
  if(new Set([eventCollection,venueCollection,organizerCollection]).size!==3) throw new Error('Use separate event, venue and organizer collections.');
20
22
  if(!locale || Intl.getCanonicalLocales(locale)[0]!==locale) throw new Error('Use a canonical locale such as fr or en.');
21
- const events=createEventsCollectionBlueprint({eventCollection,venueCollection,organizerCollection,bindRelations:false,legacyCompatibility});
23
+ try { new Intl.DateTimeFormat('en',{timeZone:defaultTimezone}); } catch { throw new Error('Use an IANA time zone such as Europe/London or America/New_York.'); }
24
+ console.error('New events start in the time zone '+defaultTimezone+' (change with --timezone).');
25
+ const events=createEventsCollectionBlueprint({eventCollection,venueCollection,organizerCollection,bindRelations:false,legacyCompatibility,defaultTimezone});
22
26
  // Stock core widgets only: the sandbox panel supplies schedule controls.
23
27
  const collections=[events];
24
28
  if(!reuseVenues) collections.push({...createVenuesCollectionBlueprint({legacyCompatibility}),slug:venueCollection});
@@ -1,4 +1,5 @@
1
1
  import { safeHttpUrl } from "./venue";
2
+ import { portableTextToPlainText } from "./portable-text";
2
3
  export interface CalendarLinks {
3
4
  google: string;
4
5
  outlook: string;
@@ -29,7 +30,8 @@ export interface CalendarEventInput {
29
30
  export function buildCalendarLinks(event: CalendarEventInput, siteUrl = "", pluginId = "eventual"): CalendarLinks {
30
31
  const title = event.title || "Event";
31
32
  const onlineUrl = safeHttpUrl(event.virtualUrl ?? "");
32
- const details = [event.description || "", onlineUrl].filter(Boolean).join("\n\n");
33
+ // Native descriptions are Portable Text (stored as JSON): calendars get readable text.
34
+ const details = [portableTextToPlainText(event.description ?? ""), onlineUrl].filter(Boolean).join("\n\n");
33
35
 
34
36
  let loc = event.location || "";
35
37
  if (event.locationType === "virtual") {
@@ -6,17 +6,22 @@ export class SandboxBudgetError extends Error {
6
6
  this.name = 'SandboxBudgetError';
7
7
  }
8
8
  }
9
- type Budget = { used: number; reserved: number };
9
+ type Budget = { used: number; reserved: number; limit: number };
10
10
  const state = Symbol('eventual invocation budget');
11
11
  type BudgetContext = EventualContext & {[state]?: Budget};
12
12
  const contexts = new WeakMap<object, EventualContext>();
13
13
 
14
- /** One counter covers lazy storage collections, parallel calls, and copied contexts. */
15
- export function withInvocationBudget(ctx: EventualContext): EventualContext {
14
+ /**
15
+ * One counter covers lazy storage collections, parallel calls, and copied contexts.
16
+ * 10 calls per request is EmDash's Cloudflare sandbox limit up to 1.4. Since 1.5 it is 30, and the
17
+ * Node sandbox sets none: read-only routes may ask for 30, where an older Cloudflare host fails the
18
+ * request with its own error instead of this budget's.
19
+ */
20
+ export function withInvocationBudget(ctx: EventualContext, limit = 10): EventualContext {
16
21
  if ((ctx as BudgetContext)[state]) return ctx;
17
22
  const cached = contexts.get(ctx);
18
23
  if (cached) return cached;
19
- const budget = { used: 0, reserved: 0 };
24
+ const budget = { used: 0, reserved: 0, limit };
20
25
  // Enumerable symbols survive object spread and are excluded from serialized output.
21
26
  const wrapped: BudgetContext = { ...ctx, [state]: budget };
22
27
  const facade = (target: object): object => {
@@ -24,7 +29,7 @@ export function withInvocationBudget(ctx: EventualContext): EventualContext {
24
29
  const value = Reflect.get(target, key, target);
25
30
  if (typeof value !== 'function') return value;
26
31
  return (...args: unknown[]) => {
27
- if (budget.used + budget.reserved >= 10) throw new SandboxBudgetError();
32
+ if (budget.used + budget.reserved >= budget.limit) throw new SandboxBudgetError();
28
33
  budget.used++;
29
34
  return Reflect.apply(value, target, args);
30
35
  };
@@ -45,12 +50,12 @@ export function withInvocationBudget(ctx: EventualContext): EventualContext {
45
50
  export function reserveRpcCalls(ctx: EventualContext, count: number): () => void {
46
51
  const budget = (ctx as BudgetContext)[state];
47
52
  if (!budget) return () => {};
48
- if (budget.used + budget.reserved + count > 10) throw new SandboxBudgetError();
53
+ if (budget.used + budget.reserved + count > budget.limit) throw new SandboxBudgetError();
49
54
  budget.reserved += count;
50
55
  let released = false;
51
56
  return () => { if (!released) { budget.reserved -= count; released = true; } };
52
57
  }
53
58
  export function remainingRpcCalls(ctx: EventualContext): number {
54
59
  const budget = (ctx as BudgetContext)[state];
55
- return budget ? 10 - budget.used - budget.reserved : 10;
60
+ return budget ? budget.limit - budget.used - budget.reserved : 10;
56
61
  }
@@ -12,6 +12,9 @@ import { categoryKey } from "./category";
12
12
  import type { CalendarCancellation, EventualContext } from "../storage";
13
13
  import { reserveRpcCalls } from './invocation-budget';
14
14
 
15
+ /** Hex SHA-256 of a text. */
16
+ export const sha256 = async (text: string) => Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))), byte => byte.toString(16).padStart(2, '0')).join('');
17
+
15
18
  interface CalendarState {
16
19
  from?: string;
17
20
  locales?: string[];
@@ -102,15 +105,21 @@ export async function reconcileNativeCalendar(ctx: EventualContext): Promise<{
102
105
  const rows = (groups.get(key) ?? []).sort((a, b) =>
103
106
  a.id.localeCompare(b.id),
104
107
  );
105
- const fingerprint = JSON.stringify(
108
+ const content = JSON.stringify(
106
109
  [ctx.site, source.schema?.urlPattern, source.schema?.routable, rows.map((row) => ({
107
110
  ...row,
108
111
  calendarSequence: undefined,
109
112
  venue: localizedVenue(venues, row),
110
113
  }))],
111
114
  );
115
+ // The snapshot keeps a SHA-256 of each group, not the group itself: the full text made a
116
+ // year of one-off events outgrow the 1 MiB snapshot at about 500 events. Snapshots written
117
+ // before 0.18.7 still hold the text; it counts as unchanged and is replaced by its hash.
118
+ const fingerprint = await sha256(content);
112
119
  const cache = cached.get(key);
113
- if (cache?.fingerprint === fingerprint && cache.from === from) {
120
+ const same = cache?.fingerprint === fingerprint || cache?.fingerprint === content;
121
+ if (same && cache!.from === from) {
122
+ if (cache!.fingerprint !== fingerprint) { next.set(key, { ...cache!, fingerprint }); changedSnapshot = true; }
114
123
  occurrenceCount += cache.occurrences.length;
115
124
  if (occurrenceCount > 10000)
116
125
  reject("Calendar occurrence limit exceeded.");
@@ -122,7 +131,7 @@ export async function reconcileNativeCalendar(ctx: EventualContext): Promise<{
122
131
  reject("Calendar cancellation limit exceeded.");
123
132
  continue;
124
133
  }
125
- const changed = cache?.fingerprint !== fingerprint;
134
+ const changed = !same;
126
135
  const sequence = cache
127
136
  ? cache.sequence + (changed ? 1 : 0)
128
137
  : rows.some((row) => row.calendarUid)
@@ -48,6 +48,8 @@ export interface SchemaBlueprintOptions {
48
48
  bindRelations?: boolean;
49
49
  /** Opt in only when importing private-storage records from older prototypes. */
50
50
  legacyCompatibility?: boolean;
51
+ /** Time zone new events start in (IANA name). Default Europe/Zurich, for existing callers. */
52
+ defaultTimezone?: string;
51
53
  }
52
54
  function field(
53
55
  slug: string,
@@ -137,7 +139,7 @@ export function createEventsCollectionBlueprint(
137
139
  field("start_date", "string"),
138
140
  field("end_date", "string"),
139
141
  field("all_day", "boolean", false, { defaultValue: false }),
140
- field("timezone", "string", false, { defaultValue: "Europe/Zurich" }),
142
+ field("timezone", "string", false, { defaultValue: options.defaultTimezone ?? "Europe/Zurich" }),
141
143
  field("location_type", "select", false, {
142
144
  widget: "eventual-editor:location-type",
143
145
  defaultValue: "physical",