@happyvertical/smrt-events 0.53.3 → 0.53.5

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/dist/index.js CHANGED
@@ -1,8 +1,11 @@
1
1
  import { a as formatEventDateRange, c as isEventNow, d as validateEventStatus, f as expandRecurrence, h as toZonedWallTime, i as formatDuration, l as parseRecurrencePattern, m as isValidTimeZone, n as calculateNextOccurrence, o as generateEventSlug, p as fromZonedWallTime, r as checkSchedulingConflict, s as getEventStatusFromDates, t as calculateDuration, u as sortEventsByDate } from "./chunks/utils-DV00CoDY.js";
2
2
  import { EVENTS_MODULE_META, EVENTS_UI_SLOTS } from "./ui.js";
3
3
  import { ObjectRegistry, SmrtCollection, SmrtHierarchical, SmrtJunction, SmrtObject, crossPackageRef, field, foreignKey, smrt } from "@happyvertical/smrt-core";
4
+ import { ICAL, parseICalendar } from "@happyvertical/icalendar";
5
+ import { createHash } from "node:crypto";
6
+ import { TenantScoped, getTenantId, queryGlobal, queryWithGlobals, tenantId } from "@happyvertical/smrt-tenancy";
7
+ import { getDatabase } from "@happyvertical/sql";
4
8
  import { addOwnedAssetFromCollection, assertValidOwnedAssetRelationship, assertValidOwnedAssetSortOrder, getOwnedAssetsFromCollection, removeOwnedAssetFromCollection, resolveOwnedAssetsById } from "@happyvertical/smrt-assets";
5
- import { TenantScoped, queryGlobal, queryWithGlobals, tenantId } from "@happyvertical/smrt-tenancy";
6
9
  //#region \0rolldown/runtime.js
7
10
  var __defProp$7 = Object.defineProperty;
