Publish eventLabs 0.5.0

This commit is contained in:
josh
2026-11-11 21:30:20 -05:00
parent 31a327d16f
commit 258aee939c
41 changed files with 6737 additions and 0 deletions

101
docs/API.md Normal file
View File

@@ -0,0 +1,101 @@
# eventLabs REST API
The authenticated API namespace is `eventlabs/v1`. On a site with REST rewrites, prefix routes below with `https://events.example.com/wp-json/eventlabs/v1`. With plain permalinks, send the full route in the `rest_route` query parameter.
```sh
curl --get --user "$EVENTLABS_USER:$EVENTLABS_APP_PASSWORD" \
--data-urlencode "rest_route=/eventlabs/v1/schema" "$WORDPRESS_URL/"
```
Use HTTP Basic authentication with a WordPress username and Application Password over HTTPS. Administrators and users with the **eventLabs Integration** role can use these routes. The integration credential grants eventLabs access for the WordPress site. A workspace ID identifies a record's owner in burnWorks. Apply workspace authorization in the calling service.
## Routes
| Method | Route | Behavior |
| --- | --- | --- |
| GET | `/schema` | JSON schemas for native writes, the burnWorks event and club payloads, and configured custom event fields. |
| GET | `/{resource}` | List events, venues, organizers, or series. |
| POST | `/{resource}` | Create a native record. |
| GET, PATCH | `/{resource}/{id}` | Read or update one WordPress record. |
| GET, PUT | `/{resource}/external/{source}/{external_id}` | Read or upsert a record by a stable integration ID. |
| GET | `/events/{id}/occurrences` | List indexed occurrences with UTC start and end times. |
| GET | `/categories`, `/tags` | Look up WordPress term IDs. |
| GET | `/burnworks/workspaces/{workspace_id}/clubs` | List named clubs and sub-clubs for a workspace. |
| PUT | `/burnworks/workspaces/{workspace_id}/clubs/{club_id}` | Register a club or update its display name, kind, and status. |
| GET, PUT | `/burnworks/workspaces/{workspace_id}/events/{event_id}` | Read or publish the WordPress copy of a burnWorks event. |
`{resource}` is `events`, `venues`, `organizers`, or `series`. All write requests use `Content-Type: application/json`. Native resource, occurrence, and term lists return `items` and a continuation field. Follow `next_after_id` with `after_id`, `next_after_start` with `after_start`, or `next_page` with `page`. A null continuation marks the end. The default limit is 50 and the maximum is 100. Resource lists accept the inclusive UTC `modified_since` timestamp.
## Create or update an event
```sh
curl --user "$EVENTLABS_USER:$EVENTLABS_APP_PASSWORD" \
--request POST --header 'Content-Type: application/json' \
--data '{
"title": "Garden workshop",
"description": "<p>Bring gardening gloves.</p>",
"post_status": "draft",
"schedule": {
"start_date": "2026-12-05",
"start_time": "10:00",
"end_date": "2026-12-05",
"end_time": "12:00",
"timezone": "America/New_York",
"all_day": false,
"repeat": "none"
},
"cost": "Free",
"metadata": {"source": "club-website"}
}' "$WORDPRESS_URL/wp-json/eventlabs/v1/events"
```
- Dates use `YYYY-MM-DD`. Timed schedules accept `HH:MM` or `HH:MM:SS`, with an IANA time zone or UTC. All-day start and end dates are inclusive.
- Repeat modes are `none`, `daily`, `weekly`, `monthly`, and `yearly`. Use `interval`, `weekdays` (Monday = 1), `monthly` (`day` or `weekday`), `count`, `until`, `include`, and `exclude` for the rule. The calendar indexes recurring dates through a rolling two-year future window.
- `venue`, `organizer`, `series`, `categories`, and `tags` are arrays of WordPress IDs. An empty array clears a relationship. `featured_media` is a WordPress image attachment ID or `0` to clear it.
- `post_status` controls WordPress visibility. Writable values are `draft`, `pending`, `private`, and `publish`. The separate event `status` accepts `scheduled`, `postponed`, `cancelled`, and `moved_online`. The `hidden` flag removes an event from calendar listings.
- `fields` carries configured eventLabs custom fields. `metadata` carries a JSON object for integration data. The response includes `id`, `post_status`, `url_public`, `revision`, and the saved schedule and relationships.
- Venue and organizer `latitude` and `longitude` come from the saved address. Set `lookup_address: true` to retry geocoding. The response reports the result in `geocode`.
## Stable IDs and retries
`PUT /{resource}/external/{source}/{external_id}` creates a record on the first successful request and returns `201`. Later writes to the same identity return `200` with the same WordPress ID. Use lowercase letters, numbers, hyphens, or underscores for `source`. The external ID accepts letters, numbers, dots, underscores, colons, and hyphens. Source names `burnworks` and `calendar-migration` are reserved for their own workflows.
An item response has an `ETag`. Send that value as `If-Match` to make a write conditional on the current revision. Re-read the record after `412`. Use `If-None-Match: *` on an external PUT to create a record only when the identity is new.
| HTTP status | Meaning |
| --- | --- |
| 400 | Invalid JSON, request fields, or source identity. |
| 401 / 403 | The request lacks an authorized eventLabs account. |
| 404 | The requested record is unavailable. |
| 409 | A burnWorks source version is older or repeats a version with different data. |
| 410 | The record mapped to this external ID was permanently deleted. |
| 412 | The revision or create-only condition failed. |
| 422 | The event schedule or a linked record is invalid. |
| 503 | Another write holds the record lock. Retry the request. |
Errors use the WordPress REST shape `{"code":"…","message":"…","data":{"status":400}}`. Successful native write responses carry an ETag and use private, no-store caching.
## Club and sub-club scope
Register a club before publishing its events. Use the exact UUIDs from burnWorks. For example, send this body to `PUT /burnworks/workspaces/{workspace_id}/clubs/{club_id}`:
```json
{
"name": "Young Gardeners",
"kind": "subclub",
"status": "active",
"workspace_name": "Field Club"
}
```
`kind` accepts `organization` and `subclub`. `status` accepts `active` and `archived` and defaults to `active`. `workspace_name` is optional and labels that workspace in the Elementor picker. The club listing returns the saved name, kind, status, and `scope`.
Event responses include `sub_club`, the hidden assignment in `workspace_id:club_id` form, and `club`, the directory record including its kind. New local events have a blank assignment. Set or clear it on a native event with PATCH. The burnWorks event route sets it from `club_id` for synced events. Events sent before a directory update are grouped by their IDs and receive a provisional label until the club is named.
Elementor **Event Calendar** and **Event List** offer a **Club or sub-club** selector. A workspace choice includes its clubs. A club choice matches that exact workspace and club. For shortcodes, pass `scope="<workspace_uuid>"` or `scope="<workspace_uuid>:<club_uuid>"` to `[burn_events]`.
See the [burnWorks integration handoff](BURNWORKS-INTEGRATION.md) for the complete event payload and the publication gate.
## Public feed
`GET /wp-json/burn-events/v1/events` returns upcoming public occurrences with an event ID, title, public URL, and UTC start and end times. It accepts `limit` (1–50), `page`, `search`, and `category` (slug).

