@vermeulen.solutions/eventual 0.18.5 → 0.18.7
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 +7 -7
- package/astro/EventList.astro +124 -5
- package/astro/blueprint.d.mts +2 -0
- package/astro/blueprint.mjs +1 -1
- package/astro/install.mjs +3 -3
- package/dist/index.mjs +1 -11
- package/dist/plugin.mjs +7 -7
- package/docs/collection-setup.md +58 -58
- package/docs/developer-guide.md +19 -4
- package/docs/history.md +16 -16
- package/docs/registry-installation.md +3 -3
- package/docs/release-notes-0.18.5.md +8 -8
- package/docs/release-notes-0.18.6.md +5 -0
- package/docs/release-notes-0.18.7.md +13 -0
- package/docs/user-guide.md +1 -1
- package/emdash-plugin.jsonc +4 -3
- package/package.json +4 -2
- package/scripts/export-native-schema.mjs +8 -4
- package/src/domain/calendar-links.ts +84 -82
- package/src/domain/invocation-budget.ts +12 -7
- package/src/domain/native-calendar.ts +12 -3
- package/src/schema/blueprint.ts +3 -1
package/docs/collection-setup.md
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
# Install and connect Eventual RSVP – Core
|
|
2
|
-
|
|
3
|
-
Eventual RSVP – Core requires EmDash **>=1.2.0 <2.0.0**; it is tested on **1.2.0**, **1.4.0** and **1.
|
|
4
|
-
|
|
5
|
-
## In the EmDash admin
|
|
6
|
-
|
|
7
|
-
1. Open **Plugins** and browse the **Registry**. Find **Eventual RSVP – Core**, published by **vermeulen.solutions**, review its permissions, and install it. Existing installations use the plugin's update action.
|
|
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
|
-
3. Create a draft, save it, set its schedule in **Dates, venue & repeat**, and publish it. Check it on your site's calendar.
|
|
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.
|
|
12
|
-
|
|
13
|
-
## Agent tools (optional)
|
|
14
|
-
|
|
15
|
-
Installing does not give AI agents access. Eventual RSVP's tools for agents (MCP tools) stay off until an administrator turns them on:
|
|
16
|
-
|
|
17
|
-
1. Open **Plugins**.
|
|
18
|
-
2. Expand the details of **Eventual RSVP – Core** with the arrow on its row.
|
|
19
|
-
3. Switch on **Agent access**.
|
|
20
|
-
|
|
21
|
-
The [developer guide](developer-guide.md#settings-tools-and-transfer) lists the tools and the permissions they need.
|
|
22
|
-
|
|
23
|
-
## The old-events switch
|
|
24
|
-
|
|
25
|
-
Leave **Show old events saved inside the plugin** off for native collections. Enable it and choose **Save switch** only to serve old plugin data while no native event collection is connected. It never combines old rows with native events or repairs a missing explicitly selected collection.
|
|
26
|
-
|
|
27
|
-
To make old entries editable, follow [upgrading and migration](upgrade-0.13.0.md). An empty connected collection may produce an empty calendar; an unconfigured source produces a clear error instead.
|
|
28
|
-
|
|
29
|
-
## For the site builder
|
|
30
|
-
|
|
31
|
-
**Install the backend one way only**: from the Registry as above, or from npm in `astro.config.mjs`, not both. A Registry install is addressed by a generated plugin ID that starts with `r_`, not by `eventual`; the **Subscribe** links on the Eventual RSVP admin page show the exact addresses. The helpers are on npm as `@vermeulen.solutions/eventual` (the unscoped package `eventual` is unrelated; do not install it). Details: [versions, plugin ID and backends](developer-guide.md#versions-and-where-to-get-them).
|
|
32
|
-
|
|
33
|
-
After `npm ci` and `npm run build` in this repository, using Node 24+:
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
node scripts/export-native-schema.mjs --locale fr --output eventual-schema.json
|
|
37
|
-
```
|
|
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.
|
|
40
|
-
|
|
41
|
-
Defaults are `events`, `venues`, and `organizers` (19/8/3 fields). Custom names and directory reuse:
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
node scripts/export-native-schema.mjs --event-collection activities --venue-collection locations --reuse-venues --locale fr --output activities-schema.json
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
`--reuse-venues` and `--reuse-organizers` omit existing directories. Use a locale already configured on the site. Inspect and apply the exact blueprint through authenticated EmDash schema tools or the site's supported schema deployment process. Re-read the fields, then select the collections in Event settings. Eventual has read-only schema permission.
|
|
48
|
-
|
|
49
|
-
For a **new local SQLite** schema, the installed EmDash CLI supports:
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
npx emdash seed eventual-schema.json --validate
|
|
53
|
-
npx emdash seed eventual-schema.json --database ./data.db --no-content --on-conflict error
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Use the actual database path. Remote D1 uses the site's remote schema workflow. For populated collections, compare the blueprint and apply reviewed additive changes instead of recreating them.
|
|
57
|
-
|
|
58
|
-
Preserve Portable Text, shared schedule/reference flags, localized title/description/occurrence copy, and exact reference targets. An event reference requires its corresponding directory selection. Column-backed and relation-bound references differ: keep the exporter's definition intact. See the [developer guide](developer-guide.md).
|
|
1
|
+
# Install and connect Eventual RSVP – Core
|
|
2
|
+
|
|
3
|
+
Eventual RSVP – Core requires EmDash **>=1.2.0 <2.0.0**; it is tested on **1.2.0**, **1.4.0**, **1.5.0** and **1.6.0**, with 1.4.0 or newer recommended for the form and Cloudflare fixes. Editors can use the [event guide](user-guide.md) once an administrator completes this setup.
|
|
4
|
+
|
|
5
|
+
## In the EmDash admin
|
|
6
|
+
|
|
7
|
+
1. Open **Plugins** and browse the **Registry**. Find **Eventual RSVP – Core**, published by **vermeulen.solutions**, review its permissions, and install it. Existing installations use the plugin's update action.
|
|
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
|
+
3. Create a draft, save it, set its schedule in **Dates, venue & repeat**, and publish it. Check it on your site's calendar.
|
|
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.
|
|
12
|
+
|
|
13
|
+
## Agent tools (optional)
|
|
14
|
+
|
|
15
|
+
Installing does not give AI agents access. Eventual RSVP's tools for agents (MCP tools) stay off until an administrator turns them on:
|
|
16
|
+
|
|
17
|
+
1. Open **Plugins**.
|
|
18
|
+
2. Expand the details of **Eventual RSVP – Core** with the arrow on its row.
|
|
19
|
+
3. Switch on **Agent access**.
|
|
20
|
+
|
|
21
|
+
The [developer guide](developer-guide.md#settings-tools-and-transfer) lists the tools and the permissions they need.
|
|
22
|
+
|
|
23
|
+
## The old-events switch
|
|
24
|
+
|
|
25
|
+
Leave **Show old events saved inside the plugin** off for native collections. Enable it and choose **Save switch** only to serve old plugin data while no native event collection is connected. It never combines old rows with native events or repairs a missing explicitly selected collection.
|
|
26
|
+
|
|
27
|
+
To make old entries editable, follow [upgrading and migration](upgrade-0.13.0.md). An empty connected collection may produce an empty calendar; an unconfigured source produces a clear error instead.
|
|
28
|
+
|
|
29
|
+
## For the site builder
|
|
30
|
+
|
|
31
|
+
**Install the backend one way only**: from the Registry as above, or from npm in `astro.config.mjs`, not both. A Registry install is addressed by a generated plugin ID that starts with `r_`, not by `eventual`; the **Subscribe** links on the Eventual RSVP admin page show the exact addresses. The helpers are on npm as `@vermeulen.solutions/eventual` (the unscoped package `eventual` is unrelated; do not install it). Details: [versions, plugin ID and backends](developer-guide.md#versions-and-where-to-get-them). Moving an existing site from the config to the Registry? Read [what stays behind](developer-guide.md#moving-a-site-from-the-config-to-the-registry) first: calendar subscribers' address changes.
|
|
32
|
+
|
|
33
|
+
After `npm ci` and `npm run build` in this repository, using Node 24+:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
node scripts/export-native-schema.mjs --locale fr --output eventual-schema.json
|
|
37
|
+
```
|
|
38
|
+
|
|
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
|
+
|
|
41
|
+
Defaults are `events`, `venues`, and `organizers` (19/8/3 fields). Custom names and directory reuse:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
node scripts/export-native-schema.mjs --event-collection activities --venue-collection locations --reuse-venues --locale fr --output activities-schema.json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`--reuse-venues` and `--reuse-organizers` omit existing directories. Use a locale already configured on the site. Inspect and apply the exact blueprint through authenticated EmDash schema tools or the site's supported schema deployment process. Re-read the fields, then select the collections in Event settings. Eventual has read-only schema permission.
|
|
48
|
+
|
|
49
|
+
For a **new local SQLite** schema, the installed EmDash CLI supports:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npx emdash seed eventual-schema.json --validate
|
|
53
|
+
npx emdash seed eventual-schema.json --database ./data.db --no-content --on-conflict error
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use the actual database path. Remote D1 uses the site's remote schema workflow. For populated collections, compare the blueprint and apply reviewed additive changes instead of recreating them.
|
|
57
|
+
|
|
58
|
+
Preserve Portable Text, shared schedule/reference flags, localized title/description/occurrence copy, and exact reference targets. An event reference requires its corresponding directory selection. Column-backed and relation-bound references differ: keep the exporter's definition intact. See the [developer guide](developer-guide.md).
|
package/docs/developer-guide.md
CHANGED
|
@@ -49,9 +49,23 @@ Since 0.18.5 every link Eventual builds itself (the admin's Subscribe links and
|
|
|
49
49
|
- Both run their checks when an event is saved, so one save can be handled twice.
|
|
50
50
|
- The admin shows two sets of Eventual pages, and the site has two feeds at two addresses.
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
The source installer (`emdashWithEventual`) stops the build when it finds the backend listed twice in the config; it cannot see a Registry install.
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
### Moving a site from the config to the Registry
|
|
55
|
+
|
|
56
|
+
EmDash keeps each plugin's own data under its plugin ID. A Registry install has a new ID, so it starts empty, and what the old install stored stays behind under `eventual`. It is not deleted, but the new install cannot read it. Events, venues and organizers are EmDash content and are not affected.
|
|
57
|
+
|
|
58
|
+
What stays behind, and what to do:
|
|
59
|
+
|
|
60
|
+
- **Settings.** Select the collections again under **Event settings** (or with the `updateSettings` tool), and set the default time zone again.
|
|
61
|
+
- **Calendar subscribers.** The subscription address contains the plugin ID. Anyone subscribed to `/_emdash/api/plugins/eventual/calendar` gets "not found" once the old install is removed, and their calendar app stops updating without telling them. Update the links on your pages before the move, and tell regular subscribers the new address, or keep the old address working with a redirect on your site.
|
|
62
|
+
- **Calendar state.** Update counters (`SEQUENCE`) start again from 0, and cancellations already sent are not sent again. Calendar apps that re-read the subscription are not affected; an event a visitor imported as a single `.ics` file may not update.
|
|
63
|
+
- **Old events stored inside the plugin** (from before 0.13): migrate them to a collection first, as in [upgrading](upgrade-0.13.0.md).
|
|
64
|
+
|
|
65
|
+
Registrations and Tickets keep much more under their own IDs (registrations, orders, signing keys, payment settings). Read their guides before moving them.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
Source tooling needs Node 24+. Peer ranges are in [package.json](../package.json); release acceptance uses EmDash/Admin/Block Kit **1.2.0 and 1.4.0**, Astro 7.3.x/7.4.x and React 19. The source `@vermeulen.solutions/eventual/install` lane is tested on 1.2.0, 1.4.0, 1.5.0 and 1.6.0. It refuses only hosts older than 1.2.0; a newer untested host builds with a warning, and an editor adapter that no longer matches the admin build steps aside (with a warning) so EmDash's own editor is used. Registry installs never execute that transform.
|
|
55
69
|
|
|
56
70
|
| Host | Status | Notes |
|
|
57
71
|
| --- | --- | --- |
|
|
@@ -59,6 +73,7 @@ Source tooling needs Node 24+. Peer ranges are in [package.json](../package.json
|
|
|
59
73
|
| 1.3.x | supported, untested | Same form/Cloudflare limitations; includes the plugin-storage cursor fix. |
|
|
60
74
|
| 1.4.x | supported, full acceptance | Recommended. Fixes nested Block Kit forms and Cloudflare plugin mutations. |
|
|
61
75
|
| 1.5.x | supported, host-tested | 1.5.0 passes the native-site and plugin integration suites; the admin adapter recognises its editor panel. |
|
|
76
|
+
| 1.6.x | supported, host-tested | 1.6.0 passes the browser acceptance on a fresh site with the sandbox runner 0.9.8; both admin adapters apply to its builds. |
|
|
62
77
|
| newer | allowed with a warning | Not yet tested. Check the event editor after upgrading. |
|
|
63
78
|
|
|
64
79
|
## Public routes
|
|
@@ -113,7 +128,7 @@ if (!result.success) throw new Error(result.error?.message ?? 'Event feed unavai
|
|
|
113
128
|
|
|
114
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.
|
|
115
130
|
|
|
116
|
-
`@vermeulen.solutions/eventual/astro/EventList.astro` is an optional
|
|
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. The [showcase](../examples/astro-events/README.md) supplies seven complete visitor layouts.
|
|
117
132
|
|
|
118
133
|
## Settings, tools and transfer
|
|
119
134
|
|
|
@@ -131,7 +146,7 @@ exportRecords follows cursors (default 5, maximum 10). Native native-content-v1
|
|
|
131
146
|
|
|
132
147
|
## Limits and checks
|
|
133
148
|
|
|
134
|
-
The host's
|
|
149
|
+
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).
|
|
135
150
|
|
|
136
151
|
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.
|
|
137
152
|
|
package/docs/history.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# History and release evidence
|
|
2
|
-
|
|
3
|
-
Current instructions are [using Eventual](user-guide.md), [setup](collection-setup.md), [upgrading](upgrade-0.13.0.md) and the [developer guide](developer-guide.md). [CHANGELOG](../CHANGELOG.md) summarizes earlier versions.
|
|
4
|
-
|
|
5
|
-
The [0.14.1 acceptance record](../audit/releases/0.14.1/README.md) covers the EmDash 1.2.0/1.4.0 compatibility release, the local test-site native gate, and the packed-consumer editor acceptance. It is not a publication record.
|
|
6
|
-
|
|
7
|
-
The [0.14.0 acceptance record](../audit/releases/0.14.0/README.md) retains publication-time CIDs, checksums, verification and BBHC deployment evidence. Its figures and signed records describe that release, not a fresh build of today's documentation. Listing-documentation updates can change the profile CID while the versioned release remains unchanged.
|
|
8
|
-
|
|
9
|
-
Older release notes, prototype instructions, implementation plans and handovers remain available in the [documentation snapshot before consolidation](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/tree/9bd38934de72c562639093e38a56fe6b3e3e2818/docs). They are historical evidence, not installation instructions:
|
|
10
|
-
|
|
11
|
-
- [0.13.0 native-content release](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/release-notes-0.13.0.md).
|
|
12
|
-
- [EmDash 1.0.1 editor-adapter runbook](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/editor-upgrade.md); the current plugin uses EmDash 1.2+ without that adapter.
|
|
13
|
-
- [0.14.0 pre-release audit](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/0.14.0-audit-handover.md); acceptance later repaired weekday translations and published the release.
|
|
14
|
-
- [RPC implementation proposal](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/sandbox-rpc-implementation-plan.md); proposed background jobs and capacity targets are not implemented guarantees.
|
|
15
|
-
|
|
16
|
-
The unsupported prototype/private-form and two-package installation proposals are retired. Current limitations and open API work are summarized in the developer guide, rather than repeated across handovers.
|
|
1
|
+
# History and release evidence
|
|
2
|
+
|
|
3
|
+
Current instructions are [using Eventual](user-guide.md), [setup](collection-setup.md), [upgrading](upgrade-0.13.0.md) and the [developer guide](developer-guide.md). [CHANGELOG](../CHANGELOG.md) summarizes earlier versions.
|
|
4
|
+
|
|
5
|
+
The [0.14.1 acceptance record](../audit/releases/0.14.1/README.md) covers the EmDash 1.2.0/1.4.0 compatibility release, the local test-site native gate, and the packed-consumer editor acceptance. It is not a publication record.
|
|
6
|
+
|
|
7
|
+
The [0.14.0 acceptance record](../audit/releases/0.14.0/README.md) retains publication-time CIDs, checksums, verification and BBHC deployment evidence. Its figures and signed records describe that release, not a fresh build of today's documentation. Listing-documentation updates can change the profile CID while the versioned release remains unchanged.
|
|
8
|
+
|
|
9
|
+
Older release notes, prototype instructions, implementation plans and handovers remain available in the [documentation snapshot before consolidation](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/tree/9bd38934de72c562639093e38a56fe6b3e3e2818/docs). They are historical evidence, not installation instructions:
|
|
10
|
+
|
|
11
|
+
- [0.13.0 native-content release](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/release-notes-0.13.0.md).
|
|
12
|
+
- [EmDash 1.0.1 editor-adapter runbook](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/editor-upgrade.md); the current plugin uses EmDash 1.2+ without that adapter.
|
|
13
|
+
- [0.14.0 pre-release audit](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/0.14.0-audit-handover.md); acceptance later repaired weekday translations and published the release.
|
|
14
|
+
- [RPC implementation proposal](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/blob/9bd38934de72c562639093e38a56fe6b3e3e2818/docs/sandbox-rpc-implementation-plan.md); proposed background jobs and capacity targets are not implemented guarantees.
|
|
15
|
+
|
|
16
|
+
The unsupported prototype/private-form and two-package installation proposals are retired. Current limitations and open API work are summarized in the developer guide, rather than repeated across handovers.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Eventual RSVP – Core 0.18.
|
|
1
|
+
# Eventual RSVP – Core 0.18.7
|
|
2
2
|
|
|
3
|
-
Requires EmDash **>=1.2.0 <2.0.0**; tested on 1.2.0, 1.4.0 and 1.
|
|
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.
|
|
5
|
+
In **Plugins → Registry**, find **Eventual RSVP – Core** by **vermeulen.solutions**, review permissions and install or update. 0.18.7 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
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Eventual RSVP – Core 0.18.5 — links on Registry installs
|
|
2
|
-
|
|
3
|
-
- **Subscribe links work on Registry installs.** A plugin installed from the EmDash Registry is addressed by a generated ID that starts with `r_`, not by `eventual`. The **Subscribe** links on the Eventual RSVP admin page (calendar subscription and JSON feed) still used `eventual` and answered "Plugin route not found" on those sites. They now use the installed ID, so they also show a site builder the exact addresses to use. ([#7](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/issues/7))
|
|
4
|
-
- **Per-event `.ics` links too.** The `calendarLinks.ics` address that the public feed gives for each event had the same fault. Pages that render it (for example `EventList.astro` with `showCalendarLinks`) get a working link after the update, without a code change.
|
|
5
|
-
- **The per-event `.ics` link downloads that event only.** It used to return the whole year's calendar, because the `calendar` route ignored `eventId`. Now `calendar?eventId=<id>` returns one event: every upcoming date of a repeating event, or one date with an occurrence ID (`<id>#<date>`). The link from a translated page gives that translation. The event keeps the UID it has in the subscription, so subscribers do not get a duplicate. An unknown, unpublished or past event answers 404. The subscription itself is unchanged.
|
|
6
|
-
- **Helpers on npm:** `buildCalendarLinks(event, siteUrl, pluginId)` takes the plugin ID as an optional third argument. The Astro showcase reads it from the new optional `EVENTUAL_PLUGIN_ID` setting.
|
|
7
|
-
- **Clearer documentation** ([#8](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/issues/8)): the [developer guide](developer-guide.md) has a new file name and starts with versions and where to get them. It warns against the unrelated npm package `eventual`, explains what goes wrong with two backends on one site, and says where to turn on agent tools.
|
|
8
|
-
- **Nothing else changes**: no permission or schema changes, and no new MCP tools. Config-managed installs keep the ID `eventual` and behave exactly as 0.18.4. EmDash `>=1.2.0 <2.0.0` (tested on 1.2.0, 1.4.0 and 1.5.0).
|
|
1
|
+
# Eventual RSVP – Core 0.18.5 — links on Registry installs
|
|
2
|
+
|
|
3
|
+
- **Subscribe links work on Registry installs.** A plugin installed from the EmDash Registry is addressed by a generated ID that starts with `r_`, not by `eventual`. The **Subscribe** links on the Eventual RSVP admin page (calendar subscription and JSON feed) still used `eventual` and answered "Plugin route not found" on those sites. They now use the installed ID, so they also show a site builder the exact addresses to use. ([#7](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/issues/7))
|
|
4
|
+
- **Per-event `.ics` links too.** The `calendarLinks.ics` address that the public feed gives for each event had the same fault. Pages that render it (for example `EventList.astro` with `showCalendarLinks`) get a working link after the update, without a code change.
|
|
5
|
+
- **The per-event `.ics` link downloads that event only.** It used to return the whole year's calendar, because the `calendar` route ignored `eventId`. Now `calendar?eventId=<id>` returns one event: every upcoming date of a repeating event, or one date with an occurrence ID (`<id>#<date>`). The link from a translated page gives that translation. The event keeps the UID it has in the subscription, so subscribers do not get a duplicate. An unknown, unpublished or past event answers 404. The subscription itself is unchanged.
|
|
6
|
+
- **Helpers on npm:** `buildCalendarLinks(event, siteUrl, pluginId)` takes the plugin ID as an optional third argument. The Astro showcase reads it from the new optional `EVENTUAL_PLUGIN_ID` setting.
|
|
7
|
+
- **Clearer documentation** ([#8](https://github.com/Vermeulen-Solutions/eventual-rsvp-core/issues/8)): the [developer guide](developer-guide.md) has a new file name and starts with versions and where to get them. It warns against the unrelated npm package `eventual`, explains what goes wrong with two backends on one site, and says where to turn on agent tools.
|
|
8
|
+
- **Nothing else changes**: no permission or schema changes, and no new MCP tools. Config-managed installs keep the ID `eventual` and behave exactly as 0.18.4. EmDash `>=1.2.0 <2.0.0` (tested on 1.2.0, 1.4.0 and 1.5.0).
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Eventual RSVP – Core 0.18.6 — EmDash 1.6 and moving to the Registry
|
|
2
|
+
|
|
3
|
+
- **Tested on EmDash 1.6.0.** Sites that install Core from npm with the source installer no longer get an "untested version" warning on EmDash 1.6.0, and the editor adapters apply to its admin. Registry installs were already running on 1.6; they are now covered by the same browser acceptance.
|
|
4
|
+
- **Before moving a site from the config to the Registry,** read the new section in the [developer guide](developer-guide.md#moving-a-site-from-the-config-to-the-registry). A Registry install has a new plugin ID and starts with empty settings. Calendar subscribers' address contains that ID, so subscriptions to the old address stop updating unless you redirect it.
|
|
5
|
+
- **Nothing else changes:** no runtime, 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,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).
|
package/docs/user-guide.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/emdash-plugin.jsonc
CHANGED
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"installation": { "file": "./docs/registry-installation.md" },
|
|
16
16
|
"changelog": { "file": "./docs/registry-changelog.md" }
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
// Keep the repository's former address here. The Registry's package profile is linked to it,
|
|
19
|
+
// `emdash-plugin publish` refuses a release that names another one ("The package profile is
|
|
20
|
+
// linked to …"), and no CLI command changes that link. GitHub redirects it to eventual-rsvp-core.
|
|
21
|
+
"repo": "https://github.com/Vermeulen-Solutions/eventual-emdash-sandbox",
|
|
19
22
|
"release": {
|
|
20
23
|
"requires": { "env:emdash": ">=1.2.0 <2.0.0" },
|
|
21
24
|
"artifacts": {
|
|
@@ -61,8 +64,6 @@
|
|
|
61
64
|
],
|
|
62
65
|
"pages": [
|
|
63
66
|
{ "path": "/events", "label": "Eventual RSVP", "icon": "calendar" },
|
|
64
|
-
{ "path": "/venues", "label": "Venues", "icon": "map-pin" },
|
|
65
|
-
{ "path": "/organizers", "label": "Organizers", "icon": "users" },
|
|
66
67
|
{ "path": "/settings", "label": "Event settings", "icon": "settings" }
|
|
67
68
|
],
|
|
68
69
|
"editorPanels": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vermeulen.solutions/eventual",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://eventual.rsvp/",
|
|
6
6
|
"type": "module",
|
|
@@ -67,7 +67,9 @@
|
|
|
67
67
|
"docs/release-notes-0.18.2.md",
|
|
68
68
|
"docs/release-notes-0.18.3.md",
|
|
69
69
|
"docs/release-notes-0.18.4.md",
|
|
70
|
-
"docs/release-notes-0.18.5.md"
|
|
70
|
+
"docs/release-notes-0.18.5.md",
|
|
71
|
+
"docs/release-notes-0.18.6.md",
|
|
72
|
+
"docs/release-notes-0.18.7.md"
|
|
71
73
|
],
|
|
72
74
|
"scripts": {
|
|
73
75
|
"validate": "emdash-plugin validate",
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/** Emit a schema-only seed. Never connect to a database or overwrite a file. */
|
|
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
|
-
|
|
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
|
-
|
|
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,82 +1,84 @@
|
|
|
1
|
-
import { safeHttpUrl } from "./venue";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
loc =
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
let
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
import { safeHttpUrl } from "./venue";
|
|
2
|
+
import { portableTextToPlainText } from "./portable-text";
|
|
3
|
+
export interface CalendarLinks {
|
|
4
|
+
google: string;
|
|
5
|
+
outlook: string;
|
|
6
|
+
office365: string;
|
|
7
|
+
ics: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CalendarEventInput {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
start: string;
|
|
15
|
+
end: string;
|
|
16
|
+
allDay: boolean;
|
|
17
|
+
timezone?: string;
|
|
18
|
+
location?: string;
|
|
19
|
+
locationType?: "physical" | "virtual" | "hybrid";
|
|
20
|
+
virtualUrl?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Builds standard 1-click web calendar links for Google Calendar, Outlook Web,
|
|
26
|
+
* Office 365, and Apple/desktop iCal (.ics) download.
|
|
27
|
+
* Pass the installed plugin ID: Registry installs are addressed as `r_…`, not `eventual`.
|
|
28
|
+
* The `.ics` link downloads this event (all upcoming dates of a repeating one) from the `calendar` route.
|
|
29
|
+
*/
|
|
30
|
+
export function buildCalendarLinks(event: CalendarEventInput, siteUrl = "", pluginId = "eventual"): CalendarLinks {
|
|
31
|
+
const title = event.title || "Event";
|
|
32
|
+
const onlineUrl = safeHttpUrl(event.virtualUrl ?? "");
|
|
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");
|
|
35
|
+
|
|
36
|
+
let loc = event.location || "";
|
|
37
|
+
if (event.locationType === "virtual") {
|
|
38
|
+
loc = onlineUrl || loc;
|
|
39
|
+
} else if (event.locationType === "hybrid" && onlineUrl && loc) {
|
|
40
|
+
loc = `${loc} · ${onlineUrl}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let googleDates: string;
|
|
44
|
+
let outlookStart: string;
|
|
45
|
+
let outlookEnd: string;
|
|
46
|
+
let isAllDayParam = "";
|
|
47
|
+
|
|
48
|
+
if (event.allDay) {
|
|
49
|
+
const startDate = event.start.slice(0, 10).replace(/-/g, "");
|
|
50
|
+
// In iCalendar/Google, the end date for all-day is exclusive (next day)
|
|
51
|
+
const endObj = new Date(event.end.slice(0, 10) + "T00:00:00Z");
|
|
52
|
+
endObj.setUTCDate(endObj.getUTCDate() + 1);
|
|
53
|
+
const endDate = endObj.toISOString().slice(0, 10).replace(/-/g, "");
|
|
54
|
+
googleDates = `${startDate}/${endDate}`;
|
|
55
|
+
outlookStart = event.start.slice(0, 10);
|
|
56
|
+
outlookEnd = endObj.toISOString().slice(0, 10);
|
|
57
|
+
isAllDayParam = "&allday=true";
|
|
58
|
+
} else {
|
|
59
|
+
const startUtc = new Date(event.start).toISOString();
|
|
60
|
+
const endUtc = new Date(event.end).toISOString();
|
|
61
|
+
const startCompact = startUtc.replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
|
62
|
+
const endCompact = endUtc.replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
|
63
|
+
googleDates = `${startCompact}/${endCompact}`;
|
|
64
|
+
outlookStart = startUtc;
|
|
65
|
+
outlookEnd = endUtc;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const enc = encodeURIComponent;
|
|
69
|
+
const google = `https://calendar.google.com/calendar/render?action=TEMPLATE&text=${enc(title)}&dates=${googleDates}&details=${enc(details)}&location=${enc(loc)}`;
|
|
70
|
+
const q = `path=/calendar/action/compose&rru=addevent&subject=${enc(title)}&body=${enc(details)}&location=${enc(loc)}&startdt=${enc(outlookStart)}&enddt=${enc(outlookEnd)}${isAllDayParam}`;
|
|
71
|
+
const outlook = `https://outlook.live.com/calendar/0/deeplink/compose?${q}`;
|
|
72
|
+
const office365 = `https://outlook.office.com/calendar/0/deeplink/compose?${q}`;
|
|
73
|
+
|
|
74
|
+
const eventBaseId = event.id.split("#")[0]!;
|
|
75
|
+
const icsPath = `/_emdash/api/plugins/${enc(pluginId)}/calendar?eventId=${enc(eventBaseId)}`;
|
|
76
|
+
const ics = siteUrl ? new URL(icsPath, siteUrl).href : icsPath;
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
google,
|
|
80
|
+
outlook,
|
|
81
|
+
office365,
|
|
82
|
+
ics,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -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
|
-
/**
|
|
15
|
-
|
|
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 >=
|
|
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 >
|
|
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 ?
|
|
60
|
+
return budget ? budget.limit - budget.used - budget.reserved : 10;
|
|
56
61
|
}
|