8
11
  var __exportAll = (all, no_symbols) => {
@@ -16,101 +19,263 @@ var __exportAll = (all, no_symbols) => {
16
19
  };
17
20
  //#endregion
18
21
  //#region src/__smrt-register__.ts
19
- ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-events\",\"packageVersion\":\"0.53.3\",\"objects\":{\"@happyvertical/smrt-events:EventAssetCollection\":{\"name\":\"eventassetcollection\",\"className\":\"EventAssetCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventAssetCollection\",\"collection\":\"eventassets\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventAssetCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"byLeft\":{\"name\":\"byLeft\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"byRight\":{\"name\":\"byRight\",\"async\":true,\"parameters\":[{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"attach\":{\"name\":\"attach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem>\",\"isStatic\":false,\"isPublic\":true},\"detach\":{\"name\":\"detach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"setLinks\":{\"name\":\"setLinks\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightIds\",\"type\":\"string[]\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getAssets\":{\"name\":\"getAssets\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<Asset[]>\",\"isStatic\":false,\"isPublic\":true},\"addAsset\":{\"name\":\"addAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"asset\",\"type\":\"Asset\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"any\",\"optional\":true,\"default\":\"attachment\"},{\"name\":\"sortOrder\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"removeAsset\":{\"name\":\"removeAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"assetId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"api\":false,\"mcp\":false,\"cli\":false,\"tableName\":\"event_assets\"},\"extends\":\"SmrtJunction\",\"extendsTypeArg\":\"EventAsset\",\"exportName\":\"EventAssetCollection\",\"collectionExportName\":\"EventAssetCollectionCollection\",\"schema\":{\"tableName\":\"event_assets\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_assets\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID NOT NULL,\\n \\\"asset_id\\\" UUID NOT NULL,\\n \\\"relationship\\\" TEXT NOT NULL,\\n \\\"sort_order\\\" INTEGER NOT NULL DEFAULT 0\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"asset_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"relationship\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":true,\"unique\":false,\"default\":0}},\"indexes\":[{\"name\":\"event_assets_event_id_asset_id_idx\",\"columns\":[\"event_id\",\"asset_id\",\"relationship\"],\"unique\":true},{\"name\":\"event_assets_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_assets_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_assets_asset_id_idx\",\"columns\":[\"asset_id\"]}],\"version\":\"aeebedc6\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventCollection\":{\"name\":\"eventcollection\",\"className\":\"EventCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventCollection\",\"collection\":\"events\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"getBySeriesId\":{\"name\":\"getBySeriesId\",\"async\":true,\"parameters\":[{\"name\":\"seriesId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByPlace\":{\"name\":\"getByPlace\",\"async\":true,\"parameters\":[{\"name\":\"placeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByDateRange\":{\"name\":\"getByDateRange\",\"async\":true,\"parameters\":[{\"name\":\"startDate\",\"type\":\"Date\",\"optional\":false},{\"name\":\"endDate\",\"type\":\"Date\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getUpcoming\":{\"name\":\"getUpcoming\",\"async\":true,\"parameters\":[{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByStatus\":{\"name\":\"getByStatus\",\"async\":true,\"parameters\":[{\"name\":\"status\",\"type\":\"EventStatus\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByType\":{\"name\":\"getByType\",\"async\":true,\"parameters\":[{\"name\":\"typeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getRootEvents\":{\"name\":\"getRootEvents\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByParent\":{\"name\":\"getByParent\",\"async\":true,\"parameters\":[{\"name\":\"parentId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getEventTree\":{\"name\":\"getEventTree\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event | null>\",\"isStatic\":false,\"isPublic\":true},\"getAssets\":{\"name\":\"getAssets\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<Asset[]>\",\"isStatic\":false,\"isPublic\":true},\"addAsset\":{\"name\":\"addAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"asset\",\"type\":\"Asset\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"any\",\"optional\":true,\"default\":\"attachment\"},{\"name\":\"sortOrder\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"removeAsset\":{\"name\":\"removeAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"assetId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"query\",\"type\":\"string\",\"optional\":false},{\"name\":\"filters\",\"type\":\"EventSearchFilters\",\"optional\":true}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getInProgress\":{\"name\":\"getInProgress\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Event\",\"exportName\":\"EventCollection\",\"collectionExportName\":\"EventCollectionCollection\",\"schema\":{\"tableName\":\"events\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"events\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"parent_id\\\" UUID,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"series_id\\\" UUID,\\n \\\"type_id\\\" UUID,\\n \\\"place_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"all_day\\\" BOOLEAN DEFAULT FALSE,\\n \\\"time_zone\\\" TEXT,\\n \\\"status\\\" TEXT DEFAULT 'scheduled',\\n \\\"round\\\" INTEGER,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"parent_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"series_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_series\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"place_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"all_day\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"default\":false},\"time_zone\":{\"type\":\"TEXT\",\"notNull\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"scheduled\"},\"round\":{\"type\":\"INTEGER\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"events_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"events_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"events_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"events_parent_id_idx\",\"columns\":[\"parent_id\"]},{\"name\":\"events_series_id_idx\",\"columns\":[\"series_id\"]},{\"name\":\"events_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"events_place_id_idx\",\"columns\":[\"place_id\"]}],\"version\":\"8e689646\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventParticipantCollection\":{\"name\":\"eventparticipantcollection\",\"className\":\"EventParticipantCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventParticipantCollection\",\"collection\":\"eventparticipants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventParticipantCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"byLeft\":{\"name\":\"byLeft\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"byRight\":{\"name\":\"byRight\",\"async\":true,\"parameters\":[{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"attach\":{\"name\":\"attach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem>\",\"isStatic\":false,\"isPublic\":true},\"detach\":{\"name\":\"detach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"setLinks\":{\"name\":\"setLinks\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightIds\",\"type\":\"string[]\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getByPlacement\":{\"name\":\"getByPlacement\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getByGroup\":{\"name\":\"getByGroup\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"groupId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getHome\":{\"name\":\"getHome\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getAway\":{\"name\":\"getAway\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"filters\",\"type\":\"ParticipantSearchFilters\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getParticipantStats\":{\"name\":\"getParticipantStats\",\"async\":true,\"parameters\":[{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"eventTypeId\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<object>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtJunction\",\"extendsTypeArg\":\"EventParticipant\",\"exportName\":\"EventParticipantCollection\",\"collectionExportName\":\"EventParticipantCollectionCollection\",\"schema\":{\"tableName\":\"event_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID,\\n \\\"profile_id\\\" UUID,\\n \\\"role\\\" TEXT DEFAULT '',\\n \\\"placement\\\" INTEGER,\\n \\\"group_id\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"role\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"placement\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false},\"group_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"event_participants_event_id_profile_id_idx\",\"columns\":[\"event_id\",\"profile_id\",\"role\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_participants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_participants_profile_id_idx\",\"columns\":[\"profile_id\"]}],\"version\":\"c2faac84\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventSeriesCollection\":{\"name\":\"eventseriescollection\",\"className\":\"EventSeriesCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventSeriesCollection\",\"collection\":\"eventserieses\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventSeriesCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"getByOrganizer\":{\"name\":\"getByOrganizer\",\"async\":true,\"parameters\":[{\"name\":\"organizerId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"getActive\":{\"name\":\"getActive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"getUpcoming\":{\"name\":\"getUpcoming\",\"async\":true,\"parameters\":[{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"getByType\":{\"name\":\"getByType\",\"async\":true,\"parameters\":[{\"name\":\"typeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"query\",\"type\":\"string\",\"optional\":false},{\"name\":\"filters\",\"type\":\"EventSeriesSearchFilters\",\"optional\":true}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"EventSeries\",\"exportName\":\"EventSeriesCollection\",\"collectionExportName\":\"EventSeriesCollectionCollection\",\"schema\":{\"tableName\":\"event_series\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_series\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"type_id\\\" UUID,\\n \\\"organizer_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"recurrence\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"organizer_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"recurrence\":{\"type\":\"TEXT\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"event_series_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_series_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_series_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_series_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"event_series_organizer_id_idx\",\"columns\":[\"organizer_id\"]}],\"version\":\"c79f5863\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventTypeCollection\":{\"name\":\"eventtypecollection\",\"className\":\"EventTypeCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventTypeCollection\",\"collection\":\"eventtypes\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventTypeCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"getOrCreate\":{\"name\":\"getOrCreate\",\"async\":true,\"parameters\":[{\"name\":\"slug\",\"type\":\"string\",\"optional\":false},{\"name\":\"name\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<EventType>\",\"isStatic\":false,\"isPublic\":true},\"getBySlug\":{\"name\":\"getBySlug\",\"async\":true,\"parameters\":[{\"name\":\"slug\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType | null>\",\"isStatic\":false,\"isPublic\":true},\"initializeDefaults\":{\"name\":\"initializeDefaults\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"EventType\",\"exportName\":\"EventTypeCollection\",\"collectionExportName\":\"EventTypeCollectionCollection\",\"schema\":{\"tableName\":\"event_types\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_types\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"schema\\\" TEXT DEFAULT '',\\n \\\"participant_schema\\\" TEXT DEFAULT ''\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"participant_schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"event_types_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_types_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_types_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"922ae3b0\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:Event\":{\"name\":\"event\",\"className\":\"Event\",\"qualifiedName\":\"@happyvertical/smrt-events:Event\",\"collection\":\"events\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/Event.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"created_at\":{\"type\":\"datetime\",\"required\":false},\"updated_at\":{\"type\":\"datetime\",\"required\":false},\"parentId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Event\",\"_meta\":{\"nullable\":true,\"constraint\":{\"engines\":[\"postgres\",\"sqlite\"]}}},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"seriesId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"EventSeries\",\"_meta\":{\"constraint\":{\"engines\":[\"postgres\",\"sqlite\"]}}},\"typeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"EventType\",\"_meta\":{\"constraint\":{\"engines\":[\"postgres\",\"sqlite\"]}}},\"placeId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-places:Place\"},\"description\":{\"type\":\"text\",\"required\":false},\"startDate\":{\"type\":\"datetime\",\"required\":false},\"endDate\":{\"type\":\"datetime\",\"required\":false},\"allDay\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"timeZone\":{\"type\":\"text\",\"required\":false},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"scheduled\"},\"round\":{\"type\":\"integer\",\"required\":false},\"metadata\":{\"type\":\"text\",\"required\":false},\"externalId\":{\"type\":\"text\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false},\"createdAt\":{\"type\":\"text\",\"required\":false},\"updatedAt\":{\"type\":\"text\",\"required\":false}},\"methods\":{\"getParent\":{\"name\":\"getParent\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this | null>\",\"isStatic\":false,\"isPublic\":true},\"getChildren\":{\"name\":\"getChildren\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getAncestors\":{\"name\":\"getAncestors\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getDescendants\":{\"name\":\"getDescendants\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getHierarchy\":{\"name\":\"getHierarchy\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<HierarchyView<this>>\",\"isStatic\":false,\"isPublic\":true},\"moveTo\":{\"name\":\"moveTo\",\"async\":true,\"parameters\":[{\"name\":\"newParent\",\"type\":\"this | string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"this\"},{\"type\":\"string\"},{\"type\":\"null\"}]}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateStatus\":{\"name\":\"updateStatus\",\"async\":true,\"parameters\":[{\"name\":\"newStatus\",\"type\":\"EventStatus\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getSeries\":{\"name\":\"getSeries\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getType\":{\"name\":\"getType\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getPlace\":{\"name\":\"getPlace\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getRootEvent\":{\"name\":\"getRootEvent\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event>\",\"isStatic\":false,\"isPublic\":true},\"getParticipants\":{\"name\":\"getParticipants\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getAssets\":{\"name\":\"getAssets\",\"async\":true,\"parameters\":[{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<Asset[]>\",\"isStatic\":false,\"isPublic\":true},\"addAsset\":{\"name\":\"addAsset\",\"async\":true,\"parameters\":[{\"name\":\"asset\",\"type\":\"Asset\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"any\",\"optional\":true,\"default\":\"attachment\"},{\"name\":\"sortOrder\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"removeAsset\":{\"name\":\"removeAsset\",\"async\":true,\"parameters\":[{\"name\":\"assetId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"isInProgress\":{\"name\":\"isInProgress\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isRoot\":{\"name\":\"isRoot\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableStrategy\":\"sti\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"]},\"extends\":\"SmrtHierarchical\",\"exportName\":\"Event\",\"collectionExportName\":\"EventCollection\",\"schema\":{\"tableName\":\"events\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"events\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"parent_id\\\" UUID,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"series_id\\\" UUID,\\n \\\"type_id\\\" UUID,\\n \\\"place_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"all_day\\\" BOOLEAN DEFAULT FALSE,\\n \\\"time_zone\\\" TEXT,\\n \\\"status\\\" TEXT DEFAULT 'scheduled',\\n \\\"round\\\" INTEGER,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"parent_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"series_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_series\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"place_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"all_day\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"default\":false},\"time_zone\":{\"type\":\"TEXT\",\"notNull\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"scheduled\"},\"round\":{\"type\":\"INTEGER\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"events_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"events_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"events_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"events_parent_id_idx\",\"columns\":[\"parent_id\"]},{\"name\":\"events_series_id_idx\",\"columns\":[\"series_id\"]},{\"name\":\"events_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"events_place_id_idx\",\"columns\":[\"place_id\"]}],\"version\":\"8e689646\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventAsset\":{\"name\":\"eventasset\",\"className\":\"EventAsset\",\"qualifiedName\":\"@happyvertical/smrt-events:EventAsset\",\"collection\":\"eventassets\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventAsset.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"eventId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"Event\",\"_meta\":{\"required\":true}},\"assetId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-assets:Asset\"},\"relationship\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"required\":true}},\"sortOrder\":{\"type\":\"integer\",\"required\":true,\"default\":0}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"event_assets\",\"conflictColumns\":[\"event_id\",\"asset_id\",\"relationship\"],\"api\":false,\"mcp\":false,\"cli\":false,\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"EventAsset\",\"collectionExportName\":\"EventAssetCollection\",\"validationRules\":[{\"field\":\"eventId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"assetId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"relationship\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"sortOrder\",\"rule\":\"required\",\"fieldType\":\"integer\"}],\"schema\":{\"tableName\":\"event_assets\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_assets\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID NOT NULL,\\n \\\"asset_id\\\" UUID NOT NULL,\\n \\\"relationship\\\" TEXT NOT NULL,\\n \\\"sort_order\\\" INTEGER NOT NULL DEFAULT 0\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"asset_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"relationship\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":true,\"unique\":false,\"default\":0}},\"indexes\":[{\"name\":\"event_assets_event_id_asset_id_idx\",\"columns\":[\"event_id\",\"asset_id\",\"relationship\"],\"unique\":true},{\"name\":\"event_assets_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_assets_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_assets_asset_id_idx\",\"columns\":[\"asset_id\"]}],\"version\":\"aeebedc6\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventParticipant\":{\"name\":\"eventparticipant\",\"className\":\"EventParticipant\",\"qualifiedName\":\"@happyvertical/smrt-events:EventParticipant\",\"collection\":\"eventparticipants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventParticipant.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"eventId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Event\"},\"profileId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"role\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"placement\":{\"type\":\"integer\",\"required\":false},\"groupId\":{\"type\":\"text\",\"required\":false},\"metadata\":{\"type\":\"text\",\"required\":false},\"externalId\":{\"type\":\"text\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false},\"createdAt\":{\"type\":\"text\",\"required\":false},\"updatedAt\":{\"type\":\"text\",\"required\":false}},\"methods\":{\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getEvent\":{\"name\":\"getEvent\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getProfile\":{\"name\":\"getProfile\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getGroupParticipants\":{\"name\":\"getGroupParticipants\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"isHome\":{\"name\":\"isHome\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isAway\":{\"name\":\"isAway\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"conflictColumns\":[\"event_id\",\"profile_id\",\"role\"],\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"EventParticipant\",\"collectionExportName\":\"EventParticipantCollection\",\"schema\":{\"tableName\":\"event_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID,\\n \\\"profile_id\\\" UUID,\\n \\\"role\\\" TEXT DEFAULT '',\\n \\\"placement\\\" INTEGER,\\n \\\"group_id\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"role\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"placement\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false},\"group_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"event_participants_event_id_profile_id_idx\",\"columns\":[\"event_id\",\"profile_id\",\"role\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_participants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_participants_profile_id_idx\",\"columns\":[\"profile_id\"]}],\"version\":\"c2faac84\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventSeries\":{\"name\":\"eventseries\",\"className\":\"EventSeries\",\"qualifiedName\":\"@happyvertical/smrt-events:EventSeries\",\"collection\":\"eventserieses\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventSeries.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"created_at\":{\"type\":\"datetime\",\"required\":false},\"updated_at\":{\"type\":\"datetime\",\"required\":false},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"typeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"EventType\"},\"organizerId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"description\":{\"type\":\"text\",\"required\":false},\"startDate\":{\"type\":\"datetime\",\"required\":false},\"endDate\":{\"type\":\"datetime\",\"required\":false},\"recurrence\":{\"type\":\"text\",\"required\":false},\"metadata\":{\"type\":\"text\",\"required\":false},\"externalId\":{\"type\":\"text\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false},\"createdAt\":{\"type\":\"text\",\"required\":false},\"updatedAt\":{\"type\":\"text\",\"required\":false}},\"methods\":{\"getRecurrence\":{\"name\":\"getRecurrence\",\"async\":false,\"parameters\":[],\"returnType\":\"RecurrencePattern | null\",\"isStatic\":false,\"isPublic\":true},\"setRecurrence\":{\"name\":\"setRecurrence\",\"async\":false,\"parameters\":[{\"name\":\"pattern\",\"type\":\"RecurrencePattern\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getOccurrences\":{\"name\":\"getOccurrences\",\"async\":false,\"parameters\":[{\"name\":\"rangeStart\",\"type\":\"Date\",\"optional\":false},{\"name\":\"rangeEnd\",\"type\":\"Date\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string\",\"Date\",\"number\"]}],\"returnType\":\"Date[]\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getType\":{\"name\":\"getType\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getOrganizer\":{\"name\":\"getOrganizer\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getEvents\":{\"name\":\"getEvents\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableStrategy\":\"sti\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"]},\"extends\":\"SmrtObject\",\"exportName\":\"EventSeries\",\"collectionExportName\":\"EventSeriesCollection\",\"schema\":{\"tableName\":\"event_series\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_series\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"type_id\\\" UUID,\\n \\\"organizer_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"recurrence\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"organizer_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"recurrence\":{\"type\":\"TEXT\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"event_series_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_series_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_series_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_series_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"event_series_organizer_id_idx\",\"columns\":[\"organizer_id\"]}],\"version\":\"c79f5863\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventType\":{\"name\":\"eventtype\",\"className\":\"EventType\",\"qualifiedName\":\"@happyvertical/smrt-events:EventType\",\"collection\":\"eventtypes\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventType.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"created_at\":{\"type\":\"datetime\",\"required\":false},\"updated_at\":{\"type\":\"datetime\",\"required\":false},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"schema\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"participantSchema\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"createdAt\":{\"type\":\"datetime\",\"required\":false},\"updatedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getSchema\":{\"name\":\"getSchema\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setSchema\":{\"name\":\"setSchema\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getParticipantSchema\":{\"name\":\"getParticipantSchema\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setParticipantSchema\":{\"name\":\"setParticipantSchema\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getBySlug\":{\"name\":\"getBySlug\",\"async\":true,\"parameters\":[{\"name\":\"_slug\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType | null>\",\"isStatic\":true,\"isPublic\":true}},\"decoratorConfig\":{\"tableStrategy\":\"sti\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"]},\"extends\":\"SmrtObject\",\"exportName\":\"EventType\",\"collectionExportName\":\"EventTypeCollection\",\"validationRules\":[{\"field\":\"name\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"event_types\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_types\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"schema\\\" TEXT DEFAULT '',\\n \\\"participant_schema\\\" TEXT DEFAULT ''\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"participant_schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"event_types_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_types_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_types_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"922ae3b0\"},\"importPath\":\"@happyvertical/smrt-events\"}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-assets\",\"@happyvertical/smrt-core\",\"@happyvertical/smrt-places\",\"@happyvertical/smrt-profiles\",\"@happyvertical/smrt-tenancy\"]}"));
22
+ ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-events\",\"packageVersion\":\"0.53.5\",\"objects\":{\"@happyvertical/smrt-events:EventAssetCollection\":{\"name\":\"eventassetcollection\",\"className\":\"EventAssetCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventAssetCollection\",\"collection\":\"eventassets\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventAssetCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"byLeft\":{\"name\":\"byLeft\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"byRight\":{\"name\":\"byRight\",\"async\":true,\"parameters\":[{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"attach\":{\"name\":\"attach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem>\",\"isStatic\":false,\"isPublic\":true},\"detach\":{\"name\":\"detach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"setLinks\":{\"name\":\"setLinks\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightIds\",\"type\":\"string[]\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getAssets\":{\"name\":\"getAssets\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<Asset[]>\",\"isStatic\":false,\"isPublic\":true},\"addAsset\":{\"name\":\"addAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"asset\",\"type\":\"Asset\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"any\",\"optional\":true,\"default\":\"attachment\"},{\"name\":\"sortOrder\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"removeAsset\":{\"name\":\"removeAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"assetId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"api\":false,\"mcp\":false,\"cli\":false,\"tableName\":\"event_assets\"},\"extends\":\"SmrtJunction\",\"extendsTypeArg\":\"EventAsset\",\"exportName\":\"EventAssetCollection\",\"collectionExportName\":\"EventAssetCollectionCollection\",\"schema\":{\"tableName\":\"event_assets\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_assets\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID NOT NULL,\\n \\\"asset_id\\\" UUID NOT NULL,\\n \\\"relationship\\\" TEXT NOT NULL,\\n \\\"sort_order\\\" INTEGER NOT NULL DEFAULT 0\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"asset_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"relationship\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":true,\"unique\":false,\"default\":0}},\"indexes\":[{\"name\":\"event_assets_event_id_asset_id_idx\",\"columns\":[\"event_id\",\"asset_id\",\"relationship\"],\"unique\":true},{\"name\":\"event_assets_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_assets_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_assets_asset_id_idx\",\"columns\":[\"asset_id\"]}],\"version\":\"aeebedc6\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventCollection\":{\"name\":\"eventcollection\",\"className\":\"EventCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventCollection\",\"collection\":\"events\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"getBySeriesId\":{\"name\":\"getBySeriesId\",\"async\":true,\"parameters\":[{\"name\":\"seriesId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByPlace\":{\"name\":\"getByPlace\",\"async\":true,\"parameters\":[{\"name\":\"placeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByDateRange\":{\"name\":\"getByDateRange\",\"async\":true,\"parameters\":[{\"name\":\"startDate\",\"type\":\"Date\",\"optional\":false},{\"name\":\"endDate\",\"type\":\"Date\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getUpcoming\":{\"name\":\"getUpcoming\",\"async\":true,\"parameters\":[{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByStatus\":{\"name\":\"getByStatus\",\"async\":true,\"parameters\":[{\"name\":\"status\",\"type\":\"EventStatus\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByType\":{\"name\":\"getByType\",\"async\":true,\"parameters\":[{\"name\":\"typeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getRootEvents\":{\"name\":\"getRootEvents\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getByParent\":{\"name\":\"getByParent\",\"async\":true,\"parameters\":[{\"name\":\"parentId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getEventTree\":{\"name\":\"getEventTree\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event | null>\",\"isStatic\":false,\"isPublic\":true},\"getAssets\":{\"name\":\"getAssets\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<Asset[]>\",\"isStatic\":false,\"isPublic\":true},\"addAsset\":{\"name\":\"addAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"asset\",\"type\":\"Asset\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"any\",\"optional\":true,\"default\":\"attachment\"},{\"name\":\"sortOrder\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"removeAsset\":{\"name\":\"removeAsset\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"assetId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"query\",\"type\":\"string\",\"optional\":false},{\"name\":\"filters\",\"type\":\"EventSearchFilters\",\"optional\":true}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"getInProgress\":{\"name\":\"getInProgress\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Event[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Event\",\"exportName\":\"EventCollection\",\"collectionExportName\":\"EventCollectionCollection\",\"schema\":{\"tableName\":\"events\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"events\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"parent_id\\\" UUID,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"series_id\\\" UUID,\\n \\\"type_id\\\" UUID,\\n \\\"place_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"all_day\\\" BOOLEAN DEFAULT FALSE,\\n \\\"time_zone\\\" TEXT,\\n \\\"status\\\" TEXT DEFAULT 'scheduled',\\n \\\"round\\\" INTEGER,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"parent_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"series_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_series\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"place_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"all_day\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"default\":false},\"time_zone\":{\"type\":\"TEXT\",\"notNull\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"scheduled\"},\"round\":{\"type\":\"INTEGER\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"events_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"events_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"events_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"events_parent_id_idx\",\"columns\":[\"parent_id\"]},{\"name\":\"events_series_id_idx\",\"columns\":[\"series_id\"]},{\"name\":\"events_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"events_place_id_idx\",\"columns\":[\"place_id\"]}],\"version\":\"8e689646\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventParticipantCollection\":{\"name\":\"eventparticipantcollection\",\"className\":\"EventParticipantCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventParticipantCollection\",\"collection\":\"eventparticipants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventParticipantCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"byLeft\":{\"name\":\"byLeft\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"byRight\":{\"name\":\"byRight\",\"async\":true,\"parameters\":[{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem[]>\",\"isStatic\":false,\"isPublic\":true},\"attach\":{\"name\":\"attach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<TItem>\",\"isStatic\":false,\"isPublic\":true},\"detach\":{\"name\":\"detach\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightId\",\"type\":\"string\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionFilterOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"setLinks\":{\"name\":\"setLinks\",\"async\":true,\"parameters\":[{\"name\":\"leftId\",\"type\":\"string\",\"optional\":false},{\"name\":\"rightIds\",\"type\":\"string[]\",\"optional\":false},{\"name\":\"opts\",\"type\":\"JunctionAttachOptions\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getByPlacement\":{\"name\":\"getByPlacement\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getByGroup\":{\"name\":\"getByGroup\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false},{\"name\":\"groupId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getHome\":{\"name\":\"getHome\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getAway\":{\"name\":\"getAway\",\"async\":true,\"parameters\":[{\"name\":\"eventId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"filters\",\"type\":\"ParticipantSearchFilters\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getParticipantStats\":{\"name\":\"getParticipantStats\",\"async\":true,\"parameters\":[{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"eventTypeId\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<object>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtJunction\",\"extendsTypeArg\":\"EventParticipant\",\"exportName\":\"EventParticipantCollection\",\"collectionExportName\":\"EventParticipantCollectionCollection\",\"schema\":{\"tableName\":\"event_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID,\\n \\\"profile_id\\\" UUID,\\n \\\"role\\\" TEXT DEFAULT '',\\n \\\"placement\\\" INTEGER,\\n \\\"group_id\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"role\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"placement\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false},\"group_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"event_participants_event_id_profile_id_idx\",\"columns\":[\"event_id\",\"profile_id\",\"role\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_participants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_participants_profile_id_idx\",\"columns\":[\"profile_id\"]}],\"version\":\"c2faac84\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventSeriesCollection\":{\"name\":\"eventseriescollection\",\"className\":\"EventSeriesCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventSeriesCollection\",\"collection\":\"eventserieses\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventSeriesCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"getByOrganizer\":{\"name\":\"getByOrganizer\",\"async\":true,\"parameters\":[{\"name\":\"organizerId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"getActive\":{\"name\":\"getActive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"getUpcoming\":{\"name\":\"getUpcoming\",\"async\":true,\"parameters\":[{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"getByType\":{\"name\":\"getByType\",\"async\":true,\"parameters\":[{\"name\":\"typeId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"query\",\"type\":\"string\",\"optional\":false},{\"name\":\"filters\",\"type\":\"EventSeriesSearchFilters\",\"optional\":true}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventSeries[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"EventSeries\",\"exportName\":\"EventSeriesCollection\",\"collectionExportName\":\"EventSeriesCollectionCollection\",\"schema\":{\"tableName\":\"event_series\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_series\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"type_id\\\" UUID,\\n \\\"organizer_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"recurrence\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"organizer_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"recurrence\":{\"type\":\"TEXT\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"event_series_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_series_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_series_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_series_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"event_series_organizer_id_idx\",\"columns\":[\"organizer_id\"]}],\"version\":\"c79f5863\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventTypeCollection\":{\"name\":\"eventtypecollection\",\"className\":\"EventTypeCollection\",\"qualifiedName\":\"@happyvertical/smrt-events:EventTypeCollection\",\"collection\":\"eventtypes\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/collections/EventTypeCollection.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{},\"methods\":{\"getOrCreate\":{\"name\":\"getOrCreate\",\"async\":true,\"parameters\":[{\"name\":\"slug\",\"type\":\"string\",\"optional\":false},{\"name\":\"name\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<EventType>\",\"isStatic\":false,\"isPublic\":true},\"getBySlug\":{\"name\":\"getBySlug\",\"async\":true,\"parameters\":[{\"name\":\"slug\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType | null>\",\"isStatic\":false,\"isPublic\":true},\"initializeDefaults\":{\"name\":\"initializeDefaults\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"EventType\",\"exportName\":\"EventTypeCollection\",\"collectionExportName\":\"EventTypeCollectionCollection\",\"schema\":{\"tableName\":\"event_types\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_types\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"schema\\\" TEXT DEFAULT '',\\n \\\"participant_schema\\\" TEXT DEFAULT ''\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"participant_schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"event_types_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_types_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_types_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"922ae3b0\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:Event\":{\"name\":\"event\",\"className\":\"Event\",\"qualifiedName\":\"@happyvertical/smrt-events:Event\",\"collection\":\"events\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/Event.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"created_at\":{\"type\":\"datetime\",\"required\":false},\"updated_at\":{\"type\":\"datetime\",\"required\":false},\"parentId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Event\",\"_meta\":{\"nullable\":true,\"constraint\":{\"engines\":[\"postgres\",\"sqlite\"]}}},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"seriesId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"EventSeries\",\"_meta\":{\"constraint\":{\"engines\":[\"postgres\",\"sqlite\"]}}},\"typeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"EventType\",\"_meta\":{\"constraint\":{\"engines\":[\"postgres\",\"sqlite\"]}}},\"placeId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-places:Place\"},\"description\":{\"type\":\"text\",\"required\":false},\"startDate\":{\"type\":\"datetime\",\"required\":false},\"endDate\":{\"type\":\"datetime\",\"required\":false},\"allDay\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"timeZone\":{\"type\":\"text\",\"required\":false},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"scheduled\"},\"round\":{\"type\":\"integer\",\"required\":false},\"metadata\":{\"type\":\"text\",\"required\":false},\"externalId\":{\"type\":\"text\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false},\"createdAt\":{\"type\":\"text\",\"required\":false},\"updatedAt\":{\"type\":\"text\",\"required\":false}},\"methods\":{\"getParent\":{\"name\":\"getParent\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this | null>\",\"isStatic\":false,\"isPublic\":true},\"getChildren\":{\"name\":\"getChildren\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getAncestors\":{\"name\":\"getAncestors\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getDescendants\":{\"name\":\"getDescendants\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getHierarchy\":{\"name\":\"getHierarchy\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<HierarchyView<this>>\",\"isStatic\":false,\"isPublic\":true},\"moveTo\":{\"name\":\"moveTo\",\"async\":true,\"parameters\":[{\"name\":\"newParent\",\"type\":\"this | string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"this\"},{\"type\":\"string\"},{\"type\":\"null\"}]}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateStatus\":{\"name\":\"updateStatus\",\"async\":true,\"parameters\":[{\"name\":\"newStatus\",\"type\":\"EventStatus\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getSeries\":{\"name\":\"getSeries\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getType\":{\"name\":\"getType\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getPlace\":{\"name\":\"getPlace\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getRootEvent\":{\"name\":\"getRootEvent\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Event>\",\"isStatic\":false,\"isPublic\":true},\"getParticipants\":{\"name\":\"getParticipants\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getAssets\":{\"name\":\"getAssets\",\"async\":true,\"parameters\":[{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<Asset[]>\",\"isStatic\":false,\"isPublic\":true},\"addAsset\":{\"name\":\"addAsset\",\"async\":true,\"parameters\":[{\"name\":\"asset\",\"type\":\"Asset\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"any\",\"optional\":true,\"default\":\"attachment\"},{\"name\":\"sortOrder\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"removeAsset\":{\"name\":\"removeAsset\",\"async\":true,\"parameters\":[{\"name\":\"assetId\",\"type\":\"string\",\"optional\":false},{\"name\":\"relationship\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"isInProgress\":{\"name\":\"isInProgress\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isRoot\":{\"name\":\"isRoot\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableStrategy\":\"sti\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"]},\"extends\":\"SmrtHierarchical\",\"exportName\":\"Event\",\"collectionExportName\":\"EventCollection\",\"schema\":{\"tableName\":\"events\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"events\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"parent_id\\\" UUID,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"series_id\\\" UUID,\\n \\\"type_id\\\" UUID,\\n \\\"place_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"all_day\\\" BOOLEAN DEFAULT FALSE,\\n \\\"time_zone\\\" TEXT,\\n \\\"status\\\" TEXT DEFAULT 'scheduled',\\n \\\"round\\\" INTEGER,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"parent_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"series_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_series\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\",\"engines\":[\"postgres\",\"sqlite\"]}},\"place_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"all_day\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"default\":false},\"time_zone\":{\"type\":\"TEXT\",\"notNull\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"scheduled\"},\"round\":{\"type\":\"INTEGER\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"events_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"events_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"events_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"events_parent_id_idx\",\"columns\":[\"parent_id\"]},{\"name\":\"events_series_id_idx\",\"columns\":[\"series_id\"]},{\"name\":\"events_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"events_place_id_idx\",\"columns\":[\"place_id\"]}],\"version\":\"8e689646\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventAsset\":{\"name\":\"eventasset\",\"className\":\"EventAsset\",\"qualifiedName\":\"@happyvertical/smrt-events:EventAsset\",\"collection\":\"eventassets\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventAsset.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"eventId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"Event\",\"_meta\":{\"required\":true}},\"assetId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-assets:Asset\"},\"relationship\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"required\":true}},\"sortOrder\":{\"type\":\"integer\",\"required\":true,\"default\":0}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"event_assets\",\"conflictColumns\":[\"event_id\",\"asset_id\",\"relationship\"],\"api\":false,\"mcp\":false,\"cli\":false,\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"EventAsset\",\"collectionExportName\":\"EventAssetCollection\",\"validationRules\":[{\"field\":\"eventId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"assetId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"relationship\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"sortOrder\",\"rule\":\"required\",\"fieldType\":\"integer\"}],\"schema\":{\"tableName\":\"event_assets\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_assets\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID NOT NULL,\\n \\\"asset_id\\\" UUID NOT NULL,\\n \\\"relationship\\\" TEXT NOT NULL,\\n \\\"sort_order\\\" INTEGER NOT NULL DEFAULT 0\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"asset_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"relationship\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false},\"sort_order\":{\"type\":\"INTEGER\",\"notNull\":true,\"unique\":false,\"default\":0}},\"indexes\":[{\"name\":\"event_assets_event_id_asset_id_idx\",\"columns\":[\"event_id\",\"asset_id\",\"relationship\"],\"unique\":true},{\"name\":\"event_assets_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_assets_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_assets_asset_id_idx\",\"columns\":[\"asset_id\"]}],\"version\":\"aeebedc6\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventParticipant\":{\"name\":\"eventparticipant\",\"className\":\"EventParticipant\",\"qualifiedName\":\"@happyvertical/smrt-events:EventParticipant\",\"collection\":\"eventparticipants\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventParticipant.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"eventId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Event\"},\"profileId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"role\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"placement\":{\"type\":\"integer\",\"required\":false},\"groupId\":{\"type\":\"text\",\"required\":false},\"metadata\":{\"type\":\"text\",\"required\":false},\"externalId\":{\"type\":\"text\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false},\"createdAt\":{\"type\":\"text\",\"required\":false},\"updatedAt\":{\"type\":\"text\",\"required\":false}},\"methods\":{\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getEvent\":{\"name\":\"getEvent\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getProfile\":{\"name\":\"getProfile\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getGroupParticipants\":{\"name\":\"getGroupParticipants\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<EventParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"isHome\":{\"name\":\"isHome\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isAway\":{\"name\":\"isAway\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"conflictColumns\":[\"event_id\",\"profile_id\",\"role\"],\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"EventParticipant\",\"collectionExportName\":\"EventParticipantCollection\",\"schema\":{\"tableName\":\"event_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"event_id\\\" UUID,\\n \\\"profile_id\\\" UUID,\\n \\\"role\\\" TEXT DEFAULT '',\\n \\\"placement\\\" INTEGER,\\n \\\"group_id\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"event_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"events\",\"column\":\"id\",\"onDelete\":\"CASCADE\",\"onUpdate\":\"CASCADE\"}},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"role\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"placement\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false},\"group_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"event_participants_event_id_profile_id_idx\",\"columns\":[\"event_id\",\"profile_id\",\"role\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"]},{\"name\":\"event_participants_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_participants_profile_id_idx\",\"columns\":[\"profile_id\"]}],\"version\":\"c2faac84\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventSeries\":{\"name\":\"eventseries\",\"className\":\"EventSeries\",\"qualifiedName\":\"@happyvertical/smrt-events:EventSeries\",\"collection\":\"eventserieses\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventSeries.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"created_at\":{\"type\":\"datetime\",\"required\":false},\"updated_at\":{\"type\":\"datetime\",\"required\":false},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"typeId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"EventType\"},\"organizerId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"description\":{\"type\":\"text\",\"required\":false},\"startDate\":{\"type\":\"datetime\",\"required\":false},\"endDate\":{\"type\":\"datetime\",\"required\":false},\"recurrence\":{\"type\":\"text\",\"required\":false},\"metadata\":{\"type\":\"text\",\"required\":false},\"externalId\":{\"type\":\"text\",\"required\":false},\"source\":{\"type\":\"text\",\"required\":false},\"createdAt\":{\"type\":\"text\",\"required\":false},\"updatedAt\":{\"type\":\"text\",\"required\":false}},\"methods\":{\"getRecurrence\":{\"name\":\"getRecurrence\",\"async\":false,\"parameters\":[],\"returnType\":\"RecurrencePattern | null\",\"isStatic\":false,\"isPublic\":true},\"setRecurrence\":{\"name\":\"setRecurrence\",\"async\":false,\"parameters\":[{\"name\":\"pattern\",\"type\":\"RecurrencePattern\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getOccurrences\":{\"name\":\"getOccurrences\",\"async\":false,\"parameters\":[{\"name\":\"rangeStart\",\"type\":\"Date\",\"optional\":false},{\"name\":\"rangeEnd\",\"type\":\"Date\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true,\"memberTypes\":[\"string\",\"Date\",\"number\"]}],\"returnType\":\"Date[]\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getType\":{\"name\":\"getType\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getOrganizer\":{\"name\":\"getOrganizer\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getEvents\":{\"name\":\"getEvents\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableStrategy\":\"sti\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\",\"update\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"]},\"extends\":\"SmrtObject\",\"exportName\":\"EventSeries\",\"collectionExportName\":\"EventSeriesCollection\",\"schema\":{\"tableName\":\"event_series\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_series\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"type_id\\\" UUID,\\n \\\"organizer_id\\\" UUID,\\n \\\"description\\\" TEXT,\\n \\\"start_date\\\" TIMESTAMP,\\n \\\"end_date\\\" TIMESTAMP,\\n \\\"recurrence\\\" TEXT,\\n \\\"metadata\\\" TEXT,\\n \\\"external_id\\\" TEXT,\\n \\\"source\\\" TEXT\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"type_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"foreignKey\":{\"table\":\"event_types\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"organizer_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false},\"start_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"end_date\":{\"type\":\"TIMESTAMP\",\"notNull\":false},\"recurrence\":{\"type\":\"TEXT\",\"notNull\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false},\"external_id\":{\"type\":\"TEXT\",\"notNull\":false},\"source\":{\"type\":\"TEXT\",\"notNull\":false}},\"indexes\":[{\"name\":\"event_series_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_series_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_series_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"event_series_type_id_idx\",\"columns\":[\"type_id\"]},{\"name\":\"event_series_organizer_id_idx\",\"columns\":[\"organizer_id\"]}],\"version\":\"c79f5863\"},\"importPath\":\"@happyvertical/smrt-events\"},\"@happyvertical/smrt-events:EventType\":{\"name\":\"eventtype\",\"className\":\"EventType\",\"qualifiedName\":\"@happyvertical/smrt-events:EventType\",\"collection\":\"eventtypes\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/events/src/models/EventType.ts\",\"packageName\":\"@happyvertical/smrt-events\",\"fields\":{\"created_at\":{\"type\":\"datetime\",\"required\":false},\"updated_at\":{\"type\":\"datetime\",\"required\":false},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"schema\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"participantSchema\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"createdAt\":{\"type\":\"datetime\",\"required\":false},\"updatedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getSchema\":{\"name\":\"getSchema\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setSchema\":{\"name\":\"setSchema\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getParticipantSchema\":{\"name\":\"getParticipantSchema\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string, unknown>\",\"isStatic\":false,\"isPublic\":true},\"setParticipantSchema\":{\"name\":\"setParticipantSchema\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string, unknown>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getBySlug\":{\"name\":\"getBySlug\",\"async\":true,\"parameters\":[{\"name\":\"_slug\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<EventType | null>\",\"isStatic\":true,\"isPublic\":true}},\"decoratorConfig\":{\"tableStrategy\":\"sti\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"]},\"extends\":\"SmrtObject\",\"exportName\":\"EventType\",\"collectionExportName\":\"EventTypeCollection\",\"validationRules\":[{\"field\":\"name\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"event_types\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"event_types\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"_meta_type\\\" TEXT NOT NULL,\\n \\\"_meta_data\\\" JSON,\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"schema\\\" TEXT DEFAULT '',\\n \\\"participant_schema\\\" TEXT DEFAULT ''\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"_meta_type\":{\"type\":\"TEXT\",\"notNull\":true},\"_meta_data\":{\"type\":\"JSON\",\"notNull\":false},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"},\"participant_schema\":{\"type\":\"TEXT\",\"notNull\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"event_types_slug_context_meta_type_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\",\"_meta_type\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"event_types_meta_type_idx\",\"columns\":[\"_meta_type\"]},{\"name\":\"event_types_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"922ae3b0\"},\"importPath\":\"@happyvertical/smrt-events\"}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-assets\",\"@happyvertical/smrt-core\",\"@happyvertical/smrt-places\",\"@happyvertical/smrt-profiles\",\"@happyvertical/smrt-tenancy\"]}"));
20
23
  //#endregion
21
- //#region src/models/EventAsset.ts
22
- var __defProp$6 = Object.defineProperty;
23
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
24
- var __decorateClass$6 = (decorators, target, key, kind) => {
25
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
26
- for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
27
- if (kind && result) __defProp$6(target, key, result);
28
- return result;
29
- };
30
- var EventAsset = class extends SmrtObject {
31
- tenantId = null;
32
- eventId = "";
33
- assetId = "";
34
- relationship = "attachment";
35
- sortOrder = 0;
36
- constructor(options = {}) {
37
- super(options);
38
- if (options.eventId) this.eventId = options.eventId;
39
- if (options.assetId) this.assetId = options.assetId;
40
- if (options.relationship) this.relationship = options.relationship;
41
- if (options.sortOrder !== void 0) this.sortOrder = options.sortOrder;
42
- if (options.tenantId !== void 0) this.tenantId = options.tenantId;
24
+ //#region src/calendar/icalendar.ts
25
+ var CalendarEventValidationError = class extends Error {
26
+ constructor(message) {
27
+ super(message);
28
+ this.name = "CalendarEventValidationError";
43
29
  }
44
30
  };
45
- __decorateClass$6([tenantId({ nullable: true })], EventAsset.prototype, "tenantId", 2);
46
- __decorateClass$6([foreignKey("Event", { required: true })], EventAsset.prototype, "eventId", 2);
47
- __decorateClass$6([crossPackageRef("@happyvertical/smrt-assets:Asset", { required: true })], EventAsset.prototype, "assetId", 2);
48
- __decorateClass$6([field({ required: true })], EventAsset.prototype, "relationship", 2);
49
- __decorateClass$6([field()], EventAsset.prototype, "sortOrder", 2);
50
- EventAsset = __decorateClass$6([TenantScoped({ mode: "optional" }), smrt({
51
- tableName: "event_assets",
52
- conflictColumns: [
53
- "event_id",
54
- "asset_id",
55
- "relationship"
56
- ],
57
- api: false,
58
- mcp: false,
59
- cli: false
60
- })], EventAsset);
61
- //#endregion
62
- //#region src/collections/EventAssetCollection.ts
63
- var EventAssetCollection_exports = /* @__PURE__ */ __exportAll({ EventAssetCollection: () => EventAssetCollection });
64
- var __defProp$5 = Object.defineProperty;
65
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
66
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$5(obj, key, {
67
- enumerable: true,
68
- configurable: true,
69
- writable: true,
70
- value
71
- }) : obj[key] = value;
72
- var __decorateClass$5 = (decorators, target, key, kind) => {
73
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
74
- for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
75
- if (kind && result) __defProp$5(target, key, result);
76
- return result;
77
- };
78
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
79
- var EventAssetCollection = class extends SmrtJunction {
80
- leftField = "eventId";
81
- rightField = "assetId";
82
- eventCollectionPromise = null;
83
- async getEventCollection() {
84
- if (!this.eventCollectionPromise) {
85
- const { EventCollection } = await Promise.resolve().then(() => EventCollection_exports);
86
- this.eventCollectionPromise = EventCollection.create({ db: this.db });
31
+ function readText(component, name) {
32
+ const value = component.getFirstPropertyValue(name);
33
+ if (typeof value === "string") return value;
34
+ return value && typeof value.toString === "function" ? value.toString() : "";
35
+ }
36
+ function readNumber(component, name) {
37
+ const value = component.getFirstPropertyValue(name);
38
+ return typeof value === "number" && Number.isSafeInteger(value) ? value : null;
39
+ }
40
+ function readTime(component, name) {
41
+ const value = component.getFirstPropertyValue(name);
42
+ return value instanceof ICAL.Time ? value : null;
43
+ }
44
+ function timeZone(component, name) {
45
+ const parameter = component.getFirstProperty(name)?.getFirstParameter("tzid");
46
+ if (typeof parameter === "string") return parameter;
47
+ const tzid = readTime(component, name)?.zone?.tzid;
48
+ return typeof tzid === "string" && tzid !== "Z" && tzid !== "floating" ? tzid : "";
49
+ }
50
+ function recurrenceId(value, zone) {
51
+ return value ? value.isDate ? value.toString() : instant(value, zone).toISOString() : void 0;
52
+ }
53
+ function recurrenceDates(component, propertyName, zone) {
54
+ return component.getAllProperties(propertyName).flatMap((property) => {
55
+ return property.getValues().filter((value) => value instanceof ICAL.Time).map((value) => recurrenceId(value, String(property.getFirstParameter("tzid") || zone)));
56
+ });
57
+ }
58
+ function parseICalendarEvents(source, ics, options = {}) {
59
+ if (!source.trim()) throw new CalendarEventValidationError("Calendar source is required");
60
+ const { component } = parseICalendar(ics, options.limits);
61
+ const seen = /* @__PURE__ */ new Set();
62
+ return component.getAllSubcomponents("vevent").map((event) => {
63
+ const uid = readText(event, "uid").trim();
64
+ if (!uid) throw new CalendarEventValidationError("VEVENT UID is required");
65
+ const start = readTime(event, "dtstart");
66
+ const end = readTime(event, "dtend");
67
+ const instance = readTime(event, "recurrence-id");
68
+ const allDay = (start ?? instance)?.isDate === true;
69
+ const resolvedTimeZone = timeZone(event, "dtstart") || timeZone(event, "recurrence-id") || options.floatingTimeZone || (allDay ? "UTC" : "");
70
+ if ((start || instance) && !allDay && !resolvedTimeZone) throw new CalendarEventValidationError("Floating DTSTART requires an explicit source time-zone policy");
71
+ if (resolvedTimeZone && !isValidTimeZone(resolvedTimeZone)) throw new CalendarEventValidationError("Unknown IANA time zone");
72
+ const identity = {
73
+ source,
74
+ uid,
75
+ recurrenceId: recurrenceId(instance, timeZone(event, "recurrence-id") || resolvedTimeZone)
76
+ };
77
+ const key = JSON.stringify([uid, identity.recurrenceId ?? null]);
78
+ if (seen.has(key)) throw new CalendarEventValidationError("Duplicate VEVENT identity");
79
+ seen.add(key);
80
+ const sequence = readNumber(event, "sequence");
81
+ if (event.hasProperty("sequence") && (sequence === null || sequence < 0)) throw new CalendarEventValidationError("Invalid SEQUENCE");
82
+ const status = readText(event, "status").toUpperCase();
83
+ if (status && ![
84
+ "CONFIRMED",
85
+ "TENTATIVE",
86
+ "CANCELLED"
87
+ ].includes(status)) throw new CalendarEventValidationError("Unsupported VEVENT STATUS");
88
+ if (!start && status !== "CANCELLED") throw new CalendarEventValidationError("VEVENT DTSTART is required");
89
+ if (event.hasProperty("duration") || event.hasProperty("exrule") || event.getFirstProperty("recurrence-id")?.getFirstParameter("range") || event.getAllProperties("rdate").some((p) => p.type === "period")) throw new CalendarEventValidationError("Unsupported DURATION, EXRULE, RANGE or PERIOD");
90
+ const startDate = start ? instant(start, resolvedTimeZone) : null;
91
+ if (start && end && start.isDate !== end.isDate) throw new CalendarEventValidationError("DTSTART and DTEND value types differ");
92
+ const endDate = end ? instant(end, timeZone(event, "dtend") || resolvedTimeZone) : start && allDay ? instant(nextDay(start), resolvedTimeZone) : startDate;
93
+ if (startDate && endDate && endDate < startDate) throw new CalendarEventValidationError("DTEND precedes DTSTART");
94
+ return {
95
+ identity,
96
+ name: readText(event, "summary"),
97
+ description: readText(event, "description"),
98
+ startDate,
99
+ endDate,
100
+ detached: Boolean(instance),
101
+ allDay,
102
+ timeZone: resolvedTimeZone,
103
+ status: status === "CANCELLED" ? "cancelled" : "scheduled",
104
+ sequence,
105
+ dtstamp: readTime(event, "dtstamp")?.toJSDate() ?? null,
106
+ recurrence: readText(event, "rrule") || null,
107
+ excludedRecurrenceIds: recurrenceDates(event, "exdate", resolvedTimeZone),
108
+ additionalRecurrenceIds: recurrenceDates(event, "rdate", resolvedTimeZone)
109
+ };
110
+ });
111
+ }
112
+ function nextDay(value) {
113
+ const next = value.clone();
114
+ next.adjust(1, 0, 0, 0);
115
+ return next;
116
+ }
117
+ function instant(value, zone) {
118
+ if (value.zone.tzid === "UTC" || value.zone.tzid === "Z") return value.toJSDate();
119
+ return fromZonedWallTime({
120
+ year: value.year,
121
+ month: value.month,
122
+ day: value.day,
123
+ hour: value.hour,
124
+ minute: value.minute,
125
+ second: value.second,
126
+ millisecond: 0
127
+ }, zone || "UTC");
128
+ }
129
+ function expandICalendarEvents(source, ics, options) {
130
+ const { rangeStart, rangeEnd } = options;
131
+ const limit = options.limit ?? 1e3;
132
+ const maxIterations = options.maxIterations ?? 1e4;
133
+ if (!Number.isFinite(rangeStart.getTime()) || !Number.isFinite(rangeEnd.getTime()) || rangeEnd < rangeStart || !Number.isSafeInteger(limit) || limit < 1 || limit > 1e4 || !Number.isSafeInteger(maxIterations) || maxIterations < 1 || maxIterations > 1e5) throw new CalendarEventValidationError("Invalid expansion bounds");
134
+ const inputs = parseICalendarEvents(source, ics, options);
135
+ const components = parseICalendar(ics, options.limits).component.getAllSubcomponents("vevent");
136
+ const rows = /* @__PURE__ */ new Map();
137
+ let iterations = 0;
138
+ const key = (entry) => JSON.stringify([entry.identity.uid, entry.identity.recurrenceId ?? null]);
139
+ const put = (entry) => {
140
+ const previous = rows.get(key(entry));
141
+ if (!previous || entry.detached || !previous.detached) rows.set(key(entry), entry);
142
+ if (rows.size > limit) throw new CalendarEventValidationError("Calendar occurrence limit exceeded");
143
+ };
144
+ for (let index = 0; index < inputs.length; index++) {
145
+ const entry = inputs[index];
146
+ if (entry.detached) continue;
147
+ const component = components[index];
148
+ if (!entry.recurrence && !entry.additionalRecurrenceIds.length) {
149
+ if (!entry.startDate || entry.startDate >= rangeStart && entry.startDate <= rangeEnd) put(entry);
150
+ continue;
151
+ }
152
+ const start = readTime(component, "dtstart");
153
+ if (!start) throw new CalendarEventValidationError("Recurring master requires DTSTART");
154
+ const rules = component.getAllProperties("rrule");
155
+ for (const property of rules) {
156
+ const raw = property.toJSON()[3];
157
+ const supported = /* @__PURE__ */ new Set([
158
+ "freq",
159
+ "interval",
160
+ "count",
161
+ "until",
162
+ "wkst",
163
+ "bysecond",
164
+ "byminute",
165
+ "byhour",
166
+ "byday",
167
+ "bymonthday",
168
+ "byyearday",
169
+ "byweekno",
170
+ "bymonth",
171
+ "bysetpos"
172
+ ]);
173
+ if (raw && typeof raw === "object" && Object.keys(raw).some((key2) => !supported.has(key2))) throw new CalendarEventValidationError("Unsupported recurrence property");
174
+ }
175
+ if (rules.length > 1) throw new CalendarEventValidationError("Multiple RRULEs unsupported");
176
+ for (const property of rules) {
177
+ const rule = property.getFirstValue();
178
+ if (!(rule instanceof ICAL.Recur) || ![
179
+ "DAILY",
180
+ "WEEKLY",
181
+ "MONTHLY",
182
+ "YEARLY"
183
+ ].includes(rule.freq) || rule.interval < 1 || rule.count !== null && rule.count < 1) throw new CalendarEventValidationError("Unsupported or malformed recurrence");
184
+ if (rule instanceof ICAL.Recur) {
185
+ const allowedParts = {
186
+ DAILY: [],
187
+ WEEKLY: ["BYDAY"],
188
+ MONTHLY: [
189
+ "BYDAY",
190
+ "BYMONTHDAY",
191
+ "BYSETPOS"
192
+ ],
193
+ YEARLY: ["BYMONTH", "BYMONTHDAY"]
194
+ };
195
+ if (Object.keys(rule.parts).some((part) => !allowedParts[rule.freq]?.includes(part)) || rule.freq === "MONTHLY" && (rule.parts.BYMONTHDAY && rule.parts.BYDAY || rule.parts.BYSETPOS && !rule.parts.BYDAY) || rule.freq === "WEEKLY" && rule.parts.BYDAY?.some((day) => !/^[A-Z]{2}$/.test(day))) throw new CalendarEventValidationError("Unsupported recurrence combination");
196
+ }
197
+ }
198
+ const expansionComponent = new ICAL.Component(JSON.parse(JSON.stringify(component.toJSON())));
199
+ expansionComponent.removeAllProperties("exdate");
200
+ expansionComponent.removeAllProperties("rdate");
201
+ for (const property of expansionComponent.getAllProperties("rrule")) {
202
+ const rule = property.getFirstValue();
203
+ if (rule instanceof ICAL.Recur) {
204
+ const declaredUntil = rule.until ? instant(rule.until, entry.timeZone) : rangeEnd;
205
+ const wall = toZonedWallTime(declaredUntil < rangeEnd ? declaredUntil : rangeEnd, entry.timeZone);
206
+ rule.until = ICAL.Time.fromData({
207
+ ...wall,
208
+ isDate: start.isDate
209
+ }, start.zone);
210
+ }
211
+ }
212
+ const iterator = new ICAL.RecurExpansion({
213
+ component: expansionComponent,
214
+ dtstart: start
215
+ });
216
+ const duration = readTime(component, "dtend")?.subtractDate(start) ?? ICAL.Duration.fromSeconds(entry.allDay ? 86400 : 0);
217
+ const emitted = /* @__PURE__ */ new Set();
218
+ const emit = (occurrence, startDate, id) => {
219
+ if (startDate < rangeStart || startDate > rangeEnd || emitted.has(id)) return;
220
+ emitted.add(id);
221
+ const end = occurrence.clone();
222
+ end.addDuration(duration);
223
+ put({
224
+ ...entry,
225
+ identity: {
226
+ ...entry.identity,
227
+ recurrenceId: id
228
+ },
229
+ startDate,
230
+ endDate: entry.allDay ? instant(end, entry.timeZone) : new Date(startDate.getTime() + ((entry.endDate?.getTime() ?? 0) - (entry.startDate?.getTime() ?? 0))),
231
+ detached: false,
232
+ status: entry.excludedRecurrenceIds.includes(id) ? "cancelled" : entry.status
233
+ });
234
+ };
235
+ for (;;) {
236
+ if (++iterations > maxIterations) throw new CalendarEventValidationError("Calendar iteration limit exceeded");
237
+ const occurrence = iterator.next();
238
+ if (!occurrence) break;
239
+ const startDate = instant(occurrence, entry.timeZone);
240
+ if (startDate > rangeEnd) break;
241
+ emit(occurrence, startDate, recurrenceId(occurrence, entry.timeZone));
242
+ }
243
+ for (const additional of entry.additionalRecurrenceIds) {
244
+ if (++iterations > maxIterations) throw new CalendarEventValidationError("Calendar iteration limit exceeded");
245
+ const occurrence = ICAL.Time.fromString(additional, void 0);
246
+ emit(occurrence, instant(occurrence, entry.timeZone), additional);
247
+ }
248
+ for (const excluded of entry.excludedRecurrenceIds) {
249
+ if (emitted.has(excluded)) continue;
250
+ const startDate = excluded.endsWith("Z") ? new Date(excluded) : instant(ICAL.Time.fromString(excluded, void 0), entry.timeZone);
251
+ if (startDate >= rangeStart && startDate <= rangeEnd) put({
252
+ ...entry,
253
+ identity: {
254
+ ...entry.identity,
255
+ recurrenceId: excluded
256
+ },
257
+ startDate,
258
+ endDate: startDate,
259
+ status: "cancelled",
260
+ detached: false
261
+ });
87
262
  }
88
- return this.eventCollectionPromise;
89
- }
90
- async getAssets(eventId, relationship) {
91
- return getOwnedAssetsFromCollection(await this.getEventCollection(), eventId, relationship);
92
- }
93
- async addAsset(eventId, asset, relationship = "attachment", sortOrder = 0) {
94
- await addOwnedAssetFromCollection(await this.getEventCollection(), "Event", eventId, asset, relationship, sortOrder);
95
263
  }
96
- async removeAsset(eventId, assetId, relationship) {
97
- await removeOwnedAssetFromCollection(await this.getEventCollection(), "Event", eventId, assetId, relationship);
264
+ for (const entry of inputs.filter((e) => e.detached)) {
265
+ const originalId = entry.identity.recurrenceId;
266
+ const original = originalId.endsWith("Z") ? new Date(originalId) : instant(ICAL.Time.fromString(originalId, void 0), entry.timeZone);
267
+ if (original >= rangeStart && original <= rangeEnd || entry.startDate && entry.startDate >= rangeStart && entry.startDate <= rangeEnd) put(entry);
98
268
  }
99
- };
100
- __publicField$1(EventAssetCollection, "_itemClass", EventAsset);
101
- EventAssetCollection = __decorateClass$5([smrt({
102
- api: false,
103
- mcp: false,
104
- cli: false
105
- })], EventAssetCollection);
269
+ return [...rows.values()].sort((a, b) => (a.startDate?.getTime() ?? 0) - (b.startDate?.getTime() ?? 0));
270
+ }
106
271
  //#endregion
107
272
  //#region src/models/Event.ts
108
- var __defProp$4 = Object.defineProperty;
109
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
110
- var __decorateClass$4 = (decorators, target, key, kind) => {
111
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
273
+ var __defProp$6 = Object.defineProperty;
274
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
275
+ var __decorateClass$6 = (decorators, target, key, kind) => {
276
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
112
277
  for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
113
- if (kind && result) __defProp$4(target, key, result);
278
+ if (kind && result) __defProp$6(target, key, result);
114
279
  return result;
115
280
  };
116
281
  var Event = class extends SmrtHierarchical {
@@ -301,15 +466,15 @@ var Event = class extends SmrtHierarchical {
301
466
  return !this.parentId;
302
467
  }
303
468
  };
304
- __decorateClass$4([tenantId({ nullable: true })], Event.prototype, "tenantId", 2);
305
- __decorateClass$4([foreignKey("EventSeries", { constraint: { engines: ["postgres", "sqlite"] } })], Event.prototype, "seriesId", 2);
306
- __decorateClass$4([foreignKey("Event", {
469
+ __decorateClass$6([tenantId({ nullable: true })], Event.prototype, "tenantId", 2);
470
+ __decorateClass$6([foreignKey("EventSeries", { constraint: { engines: ["postgres", "sqlite"] } })], Event.prototype, "seriesId", 2);
471
+ __decorateClass$6([foreignKey("Event", {
307
472
  nullable: true,
308
473
  constraint: { engines: ["postgres", "sqlite"] }
309
474
  })], Event.prototype, "parentId", 2);
310
- __decorateClass$4([foreignKey("EventType", { constraint: { engines: ["postgres", "sqlite"] } })], Event.prototype, "typeId", 2);
311
- __decorateClass$4([crossPackageRef("@happyvertical/smrt-places:Place")], Event.prototype, "placeId", 2);
312
- Event = __decorateClass$4([TenantScoped({ mode: "optional" }), smrt({
475
+ __decorateClass$6([foreignKey("EventType", { constraint: { engines: ["postgres", "sqlite"] } })], Event.prototype, "typeId", 2);
476
+ __decorateClass$6([crossPackageRef("@happyvertical/smrt-places:Place")], Event.prototype, "placeId", 2);
477
+ Event = __decorateClass$6([TenantScoped({ mode: "optional" }), smrt({
313
478
  tableStrategy: "sti",
314
479
  api: { include: [
315
480
  "list",
@@ -509,22 +674,24 @@ var EventCollection = class extends SmrtCollection {
509
674
  }
510
675
  };
511
676
  //#endregion
512
- //#region src/models/EventParticipant.ts
513
- var __defProp$3 = Object.defineProperty;
514
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
515
- var __decorateClass$3 = (decorators, target, key, kind) => {
516
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
677
+ //#region src/models/EventSeries.ts
678
+ var __defProp$5 = Object.defineProperty;
679
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
680
+ var __decorateClass$5 = (decorators, target, key, kind) => {
681
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
517
682
  for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
518
- if (kind && result) __defProp$3(target, key, result);
683
+ if (kind && result) __defProp$5(target, key, result);
519
684
  return result;
520
685
  };
521
- var EventParticipant = class extends SmrtObject {
686
+ var EventSeries = class extends SmrtObject {
522
687
  tenantId = null;
523
- eventId = "";
524
- profileId = "";
525
- role = "";
526
- placement = null;
527
- groupId = "";
688
+ name = "";
689
+ typeId = "";
690
+ organizerId = "";
691
+ description = "";
692
+ startDate = null;
693
+ endDate = null;
694
+ recurrence = "";
528
695
  metadata = "";
529
696
  externalId = "";
530
697
  source = "";
@@ -532,19 +699,65 @@ var EventParticipant = class extends SmrtObject {
532
699
  updatedAt = /* @__PURE__ */ new Date();
533
700
  constructor(options = {}) {
534
701
  super(options);
535
- if (options.eventId) this.eventId = options.eventId;
536
- if (options.profileId) this.profileId = options.profileId;
537
- if (options.role !== void 0) this.role = options.role;
538
- if (options.placement !== void 0) this.placement = options.placement;
539
- if (options.groupId !== void 0) this.groupId = options.groupId;
702
+ if (options.typeId) this.typeId = options.typeId;
703
+ if (options.organizerId) this.organizerId = options.organizerId;
704
+ if (options.description !== void 0) this.description = options.description;
705
+ if (options.startDate !== void 0) this.startDate = options.startDate || null;
706
+ if (options.endDate !== void 0) this.endDate = options.endDate || null;
540
707
  if (options.externalId !== void 0) this.externalId = options.externalId;
541
708
  if (options.source !== void 0) this.source = options.source;
709
+ if (options.recurrence !== void 0) if (typeof options.recurrence === "string") this.recurrence = options.recurrence;
710
+ else this.recurrence = JSON.stringify(options.recurrence);
542
711
  if (options.metadata !== void 0) if (typeof options.metadata === "string") this.metadata = options.metadata;
543
712
  else this.metadata = JSON.stringify(options.metadata);
544
713
  if (options.createdAt) this.createdAt = options.createdAt;
545
714
  if (options.updatedAt) this.updatedAt = options.updatedAt;
546
715
  }
547
716
  /**
717
+ * Get recurrence pattern as parsed object
718
+ *
719
+ * @returns Parsed recurrence pattern or null
720
+ */
721
+ getRecurrence() {
722
+ if (!this.recurrence) return null;
723
+ try {
724
+ return JSON.parse(this.recurrence);
725
+ } catch {
726
+ return null;
727
+ }
728
+ }
729
+ /**
730
+ * Set recurrence pattern from object
731
+ *
732
+ * @param pattern - Recurrence pattern to store
733
+ */
734
+ setRecurrence(pattern) {
735
+ this.recurrence = JSON.stringify(pattern);
736
+ }
737
+ /**
738
+ * Expand this series' recurrence into occurrence start instants within a
739
+ * window. The first occurrence is `startDate` (or `options.start`); its
740
+ * wall-clock time in the time zone is kept for every occurrence, and
741
+ * `endDate` caps the series like an inclusive `until`.
742
+ *
743
+ * @param rangeStart - Inclusive window start
744
+ * @param rangeEnd - Inclusive window end
745
+ * @param options - Time zone (defaults to the pattern's `timeZone`, then UTC) and optional first occurrence
746
+ * @returns Occurrence start instants, or an empty array without a pattern or start
747
+ */
748
+ getOccurrences(rangeStart, rangeEnd, options = {}) {
749
+ const pattern = this.getRecurrence();
750
+ const start = options.start ?? this.startDate;
751
+ if (!pattern || !start) return [];
752
+ return expandRecurrence(pattern, {
753
+ start,
754
+ rangeStart,
755
+ rangeEnd: this.endDate && this.endDate.getTime() < rangeEnd.getTime() ? this.endDate : rangeEnd,
756
+ timeZone: options.timeZone,
757
+ limit: options.limit
758
+ });
759
+ }
760
+ /**
548
761
  * Get metadata as parsed object
549
762
  *
550
763
  * @returns Parsed metadata object or empty object
@@ -578,68 +791,55 @@ var EventParticipant = class extends SmrtObject {
578
791
  });
579
792
  }
580
793
  /**
581
- * Get the event for this participant
794
+ * Get the event type for this series
582
795
  *
583
- * @returns Event instance or null
796
+ * @returns EventType instance or null
584
797
  */
585
- async getEvent() {
586
- if (!this.eventId) return null;
587
- const { EventCollection } = await Promise.resolve().then(() => EventCollection_exports);
588
- return await (await EventCollection.create(this.options)).get({ id: this.eventId });
798
+ async getType() {
799
+ if (!this.typeId) return null;
800
+ const { EventTypeCollection } = await Promise.resolve().then(() => EventTypeCollection_exports);
801
+ return await (await EventTypeCollection.create(this.options)).get({ id: this.typeId });
589
802
  }
590
803
  /**
591
- * Get the profile for this participant
804
+ * Get the organizer profile for this series
592
805
  *
593
806
  * @returns Profile instance or null
594
807
  */
595
- async getProfile() {
596
- if (!this.profileId) return null;
808
+ async getOrganizer() {
809
+ if (!this.organizerId) return null;
597
810
  try {
598
811
  const { ProfileCollection } = await import("@happyvertical/smrt-profiles");
599
- return await (await ProfileCollection.create(this.options)).get({ id: this.profileId });
812
+ return await (await ProfileCollection.create(this.options)).get({ id: this.organizerId });
600
813
  } catch {
601
814
  return null;
602
815
  }
603
816
  }
604
817
  /**
605
- * Get group participants (others with same groupId)
606
- *
607
- * @returns Array of EventParticipant instances
608
- */
609
- async getGroupParticipants() {
610
- if (!this.groupId) return [];
611
- const { EventParticipantCollection } = await Promise.resolve().then(() => EventParticipantCollection_exports);
612
- return (await (await EventParticipantCollection.create(this.options)).list({ where: {
613
- eventId: this.eventId,
614
- groupId: this.groupId
615
- } })).filter((p) => p.id !== this.id);
616
- }
617
- /**
618
- * Check if this is a home participant (placement = 0)
818
+ * Get all events in this series
619
819
  *
620
- * @returns True if placement is 0
820
+ * @returns Array of Event instances
621
821
  */
622
- isHome() {
623
- return this.placement === 0;
822
+ async getEvents() {
823
+ const { EventCollection } = await Promise.resolve().then(() => EventCollection_exports);
824
+ return await (await EventCollection.create(this.options)).list({ where: { seriesId: this.id } });
624
825
  }
625
826
  /**
626
- * Check if this is an away participant (placement = 1)
827
+ * Check if series is currently active
627
828
  *
628
- * @returns True if placement is 1
829
+ * @returns True if current date is between start and end
629
830
  */
630
- isAway() {
631
- return this.placement === 1;
831
+ isActive() {
832
+ const now = /* @__PURE__ */ new Date();
833
+ if (this.startDate && now < this.startDate) return false;
834
+ if (this.endDate && now > this.endDate) return false;
835
+ return true;
632
836
  }
633
837
  };
634
- __decorateClass$3([tenantId({ nullable: true })], EventParticipant.prototype, "tenantId", 2);
635
- __decorateClass$3([foreignKey("Event")], EventParticipant.prototype, "eventId", 2);
636
- __decorateClass$3([crossPackageRef("@happyvertical/smrt-profiles:Profile")], EventParticipant.prototype, "profileId", 2);
637
- EventParticipant = __decorateClass$3([TenantScoped({ mode: "optional" }), smrt({
638
- conflictColumns: [
639
- "event_id",
640
- "profile_id",
641
- "role"
642
- ],
838
+ __decorateClass$5([tenantId({ nullable: true })], EventSeries.prototype, "tenantId", 2);
839
+ __decorateClass$5([foreignKey("EventType")], EventSeries.prototype, "typeId", 2);
840
+ __decorateClass$5([crossPackageRef("@happyvertical/smrt-profiles:Profile")], EventSeries.prototype, "organizerId", 2);
841
+ EventSeries = __decorateClass$5([TenantScoped({ mode: "optional" }), smrt({
842
+ tableStrategy: "sti",
643
843
  api: { include: [
644
844
  "list",
645
845
  "get",
@@ -654,139 +854,437 @@ EventParticipant = __decorateClass$3([TenantScoped({ mode: "optional" }), smrt({
654
854
  "update"
655
855
  ] },
656
856
  cli: { skipApiCheck: true }
657
- })], EventParticipant);
857
+ })], EventSeries);
658
858
  //#endregion
659
- //#region src/collections/EventParticipantCollection.ts
660
- var EventParticipantCollection_exports = /* @__PURE__ */ __exportAll({ EventParticipantCollection: () => EventParticipantCollection });
661
- var __defProp$2 = Object.defineProperty;
662
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
663
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
664
- enumerable: true,
665
- configurable: true,
666
- writable: true,
667
- value
668
- }) : obj[key] = value;
669
- var __decorateClass$2 = (decorators, target, key, kind) => {
670
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
671
- for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
672
- if (kind && result) __defProp$2(target, key, result);
673
- return result;
674
- };
675
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
676
- var EventParticipantCollection = class extends SmrtJunction {
677
- leftField = "eventId";
678
- rightField = "profileId";
679
- sortField = null;
680
- positionField = null;
681
- /**
682
- * Get participants ordered by placement (nulls last).
683
- */
684
- async getByPlacement(eventId) {
685
- return (await this.byLeft(eventId)).sort((a, b) => {
686
- if (a.placement === null && b.placement === null) return 0;
687
- if (a.placement === null) return 1;
688
- if (b.placement === null) return -1;
689
- return a.placement - b.placement;
690
- });
691
- }
859
+ //#region src/collections/EventSeriesCollection.ts
860
+ var EventSeriesCollection_exports = /* @__PURE__ */ __exportAll({ EventSeriesCollection: () => EventSeriesCollection });
861
+ var EventSeriesCollection = class extends SmrtCollection {
862
+ static _itemClass = EventSeries;
692
863
  /**
693
- * Get participants by group within an event.
864
+ * Get series by organizer
865
+ *
866
+ * @param organizerId - Profile ID of the organizer
867
+ * @returns Array of EventSeries instances
694
868
  */
695
- async getByGroup(eventId, groupId) {
696
- return this.byLeft(eventId, { groupId });
869
+ async getByOrganizer(organizerId) {
870
+ return await this.list({ where: { organizerId } });
697
871
  }
698
872
  /**
699
- * Get the home participant(s) — placement = 0.
873
+ * Get currently active series
874
+ *
875
+ * @returns Array of EventSeries instances active today
700
876
  */
701
- async getHome(eventId) {
702
- return this.byLeft(eventId, { placement: 0 });
877
+ async getActive() {
878
+ const allSeries = await this.list({});
879
+ const now = /* @__PURE__ */ new Date();
880
+ return allSeries.filter((series) => {
881
+ if (series.startDate && now < series.startDate) return false;
882
+ if (series.endDate && now > series.endDate) return false;
883
+ return true;
884
+ });
703
885
  }
704
886
  /**
705
- * Get the away participant(s) — placement = 1.
887
+ * Get upcoming series
888
+ *
889
+ * @param limit - Maximum number of series to return
890
+ * @returns Array of EventSeries instances starting in the future
706
891
  */
707
- async getAway(eventId) {
708
- return this.byLeft(eventId, { placement: 1 });
892
+ async getUpcoming(limit) {
893
+ const allSeries = await this.list({});
894
+ const now = /* @__PURE__ */ new Date();
895
+ const upcoming = allSeries.filter((series) => series.startDate && series.startDate > now).sort((a, b) => {
896
+ if (!a.startDate || !b.startDate) return 0;
897
+ return a.startDate.getTime() - b.startDate.getTime();
898
+ });
899
+ return limit ? upcoming.slice(0, limit) : upcoming;
709
900
  }
710
901
  /**
711
- * Search participants with optional filters.
902
+ * Get series by type
903
+ *
904
+ * @param typeId - EventType ID
905
+ * @returns Array of EventSeries instances
712
906
  */
713
- async search(filters) {
714
- let participants = await this.list({});
715
- if (filters.eventId) participants = participants.filter((p) => p.eventId === filters.eventId);
716
- if (filters.profileId) participants = participants.filter((p) => p.profileId === filters.profileId);
717
- if (filters.role) participants = participants.filter((p) => p.role === filters.role);
718
- if (filters.groupId) participants = participants.filter((p) => p.groupId === filters.groupId);
719
- return participants;
907
+ async getByType(typeId) {
908
+ return await this.list({ where: { typeId } });
720
909
  }
721
910
  /**
722
- * Get participation statistics for a profile, optionally filtered by event type.
911
+ * Search series with filters
912
+ *
913
+ * @param query - Search query for name/description
914
+ * @param filters - Additional filter criteria
915
+ * @returns Array of matching EventSeries instances
723
916
  */
724
- async getParticipantStats(profileId, eventTypeId) {
725
- const participants = await this.byRight(profileId);
726
- let filteredParticipants = participants;
727
- if (eventTypeId) {
728
- filteredParticipants = [];
729
- for (const participant of participants) {
730
- const event = await participant.getEvent();
731
- if (event && event.typeId === eventTypeId) filteredParticipants.push(participant);
732
- }
917
+ async search(query, filters) {
918
+ let series = await this.list({});
919
+ if (query) {
920
+ const lowerQuery = query.toLowerCase();
921
+ series = series.filter((s) => s.name?.toLowerCase().includes(lowerQuery) || s.description?.toLowerCase().includes(lowerQuery));
733
922
  }
734
- const byRole = {};
735
- const byPlacement = {};
736
- for (const participant of filteredParticipants) {
737
- byRole[participant.role] = (byRole[participant.role] || 0) + 1;
738
- if (participant.placement !== null) byPlacement[participant.placement] = (byPlacement[participant.placement] || 0) + 1;
923
+ if (filters) {
924
+ if (filters.typeId) series = series.filter((s) => s.typeId === filters.typeId);
925
+ if (filters.organizerId) series = series.filter((s) => s.organizerId === filters.organizerId);
926
+ if (filters.startDate) {
927
+ const startDate = filters.startDate;
928
+ series = series.filter((s) => s.startDate && s.startDate >= startDate);
929
+ }
930
+ if (filters.endDate) {
931
+ const endDate = filters.endDate;
932
+ series = series.filter((s) => s.endDate && s.endDate <= endDate);
933
+ }
739
934
  }
740
- return {
741
- totalEvents: filteredParticipants.length,
742
- byRole,
743
- byPlacement
744
- };
935
+ return series;
745
936
  }
937
+ /**
938
+ * Find all event series for a specific tenant
939
+ *
940
+ * @param tenantId - Tenant ID to filter by
941
+ * @returns Array of EventSeries instances for the tenant
942
+ */
746
943
  async findByTenant(tenantId) {
747
944
  return this.list({ where: { tenantId } });
748
945
  }
749
946
  /**
750
- * Find all global participants (no tenant association).
947
+ * Find all global event series (no tenant association).
751
948
  *
752
949
  * Routes through the shared tenant-global helper so it does not throw under
753
950
  * an active tenant context (an explicit `tenant_id IS NULL` filter would be
754
951
  * flagged as an isolation violation). (#1600)
952
+ *
953
+ * @returns Array of EventSeries instances with no tenant
755
954
  */
756
955
  async findGlobal() {
757
956
  return queryGlobal(this);
758
957
  }
759
958
  /**
760
- * Find participants for a tenant plus all global participants.
959
+ * Find event series for a tenant including global series.
761
960
  *
762
961
  * Fails closed if an active tenant context requests a different tenant's
763
962
  * rows; the admin/system path keeps the cross-tenant capability. (#1600)
963
+ *
964
+ * @param tenantId - Tenant ID to filter by
965
+ * @returns Array of EventSeries instances for the tenant and global series
764
966
  */
765
967
  async findWithGlobals(tenantId) {
766
- return queryWithGlobals(this, tenantId, "EventParticipant.findWithGlobals");
968
+ return queryWithGlobals(this, tenantId, "EventSeries.findWithGlobals");
767
969
  }
768
970
  };
769
- __publicField(EventParticipantCollection, "_itemClass", EventParticipant);
770
- EventParticipantCollection = __decorateClass$2([smrt()], EventParticipantCollection);
771
971
  //#endregion
772
- //#region src/models/EventSeries.ts
773
- var __defProp$1 = Object.defineProperty;
774
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
775
- var __decorateClass$1 = (decorators, target, key, kind) => {
776
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
972
+ //#region src/calendar/sync.ts
973
+ function stableId(...parts) {
974
+ const hex = createHash("sha256").update(JSON.stringify(parts)).digest("hex");
975
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-5${hex.slice(13, 16)}-a${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
976
+ }
977
+ function identityKey(entry) {
978
+ return JSON.stringify([entry.identity.uid, entry.identity.recurrenceId ?? null]);
979
+ }
980
+ function versionFrom(event) {
981
+ const calendar = event.getMetadata().calendar;
982
+ if (!calendar || typeof calendar !== "object") return {
983
+ sequence: null,
984
+ dtstamp: null
985
+ };
986
+ const record = calendar;
987
+ return {
988
+ sequence: typeof record.sequence === "number" ? record.sequence : null,
989
+ dtstamp: typeof record.dtstamp === "string" ? record.dtstamp : null
990
+ };
991
+ }
992
+ function isNewer(entry, existing) {
993
+ const previous = versionFrom(existing);
994
+ if ((entry.sequence ?? 0) > (previous.sequence ?? 0)) return true;
995
+ return (entry.dtstamp?.toISOString() ?? "") > (previous.dtstamp ?? "");
996
+ }
997
+ function applyEvent(event, entry, seriesId, tenantId) {
998
+ event.tenantId = tenantId;
999
+ event.seriesId = seriesId;
1000
+ event.name = entry.name || (entry.status === "cancelled" ? event.name : "");
1001
+ event.description = entry.description || (entry.status === "cancelled" ? event.description : "");
1002
+ event.startDate = entry.startDate ?? event.startDate;
1003
+ event.endDate = entry.endDate ?? event.endDate;
1004
+ if (entry.startDate) {
1005
+ event.allDay = entry.allDay;
1006
+ event.timeZone = entry.timeZone;
1007
+ }
1008
+ event.status = entry.status;
1009
+ event.source = entry.identity.source;
1010
+ event.externalId = entry.identity.uid;
1011
+ event.setMetadata({
1012
+ ...event.getMetadata(),
1013
+ calendar: {
1014
+ uid: entry.identity.uid,
1015
+ detached: entry.detached ?? false,
1016
+ recurrenceId: entry.identity.recurrenceId ?? null,
1017
+ sequence: entry.sequence,
1018
+ dtstamp: entry.dtstamp?.toISOString() ?? null,
1019
+ rrule: entry.recurrence,
1020
+ exdate: entry.excludedRecurrenceIds,
1021
+ rdate: entry.additionalRecurrenceIds
1022
+ }
1023
+ });
1024
+ }
1025
+ async function retainCalendarMasters(series, options) {
1026
+ const parsed = parseICalendarEvents(options.source, options.ics, options.parse);
1027
+ const components = parseICalendar(options.ics, options.parse?.limits).component.getAllSubcomponents("vevent");
1028
+ const calendar = new ICAL.Component("vcalendar");
1029
+ for (let index = 0; index < parsed.length; index++) {
1030
+ const entry = parsed[index];
1031
+ let component = components[index];
1032
+ if (!entry.detached) {
1033
+ const id = stableId("icalendar-series", options.tenantId ?? "", options.source, entry.identity.uid);
1034
+ let sourceSeries = await series.get({ id });
1035
+ if (!sourceSeries) sourceSeries = await series.create({
1036
+ id,
1037
+ tenantId: options.tenantId ?? null,
1038
+ name: entry.name,
1039
+ source: options.source,
1040
+ externalId: entry.identity.uid
1041
+ });
1042
+ const previous = sourceSeries.getMetadata().calendar;
1043
+ const record = previous && typeof previous === "object" ? previous : {};
1044
+ if (typeof record.masterIcs === "string" && !isNewer(entry, sourceSeries)) {
1045
+ const retained = parseICalendar(record.masterIcs, options.parse?.limits).component.getFirstSubcomponent("vevent");
1046
+ if (!retained) throw new Error("Stored calendar master is missing VEVENT");
1047
+ component = retained;
1048
+ } else {
1049
+ for (const propertyName of [
1050
+ "dtstart",
1051
+ "dtend",
1052
+ "recurrence-id",
1053
+ "rdate",
1054
+ "exdate"
1055
+ ]) for (const property of component.getAllProperties(propertyName)) {
1056
+ const value = property.getFirstValue();
1057
+ if (value instanceof ICAL.Time && !value.isDate && value.zone.tzid === "floating" && !property.getFirstParameter("tzid") && entry.timeZone) property.setParameter("tzid", entry.timeZone);
1058
+ }
1059
+ const document = new ICAL.Component("vcalendar");
1060
+ document.addSubcomponent(component);
1061
+ sourceSeries.name = entry.name || sourceSeries.name;
1062
+ sourceSeries.setMetadata({
1063
+ ...sourceSeries.getMetadata(),
1064
+ calendar: {
1065
+ uid: entry.identity.uid,
1066
+ sequence: entry.sequence,
1067
+ dtstamp: entry.dtstamp?.toISOString() ?? null,
1068
+ cancelled: entry.status === "cancelled" && !entry.startDate,
1069
+ masterIcs: document.toString()
1070
+ }
1071
+ });
1072
+ await sourceSeries.save();
1073
+ }
1074
+ }
1075
+ calendar.addSubcomponent(component);
1076
+ }
1077
+ return calendar.toString();
1078
+ }
1079
+ async function syncParsed(db, options) {
1080
+ const events = await EventCollection.create({ db });
1081
+ const series = await EventSeriesCollection.create({ db });
1082
+ const authoritativeIcs = await retainCalendarMasters(series, options);
1083
+ const entries = options.expansion ? expandICalendarEvents(options.source, authoritativeIcs, {
1084
+ ...options.parse,
1085
+ ...options.expansion
1086
+ }) : parseICalendarEvents(options.source, authoritativeIcs, options.parse);
1087
+ if (!options.expansion && entries.some((entry) => entry.recurrence || entry.additionalRecurrenceIds.length)) throw new Error("Recurring calendar sync requires bounded expansion");
1088
+ const tenantId = options.tenantId ?? null;
1089
+ let created = 0;
1090
+ let updated = 0;
1091
+ let unchanged = 0;
1092
+ for (const entry of entries) {
1093
+ const seriesId = stableId("icalendar-series", tenantId ?? "", options.source, entry.identity.uid);
1094
+ let sourceSeries = await series.get({ id: seriesId });
1095
+ if (!sourceSeries) {
1096
+ sourceSeries = await series.create({
1097
+ id: seriesId,
1098
+ tenantId,
1099
+ name: entry.name,
1100
+ source: options.source,
1101
+ externalId: entry.identity.uid
1102
+ });
1103
+ sourceSeries.setMetadata({ calendar: { uid: entry.identity.uid } });
1104
+ await sourceSeries.save();
1105
+ }
1106
+ if (entry.status === "cancelled" && !entry.startDate && !entry.identity.recurrenceId) {
1107
+ const affected = await events.list({ where: {
1108
+ seriesId,
1109
+ tenantId
1110
+ } });
1111
+ for (const event2 of affected) {
1112
+ if (!isNewer(entry, event2)) {
1113
+ unchanged++;
1114
+ continue;
1115
+ }
1116
+ event2.status = "cancelled";
1117
+ const calendar = event2.getMetadata().calendar;
1118
+ event2.setMetadata({
1119
+ ...event2.getMetadata(),
1120
+ calendar: {
1121
+ ...calendar && typeof calendar === "object" ? calendar : {},
1122
+ sequence: entry.sequence,
1123
+ dtstamp: entry.dtstamp?.toISOString() ?? null
1124
+ }
1125
+ });
1126
+ await event2.save();
1127
+ updated++;
1128
+ }
1129
+ if (!("cancelled" in sourceSeries.getMetadata().calendar) || isNewer(entry, sourceSeries)) {
1130
+ sourceSeries.setMetadata({
1131
+ ...sourceSeries.getMetadata(),
1132
+ calendar: {
1133
+ ...sourceSeries.getMetadata().calendar,
1134
+ uid: entry.identity.uid,
1135
+ cancelled: true,
1136
+ sequence: entry.sequence,
1137
+ dtstamp: entry.dtstamp?.toISOString() ?? null
1138
+ }
1139
+ });
1140
+ await sourceSeries.save();
1141
+ }
1142
+ continue;
1143
+ }
1144
+ const id = stableId("icalendar-event", tenantId ?? "", options.source, identityKey(entry));
1145
+ const existing = await events.get({ id });
1146
+ const sourceCalendar = sourceSeries.getMetadata().calendar;
1147
+ if (sourceCalendar && typeof sourceCalendar === "object" && "cancelled" in sourceCalendar && sourceCalendar.cancelled === true && !isNewer(entry, sourceSeries)) {
1148
+ unchanged++;
1149
+ continue;
1150
+ }
1151
+ const previousCalendar = existing?.getMetadata().calendar;
1152
+ const existingDetached = previousCalendar && typeof previousCalendar === "object" && "detached" in previousCalendar && previousCalendar.detached === true;
1153
+ if (existing && (existingDetached && !entry.detached || !isNewer(entry, existing))) {
1154
+ unchanged += 1;
1155
+ continue;
1156
+ }
1157
+ const event = existing ?? await events.create({ id });
1158
+ applyEvent(event, entry, seriesId, tenantId);
1159
+ await event.save();
1160
+ if (existing) updated += 1;
1161
+ else created += 1;
1162
+ }
1163
+ return {
1164
+ created,
1165
+ updated,
1166
+ unchanged,
1167
+ retainedOnOmission: true
1168
+ };
1169
+ }
1170
+ async function syncICalendarSource(options) {
1171
+ if (!options.db) throw new Error("Calendar source sync requires a database");
1172
+ const activeTenant = getTenantId();
1173
+ const tenantId = options.tenantId === void 0 ? activeTenant ?? null : options.tenantId;
1174
+ if (activeTenant && activeTenant !== tenantId) throw new Error("Calendar tenant isolation violation");
1175
+ const entries = parseICalendarEvents(options.source, options.ics, options.parse);
1176
+ if (!options.expansion && entries.some((e) => e.recurrence || e.additionalRecurrenceIds.length)) throw new Error("Recurring calendar sync requires bounded expansion");
1177
+ const db = await getDatabase(options.db);
1178
+ if (db.requiresSchemaCheck) throw new Error("Calendar sync requires migrated SQLite/PostgreSQL schemas");
1179
+ if (!db.transaction) throw new Error("Calendar source sync requires transaction()");
1180
+ return db.transaction((transaction) => syncParsed(transaction, {
1181
+ ...options,
1182
+ tenantId
1183
+ }));
1184
+ }
1185
+ //#endregion
1186
+ //#region src/models/EventAsset.ts
1187
+ var __defProp$4 = Object.defineProperty;
1188
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1189
+ var __decorateClass$4 = (decorators, target, key, kind) => {
1190
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
777
1191
  for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
778
- if (kind && result) __defProp$1(target, key, result);
1192
+ if (kind && result) __defProp$4(target, key, result);
779
1193
  return result;
780
1194
  };
781
- var EventSeries = class extends SmrtObject {
1195
+ var EventAsset = class extends SmrtObject {
782
1196
  tenantId = null;
783
- name = "";
784
- typeId = "";
785
- organizerId = "";
786
- description = "";
787
- startDate = null;
788
- endDate = null;
789
- recurrence = "";
1197
+ eventId = "";
1198
+ assetId = "";
1199
+ relationship = "attachment";
1200
+ sortOrder = 0;
1201
+ constructor(options = {}) {
1202
+ super(options);
1203
+ if (options.eventId) this.eventId = options.eventId;
1204
+ if (options.assetId) this.assetId = options.assetId;
1205
+ if (options.relationship) this.relationship = options.relationship;
1206
+ if (options.sortOrder !== void 0) this.sortOrder = options.sortOrder;
1207
+ if (options.tenantId !== void 0) this.tenantId = options.tenantId;
1208
+ }
1209
+ };
1210
+ __decorateClass$4([tenantId({ nullable: true })], EventAsset.prototype, "tenantId", 2);
1211
+ __decorateClass$4([foreignKey("Event", { required: true })], EventAsset.prototype, "eventId", 2);
1212
+ __decorateClass$4([crossPackageRef("@happyvertical/smrt-assets:Asset", { required: true })], EventAsset.prototype, "assetId", 2);
1213
+ __decorateClass$4([field({ required: true })], EventAsset.prototype, "relationship", 2);
1214
+ __decorateClass$4([field()], EventAsset.prototype, "sortOrder", 2);
1215
+ EventAsset = __decorateClass$4([TenantScoped({ mode: "optional" }), smrt({
1216
+ tableName: "event_assets",
1217
+ conflictColumns: [
1218
+ "event_id",
1219
+ "asset_id",
1220
+ "relationship"
1221
+ ],
1222
+ api: false,
1223
+ mcp: false,
1224
+ cli: false
1225
+ })], EventAsset);
1226
+ //#endregion
1227
+ //#region src/collections/EventAssetCollection.ts
1228
+ var EventAssetCollection_exports = /* @__PURE__ */ __exportAll({ EventAssetCollection: () => EventAssetCollection });
1229
+ var __defProp$3 = Object.defineProperty;
1230
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
1231
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
1232
+ enumerable: true,
1233
+ configurable: true,
1234
+ writable: true,
1235
+ value
1236
+ }) : obj[key] = value;
1237
+ var __decorateClass$3 = (decorators, target, key, kind) => {
1238
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
1239
+ for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1240
+ if (kind && result) __defProp$3(target, key, result);
1241
+ return result;
1242
+ };
1243
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
1244
+ var EventAssetCollection = class extends SmrtJunction {
1245
+ leftField = "eventId";
1246
+ rightField = "assetId";
1247
+ eventCollectionPromise = null;
1248
+ async getEventCollection() {
1249
+ if (!this.eventCollectionPromise) {
1250
+ const { EventCollection } = await Promise.resolve().then(() => EventCollection_exports);
1251
+ this.eventCollectionPromise = EventCollection.create({ db: this.db });
1252
+ }
1253
+ return this.eventCollectionPromise;
1254
+ }
1255
+ async getAssets(eventId, relationship) {
1256
+ return getOwnedAssetsFromCollection(await this.getEventCollection(), eventId, relationship);
1257
+ }
1258
+ async addAsset(eventId, asset, relationship = "attachment", sortOrder = 0) {
1259
+ await addOwnedAssetFromCollection(await this.getEventCollection(), "Event", eventId, asset, relationship, sortOrder);
1260
+ }
1261
+ async removeAsset(eventId, assetId, relationship) {
1262
+ await removeOwnedAssetFromCollection(await this.getEventCollection(), "Event", eventId, assetId, relationship);
1263
+ }
1264
+ };
1265
+ __publicField$1(EventAssetCollection, "_itemClass", EventAsset);
1266
+ EventAssetCollection = __decorateClass$3([smrt({
1267
+ api: false,
1268
+ mcp: false,
1269
+ cli: false
1270
+ })], EventAssetCollection);
1271
+ //#endregion
1272
+ //#region src/models/EventParticipant.ts
1273
+ var __defProp$2 = Object.defineProperty;
1274
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
1275
+ var __decorateClass$2 = (decorators, target, key, kind) => {
1276
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
1277
+ for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1278
+ if (kind && result) __defProp$2(target, key, result);
1279
+ return result;
1280
+ };
1281
+ var EventParticipant = class extends SmrtObject {
1282
+ tenantId = null;
1283
+ eventId = "";
1284
+ profileId = "";
1285
+ role = "";
1286
+ placement = null;
1287
+ groupId = "";
790
1288
  metadata = "";
791
1289
  externalId = "";
792
1290
  source = "";
@@ -794,65 +1292,19 @@ var EventSeries = class extends SmrtObject {
794
1292
  updatedAt = /* @__PURE__ */ new Date();
795
1293
  constructor(options = {}) {
796
1294
  super(options);
797
- if (options.typeId) this.typeId = options.typeId;
798
- if (options.organizerId) this.organizerId = options.organizerId;
799
- if (options.description !== void 0) this.description = options.description;
800
- if (options.startDate !== void 0) this.startDate = options.startDate || null;
801
- if (options.endDate !== void 0) this.endDate = options.endDate || null;
1295
+ if (options.eventId) this.eventId = options.eventId;
1296
+ if (options.profileId) this.profileId = options.profileId;
1297
+ if (options.role !== void 0) this.role = options.role;
1298
+ if (options.placement !== void 0) this.placement = options.placement;
1299
+ if (options.groupId !== void 0) this.groupId = options.groupId;
802
1300
  if (options.externalId !== void 0) this.externalId = options.externalId;
803
1301
  if (options.source !== void 0) this.source = options.source;
804
- if (options.recurrence !== void 0) if (typeof options.recurrence === "string") this.recurrence = options.recurrence;
805
- else this.recurrence = JSON.stringify(options.recurrence);
806
1302
  if (options.metadata !== void 0) if (typeof options.metadata === "string") this.metadata = options.metadata;
807
1303
  else this.metadata = JSON.stringify(options.metadata);
808
1304
  if (options.createdAt) this.createdAt = options.createdAt;
809
1305
  if (options.updatedAt) this.updatedAt = options.updatedAt;
810
1306
  }
811
1307
  /**
812
- * Get recurrence pattern as parsed object
813
- *
814
- * @returns Parsed recurrence pattern or null
815
- */
816
- getRecurrence() {
817
- if (!this.recurrence) return null;
818
- try {
819
- return JSON.parse(this.recurrence);
820
- } catch {
821
- return null;
822
- }
823
- }
824
- /**
825
- * Set recurrence pattern from object
826
- *
827
- * @param pattern - Recurrence pattern to store
828
- */
829
- setRecurrence(pattern) {
830
- this.recurrence = JSON.stringify(pattern);
831
- }
832
- /**
833
- * Expand this series' recurrence into occurrence start instants within a
834
- * window. The first occurrence is `startDate` (or `options.start`); its
835
- * wall-clock time in the time zone is kept for every occurrence, and
836
- * `endDate` caps the series like an inclusive `until`.
837
- *
838
- * @param rangeStart - Inclusive window start
839
- * @param rangeEnd - Inclusive window end
840
- * @param options - Time zone (defaults to the pattern's `timeZone`, then UTC) and optional first occurrence
841
- * @returns Occurrence start instants, or an empty array without a pattern or start
842
- */
843
- getOccurrences(rangeStart, rangeEnd, options = {}) {
844
- const pattern = this.getRecurrence();
845
- const start = options.start ?? this.startDate;
846
- if (!pattern || !start) return [];
847
- return expandRecurrence(pattern, {
848
- start,
849
- rangeStart,
850
- rangeEnd: this.endDate && this.endDate.getTime() < rangeEnd.getTime() ? this.endDate : rangeEnd,
851
- timeZone: options.timeZone,
852
- limit: options.limit
853
- });
854
- }
855
- /**
856
1308
  * Get metadata as parsed object
857
1309
  *
858
1310
  * @returns Parsed metadata object or empty object
@@ -886,55 +1338,68 @@ var EventSeries = class extends SmrtObject {
886
1338
  });
887
1339
  }
888
1340
  /**
889
- * Get the event type for this series
1341
+ * Get the event for this participant
890
1342
  *
891
- * @returns EventType instance or null
1343
+ * @returns Event instance or null
892
1344
  */
893
- async getType() {
894
- if (!this.typeId) return null;
895
- const { EventTypeCollection } = await Promise.resolve().then(() => EventTypeCollection_exports);
896
- return await (await EventTypeCollection.create(this.options)).get({ id: this.typeId });
1345
+ async getEvent() {
1346
+ if (!this.eventId) return null;
1347
+ const { EventCollection } = await Promise.resolve().then(() => EventCollection_exports);
1348
+ return await (await EventCollection.create(this.options)).get({ id: this.eventId });
897
1349
  }
898
1350
  /**
899
- * Get the organizer profile for this series
1351
+ * Get the profile for this participant
900
1352
  *
901
1353
  * @returns Profile instance or null
902
1354
  */
903
- async getOrganizer() {
904
- if (!this.organizerId) return null;
1355
+ async getProfile() {
1356
+ if (!this.profileId) return null;
905
1357
  try {
906
1358
  const { ProfileCollection } = await import("@happyvertical/smrt-profiles");
907
- return await (await ProfileCollection.create(this.options)).get({ id: this.organizerId });
1359
+ return await (await ProfileCollection.create(this.options)).get({ id: this.profileId });
908
1360
  } catch {
909
1361
  return null;
910
1362
  }
911
1363
  }
912
1364
  /**
913
- * Get all events in this series
1365
+ * Get group participants (others with same groupId)
914
1366
  *
915
- * @returns Array of Event instances
1367
+ * @returns Array of EventParticipant instances
916
1368
  */
917
- async getEvents() {
918
- const { EventCollection } = await Promise.resolve().then(() => EventCollection_exports);
919
- return await (await EventCollection.create(this.options)).list({ where: { seriesId: this.id } });
1369
+ async getGroupParticipants() {
1370
+ if (!this.groupId) return [];
1371
+ const { EventParticipantCollection } = await Promise.resolve().then(() => EventParticipantCollection_exports);
1372
+ return (await (await EventParticipantCollection.create(this.options)).list({ where: {
1373
+ eventId: this.eventId,
1374
+ groupId: this.groupId
1375
+ } })).filter((p) => p.id !== this.id);
920
1376
  }
921
1377
  /**
922
- * Check if series is currently active
1378
+ * Check if this is a home participant (placement = 0)
923
1379
  *
924
- * @returns True if current date is between start and end
1380
+ * @returns True if placement is 0
925
1381
  */
926
- isActive() {
927
- const now = /* @__PURE__ */ new Date();
928
- if (this.startDate && now < this.startDate) return false;
929
- if (this.endDate && now > this.endDate) return false;
930
- return true;
1382
+ isHome() {
1383
+ return this.placement === 0;
1384
+ }
1385
+ /**
1386
+ * Check if this is an away participant (placement = 1)
1387
+ *
1388
+ * @returns True if placement is 1
1389
+ */
1390
+ isAway() {
1391
+ return this.placement === 1;
931
1392
  }
932
1393
  };
933
- __decorateClass$1([tenantId({ nullable: true })], EventSeries.prototype, "tenantId", 2);
934
- __decorateClass$1([foreignKey("EventType")], EventSeries.prototype, "typeId", 2);
935
- __decorateClass$1([crossPackageRef("@happyvertical/smrt-profiles:Profile")], EventSeries.prototype, "organizerId", 2);
936
- EventSeries = __decorateClass$1([TenantScoped({ mode: "optional" }), smrt({
937
- tableStrategy: "sti",
1394
+ __decorateClass$2([tenantId({ nullable: true })], EventParticipant.prototype, "tenantId", 2);
1395
+ __decorateClass$2([foreignKey("Event")], EventParticipant.prototype, "eventId", 2);
1396
+ __decorateClass$2([crossPackageRef("@happyvertical/smrt-profiles:Profile")], EventParticipant.prototype, "profileId", 2);
1397
+ EventParticipant = __decorateClass$2([TenantScoped({ mode: "optional" }), smrt({
1398
+ conflictColumns: [
1399
+ "event_id",
1400
+ "profile_id",
1401
+ "role"
1402
+ ],
938
1403
  api: { include: [
939
1404
  "list",
940
1405
  "get",
@@ -949,120 +1414,120 @@ EventSeries = __decorateClass$1([TenantScoped({ mode: "optional" }), smrt({
949
1414
  "update"
950
1415
  ] },
951
1416
  cli: { skipApiCheck: true }
952
- })], EventSeries);
1417
+ })], EventParticipant);
953
1418
  //#endregion
954
- //#region src/collections/EventSeriesCollection.ts
955
- var EventSeriesCollection_exports = /* @__PURE__ */ __exportAll({ EventSeriesCollection: () => EventSeriesCollection });
956
- var EventSeriesCollection = class extends SmrtCollection {
957
- static _itemClass = EventSeries;
1419
+ //#region src/collections/EventParticipantCollection.ts
1420
+ var EventParticipantCollection_exports = /* @__PURE__ */ __exportAll({ EventParticipantCollection: () => EventParticipantCollection });
1421
+ var __defProp$1 = Object.defineProperty;
1422
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
1423
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
1424
+ enumerable: true,
1425
+ configurable: true,
1426
+ writable: true,
1427
+ value
1428
+ }) : obj[key] = value;
1429
+ var __decorateClass$1 = (decorators, target, key, kind) => {
1430
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
1431
+ for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1432
+ if (kind && result) __defProp$1(target, key, result);
1433
+ return result;
1434
+ };
1435
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1436
+ var EventParticipantCollection = class extends SmrtJunction {
1437
+ leftField = "eventId";
1438
+ rightField = "profileId";
1439
+ sortField = null;
1440
+ positionField = null;
958
1441
  /**
959
- * Get series by organizer
960
- *
961
- * @param organizerId - Profile ID of the organizer
962
- * @returns Array of EventSeries instances
1442
+ * Get participants ordered by placement (nulls last).
963
1443
  */
964
- async getByOrganizer(organizerId) {
965
- return await this.list({ where: { organizerId } });
1444
+ async getByPlacement(eventId) {
1445
+ return (await this.byLeft(eventId)).sort((a, b) => {
1446
+ if (a.placement === null && b.placement === null) return 0;
1447
+ if (a.placement === null) return 1;
1448
+ if (b.placement === null) return -1;
1449
+ return a.placement - b.placement;
1450
+ });
966
1451
  }
967
1452
  /**
968
- * Get currently active series
969
- *
970
- * @returns Array of EventSeries instances active today
1453
+ * Get participants by group within an event.
971
1454
  */
972
- async getActive() {
973
- const allSeries = await this.list({});
974
- const now = /* @__PURE__ */ new Date();
975
- return allSeries.filter((series) => {
976
- if (series.startDate && now < series.startDate) return false;
977
- if (series.endDate && now > series.endDate) return false;
978
- return true;
979
- });
1455
+ async getByGroup(eventId, groupId) {
1456
+ return this.byLeft(eventId, { groupId });
980
1457
  }
981
1458
  /**
982
- * Get upcoming series
983
- *
984
- * @param limit - Maximum number of series to return
985
- * @returns Array of EventSeries instances starting in the future
1459
+ * Get the home participant(s) — placement = 0.
986
1460
  */
987
- async getUpcoming(limit) {
988
- const allSeries = await this.list({});
989
- const now = /* @__PURE__ */ new Date();
990
- const upcoming = allSeries.filter((series) => series.startDate && series.startDate > now).sort((a, b) => {
991
- if (!a.startDate || !b.startDate) return 0;
992
- return a.startDate.getTime() - b.startDate.getTime();
993
- });
994
- return limit ? upcoming.slice(0, limit) : upcoming;
1461
+ async getHome(eventId) {
1462
+ return this.byLeft(eventId, { placement: 0 });
995
1463
  }
996
1464
  /**
997
- * Get series by type
998
- *
999
- * @param typeId - EventType ID
1000
- * @returns Array of EventSeries instances
1465
+ * Get the away participant(s) — placement = 1.
1001
1466
  */
1002
- async getByType(typeId) {
1003
- return await this.list({ where: { typeId } });
1467
+ async getAway(eventId) {
1468
+ return this.byLeft(eventId, { placement: 1 });
1004
1469
  }
1005
1470
  /**
1006
- * Search series with filters
1007
- *
1008
- * @param query - Search query for name/description
1009
- * @param filters - Additional filter criteria
1010
- * @returns Array of matching EventSeries instances
1471
+ * Search participants with optional filters.
1011
1472
  */
1012
- async search(query, filters) {
1013
- let series = await this.list({});
1014
- if (query) {
1015
- const lowerQuery = query.toLowerCase();
1016
- series = series.filter((s) => s.name?.toLowerCase().includes(lowerQuery) || s.description?.toLowerCase().includes(lowerQuery));
1017
- }
1018
- if (filters) {
1019
- if (filters.typeId) series = series.filter((s) => s.typeId === filters.typeId);
1020
- if (filters.organizerId) series = series.filter((s) => s.organizerId === filters.organizerId);
1021
- if (filters.startDate) {
1022
- const startDate = filters.startDate;
1023
- series = series.filter((s) => s.startDate && s.startDate >= startDate);
1024
- }
1025
- if (filters.endDate) {
1026
- const endDate = filters.endDate;
1027
- series = series.filter((s) => s.endDate && s.endDate <= endDate);
1028
- }
1029
- }
1030
- return series;
1473
+ async search(filters) {
1474
+ let participants = await this.list({});
1475
+ if (filters.eventId) participants = participants.filter((p) => p.eventId === filters.eventId);
1476
+ if (filters.profileId) participants = participants.filter((p) => p.profileId === filters.profileId);
1477
+ if (filters.role) participants = participants.filter((p) => p.role === filters.role);
1478
+ if (filters.groupId) participants = participants.filter((p) => p.groupId === filters.groupId);
1479
+ return participants;
1031
1480
  }
1032
1481
  /**
1033
- * Find all event series for a specific tenant
1034
- *
1035
- * @param tenantId - Tenant ID to filter by
1036
- * @returns Array of EventSeries instances for the tenant
1482
+ * Get participation statistics for a profile, optionally filtered by event type.
1037
1483
  */
1484
+ async getParticipantStats(profileId, eventTypeId) {
1485
+ const participants = await this.byRight(profileId);
1486
+ let filteredParticipants = participants;
1487
+ if (eventTypeId) {
1488
+ filteredParticipants = [];
1489
+ for (const participant of participants) {
1490
+ const event = await participant.getEvent();
1491
+ if (event && event.typeId === eventTypeId) filteredParticipants.push(participant);
1492
+ }
1493
+ }
1494
+ const byRole = {};
1495
+ const byPlacement = {};
1496
+ for (const participant of filteredParticipants) {
1497
+ byRole[participant.role] = (byRole[participant.role] || 0) + 1;
1498
+ if (participant.placement !== null) byPlacement[participant.placement] = (byPlacement[participant.placement] || 0) + 1;
1499
+ }
1500
+ return {
1501
+ totalEvents: filteredParticipants.length,
1502
+ byRole,
1503
+ byPlacement
1504
+ };
1505
+ }
1038
1506
  async findByTenant(tenantId) {
1039
1507
  return this.list({ where: { tenantId } });
1040
1508
  }
1041
1509
  /**
1042
- * Find all global event series (no tenant association).
1510
+ * Find all global participants (no tenant association).
1043
1511
  *
1044
1512
  * Routes through the shared tenant-global helper so it does not throw under
1045
1513
  * an active tenant context (an explicit `tenant_id IS NULL` filter would be
1046
1514
  * flagged as an isolation violation). (#1600)
1047
- *
1048
- * @returns Array of EventSeries instances with no tenant
1049
1515
  */
1050
1516
  async findGlobal() {
1051
1517
  return queryGlobal(this);
1052
1518
  }
1053
1519
  /**
1054
- * Find event series for a tenant including global series.
1520
+ * Find participants for a tenant plus all global participants.
1055
1521
  *
1056
1522
  * Fails closed if an active tenant context requests a different tenant's
1057
1523
  * rows; the admin/system path keeps the cross-tenant capability. (#1600)
1058
- *
1059
- * @param tenantId - Tenant ID to filter by
1060
- * @returns Array of EventSeries instances for the tenant and global series
1061
1524
  */
1062
1525
  async findWithGlobals(tenantId) {
1063
- return queryWithGlobals(this, tenantId, "EventSeries.findWithGlobals");
1526
+ return queryWithGlobals(this, tenantId, "EventParticipant.findWithGlobals");
1064
1527
  }
1065
1528
  };
1529
+ __publicField(EventParticipantCollection, "_itemClass", EventParticipant);
1530
+ EventParticipantCollection = __decorateClass$1([smrt()], EventParticipantCollection);
1066
1531
  //#endregion
1067
1532
  //#region src/models/EventType.ts
1068
1533
  var __defProp = Object.defineProperty;
@@ -1376,6 +1841,6 @@ var EventTypeCollection = class extends SmrtCollection {
1376
1841
  }
1377
1842
  };
1378
1843
  //#endregion
1379
- export { EVENTS_MODULE_META, EVENTS_UI_SLOTS, Event, EventAsset, EventAssetCollection, EventCollection, EventParticipant, EventParticipantCollection, EventSeries, EventSeriesCollection, EventType, EventTypeCollection, calculateDuration, calculateNextOccurrence, checkSchedulingConflict, expandRecurrence, formatDuration, formatEventDateRange, fromZonedWallTime, generateEventSlug, getEventStatusFromDates, isEventNow, isValidTimeZone, parseRecurrencePattern, sortEventsByDate, toZonedWallTime, validateEventStatus };
1844
+ export { CalendarEventValidationError, EVENTS_MODULE_META, EVENTS_UI_SLOTS, Event, EventAsset, EventAssetCollection, EventCollection, EventParticipant, EventParticipantCollection, EventSeries, EventSeriesCollection, EventType, EventTypeCollection, calculateDuration, calculateNextOccurrence, checkSchedulingConflict, expandICalendarEvents, expandRecurrence, formatDuration, formatEventDateRange, fromZonedWallTime, generateEventSlug, getEventStatusFromDates, isEventNow, isValidTimeZone, parseICalendarEvents, parseRecurrencePattern, sortEventsByDate, syncICalendarSource, toZonedWallTime, validateEventStatus };
1380
1845
 
1381
1846
  //# sourceMappingURL=index.js.map