View File

@@ -0,0 +1,113 @@
# eventLabs API handoff for burnWorks
Connect the burnWorks Clubs workspace to eventLabs on WordPress. The burnWorks Worker owns the club's event data, authorization, and publishing rules. Use the persisted `club_events` row after the write in `worker/clubs.ts` so the request includes the generated ID and source timestamps.
## Connection
- In WordPress, create a dedicated user with the **eventLabs Integration** role. Generate a WordPress Application Password from that user's profile. The role grants access to the eventLabs API on that WordPress site.
- Store the WordPress URL, username, and Application Password in server-side connection settings or Worker secrets. Use HTTP Basic authentication with the username and Application Password. A deployed Worker needs a reachable HTTPS WordPress URL.
- API namespace is `eventlabs/v1`. Use `/wp-json/eventlabs/v1/…` on a site with REST rewrites, or set the `rest_route` query parameter to the full route. The query form also works with plain permalinks.
## Sync the club directory
After connecting a WordPress site, send the workspace's `clubs` records to `PUT /eventlabs/v1/burnworks/workspaces/{workspace_id}/clubs/{club_id}`. Use the UUIDs already stored by burnWorks. Repeat the PUT when a club's name, kind, or status changes.
```json
{
"name": "Young Gardeners",
"kind": "subclub",
"status": "active",
"workspace_name": "Field Club"
}
```
Use `clubs.kind` as `organization` or `subclub`, `clubs.status` as `active` or `archived`, and the workspace's display name as `workspace_name`. Read the directory with `GET /eventlabs/v1/burnworks/workspaces/{workspace_id}/clubs`. eventLabs stores the event's workspace and club IDs together in its hidden `sub_club` assignment. This keeps identical club IDs in different workspaces separate. The Elementor calendar and list can select a whole workspace or one club. Existing event sync requests still establish the association. The directory PUT gives that association its display name and kind.
## Publish a Clubs event
Send `PUT /eventlabs/v1/burnworks/workspaces/{workspace_id}/events/{event_id}` with a JSON object. Use the existing UUIDs from `club_events`. The same workspace and event IDs always resolve to the same WordPress record.
| burnWorks field | eventLabs mapping |
| --- | --- |
| `workspace_id`, `id` | External identity. Optional in the body when supplied in the route. |
| `club_id` | Club or sub-club association in the source record and the hidden event scope. |
| `title`, `description` | Source values plus a sanitized public title and description. |
| `starts_at` | Exact ISO 8601 value in the source record. The WordPress schedule uses UTC with second precision. |
| `venue` | Source venue name and the WordPress location field. |
| `status` | `draft`, `published`, or `cancelled`. A cancelled source event is withdrawn from the public calendar. |
| `audience` | `public`, `members`, or `private`. WordPress publishes the public audience only. |
| `capacity`, `kind` | Exact source values. Enforce membership, capacity, and waitlists in burnWorks. |
| `created_by`, `created_at` | Optional original creator and timestamp. Returned in the authenticated source record. |
| `ends_at` | Optional ISO 8601 end. The WordPress copy uses a one-hour duration when omitted. |
| `website_enabled`, `public_events_enabled` | Pass `club_sites.enabled` and the effective public events switch as JSON booleans. A missing switch counts as disabled. |
| `publish_to_wordpress` | Optional result of a burnWorks-specific rule. Send `false` to withdraw the WordPress copy. |
| `source_version` | Optional increasing integer from a durable per-event sequence. When supplied, later writes must carry a higher version or repeat the same version and payload. |
| `custom` | Optional JSON object for additional CRM fields. The API preserves nested JSON types and returns the object with the source record. |
WordPress publishes when the event is `published`, its audience is `public`, both website switches are `true`, and `publish_to_wordpress` is `true` or omitted. Other events are saved as drafts. Apply the same club and workspace authorization checks burnWorks uses for its existing event operations.
```ts
const route = `/eventlabs/v1/burnworks/workspaces/${event.workspace_id}/events/${event.id}`
const endpoint = new URL(connection.wordpressUrl)
endpoint.searchParams.set('rest_route', route)
const response = await fetch(endpoint, {
method: 'PUT',
redirect: 'error',
headers: {
Authorization: `Basic ${btoa(`${connection.username}:${connection.applicationPassword}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
workspace_id: event.workspace_id,
id: event.id,
club_id: event.club_id,
title: event.title,
description: event.description,
starts_at: event.starts_at,
venue: event.venue,
status: event.status,
audience: event.audience,
capacity: event.capacity,
kind: event.kind,
created_by: event.created_by,
created_at: event.created_at,
website_enabled: Boolean(site?.enabled),
public_events_enabled: Boolean(site) && site?.public_events_enabled !== false && site?.public_events_enabled !== 0,
publish_to_wordpress: approvedForWebsite,
}),
})
if (!response.ok) {
const error = await response.json()
throw new Error(`eventLabs ${response.status}: ${error.code ?? 'request_failed'}`)
}
const saved = await response.json()
```
Here `event` is the saved Clubs event, `site` is its workspace's `club_sites` row if one exists, and `approvedForWebsite` is the boolean result of any additional CRM rules. Use `true` when the workspace has no additional rule. The public events switch follows the default used in `worker/club-platform.ts`.
## Sync behavior
- A successful PUT returns `201` on create and `200` on update. Save the returned WordPress `id`, `url_public`, and `revision` if the CRM needs them. The `burnworks` object is the last accepted source record. The other fields describe the current WordPress copy.
- Use GET on the same route to check the current state. Serialize writes per event and read the latest Clubs record when retrying. Use `source_version` for an outbox that can deliver writes out of order. Increment it for each distinct update, including changes to publishing rules, and resend the same payload on retry. A stale source version returns `409`. Use the returned `ETag` as `If-Match` when an update should fail if the WordPress copy changed since the last read. Re-read on `412`. A `503` indicates a busy record and can be retried. A `410` means the mapped WordPress record was permanently deleted.
- Re-send affected events when their audience, status, or publishing rules change, including site-level switches. Before deleting a source event, send a final PUT with `publish_to_wordpress: false` or retain a durable record of the withdrawal to retry it. Re-sending the same event after a withdrawal can publish it again.
- The WordPress credential is scoped to a site. The workspace UUID is an identity key. Enforce burnWorks workspace permissions in the Worker and keep connection credentials out of the browser.
## Direct eventLabs resources
Authenticated resource collections are `/events`, `/venues`, `/organizers`, and `/series` under `/eventlabs/v1`.
| Method and route | Purpose |
| --- | --- |
| `GET /schema` | Discover write fields, recurrence shape, CRM schema, and configured custom event fields. |
| `GET /{resource}` | List records. Follow `next_after_id` with `after_id`. Use `modified_since` for an inclusive time filter. |
| `POST /{resource}` | Create a native WordPress record. |
| `GET /{resource}/{id}` | Read the record with its ETag. |
| `PATCH /{resource}/{id}` | Change supplied fields. Use `If-Match` for conflict detection. |
| `GET, PUT /{resource}/external/{source}/{external_id}` | Read or upsert a stable record for another integration source. |
| `GET /events/{id}/occurrences` | Read indexed UTC occurrences. Follow `next_after_start` with `after_start`. |
| `GET /categories`, `GET /tags` | Resolve WordPress term IDs for the event's category and tag fields. |
Native event links use arrays of WordPress venue, organizer, and series IDs. The `fields` object follows the WordPress custom-field configuration. Venue and organizer coordinates are read-only API fields derived from the address. A changed address triggers a lookup when a Maps key is configured. Send `lookup_address: true` to retry it. A missing or ambiguous result has null coordinates and a status in `geocode`.
See the [API reference](API.md) for authentication examples, errors, and native payloads.

27
docs/PARITY-AUDIT.md Normal file
View File

@@ -0,0 +1,27 @@
# eventLabs feature and settings audit
This audit compares the supplied Pro and Community packages and a Core reference package with the eventLabs 0.5.0 source mounted in the local test site. It covers event workflows and settings, with the comparison scoped to those versions.
| Package | Version | SHA-256 prefix |
| --- | --- | --- |
| The Events Calendar Core reference | 6.18.3.1 | `cc3a7b2973f264f65` |
| Events Calendar Pro supplied ZIP | 7.8.5 | `8b63ce4fe1039b8f4` |
| Community supplied ZIP | 5.1.1.1 | `1ad11481c452601c8` |
| eventLabs mounted plugin source snapshot | 0.5.0 | `5198af7a5005ad9f` |
Local REA 6.7.0 inventoried each archive with `inspect-artifact`. The three `compare` runs returned an unknown status because their evidence bundles lack an inventory completeness marker. The findings below come from reading the feature handlers, settings forms, and templates in those packages and tracing the corresponding eventLabs entry points. The comparison does not establish runtime parity for integrations that require accounts or other plugins.
| Area | Available in eventLabs | Missing or partial coverage | Reference in the original packages |
| --- | --- | --- | --- |
| Calendar views | List, Month, Week, Day, Photo, Map, and Summary. Month and Week support multi-day bars, event previews, and an accent color per category. | Week has day columns with stacked tiles. Pro also has an hour-based schedule. Core has per-day overflow limits and separate primary, background, and text colors for categories. | Core `src/views/v2/month/calendar-body/day/` and `src/admin-views/category-colors/`. Pro `src/views/v2/week/grid-body/`. |
| Recurrence and series | Daily, weekly, monthly, and yearly rules with intervals, end conditions, included and excluded dates, linked series, and occurrence URLs. | One repeat rule per event. Editing or breaking out one occurrence, editing this and future occurrences, multiple rules on an event, and collapsing repeat instances in listings are gaps. | Pro `src/Tribe/Recurrence/Series_Splitter.php`, `Meta.php`, and `src/Tribe/Views/V2/Views/Partials/Hide_Recurring_Events_Toggle.php`. |
| Calendar settings | Default view, events per page, default event time zone, maps switch, map key, and WordPress date and time formats. | Separate settings for enabled views, archive and event slugs, month events per day, after-midnight cutoff, date/time separators, currency symbol and code, site-wide comments, map zoom, and archive template or stylesheet selection. | Core `src/admin-views/settings/tabs/display/` and `general/general-viewing.php`. |
| Venue defaults and additional fields | Default venue and organizer selection, address geocoding, public venue and organizer pages, and text, URL, checkbox, and select fields. | Default address, phone, and country list settings for new venues. Additional field coverage lacks radio and multi-value choices. | Pro `src/admin-views/settings/tabs/defaults/` and `src/Tribe/Editor/Additional_Fields.php`. |
| Editors and embeds | Elementor widgets and the Single Event template builder, event and community shortcodes, and WordPress post editing. | Native Gutenberg calendar and event blocks, the Pro mini-calendar and featured venue embeds, and the Pro Event Manager workflows. | Core `src/Events/Blocks/`. Pro `src/Tribe/Views/V2/Widgets/`, `src/Tribe/Views/V2/Shortcodes/`, and `src/Tribe/Admin/Manager/`. |
| Community submissions | Guest submission switch, signed-in ownership checks, My Events, withdrawal to Trash, and Pending Review for submissions and edits. | Configurable submission status, terms acceptance, email alert recipients, separate edit and removal controls, contributor role restrictions and redirects, front-end venue and organizer management, and per-route slugs. | Community `src/admin-views/settings/tabs/` and `src/views/community/`. |
| Imports | Manual CSV and local iCalendar imports, duplicate detection by source ID, CSV export, and iCalendar export. | Scheduled remote sources, import history and status, and updating records from repeated imports. iCalendar support covers a subset of recurrence rules. | Core `src/admin-views/aggregator/tabs/` and `origins/`. |
| Virtual events | Event website URL and Moved Online status. | Virtual and hybrid event settings, join-link visibility rules, meeting account integrations, and video embeds tied to event type. | Pro `src/Tribe/Virtual/` and `src/admin-views/virtual-metabox/`. |
| Tickets and payouts | Event cost display. | Ticket inventory and checkout, attendee and sales reporting, fee settings, and organizer payouts. The Community package includes integrations with commerce and ticketing providers for these flows. | Community `src/Tribe/Tickets/` and `src/Community_Tickets/Tickets/Commerce/`. |
| Maintenance and data migration | Occurrence index maintenance, local file import, and a same-site migration that copies event drafts, linked records, categories, and saved occurrence dates. | Admin settings for retiring old events and consolidating duplicate venues or organizers. Repeat rule generation and site settings require separate setup after migration. | Core `src/admin-views/settings/tabs/general/general-maintenance.php`. Pro `src/Events_Pro/Custom_Tables/V1/Series/`. |
The independent eventLabs REST API and burnWorks publishing contract are documented in the [burnWorks integration handoff](BURNWORKS-INTEGRATION.md).

BIN
docs/images/calendar.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB