@equationalapplications/core-llm-wiki 8.2.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { BaseRepository, WikiGraphNodeOwnershipConflict, parseJsonObject, parseJsonArray, liveAtSql, reanchorRebuildFingerprint, __privateAdd, warnChangedDefaultsOnce, MetadataRepository, EmbeddingService, SearchService, TemporalService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, createLegacySourceTypeIndex, writeNormalizeStamp, CURRENT_SCHEMA_VERSION, detectSchemaVersion, MIGRATIONS, runSourceRefNormalize, normalizeSourceRef, normalizeSourceHash, resolveLibrarianStrategy, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, MAX_EMBED_ATTEMPTS, UsageMeter, isWikiSearchUnavailableError, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, probePendingWork, WikiMigrationRequiredError, setupDatabase, UnavailableIndexStrategy, createdAtValue, isUsableDate, assertEntityId, assertEpochMs, FTS5_STATE_KEY, fts5LedgerDropSql, fts5TablesDdl, fts5PendingIndexesDdl, fts5TriggersDdl, writeRebuildStart, FTS5_RETIRED_COUNTER_KEY, retiredTableName, FTS5_RETIRED_TABLES_KEY, isRetiredTableName, idReindexChunkSql, readRebuildProgress, FTS5_DRAIN_CHUNK, FTS5_RECLAIM_MERGE_PAGES, windowHiSql, windowChunkSql, FTS5_REBUILD_WM_KEY, sweepHiSql, sweepChunkSql, FTS5_SWEEP_CURSOR_KEY, drainHiSql, drainChunkSql, FTS5_REBUILD_SNAPSHOT_KEY, idDrainChunkSql, entityDrainHiSql, entityDrainChunkSql, fts5TriggerNames, extractSqliteCode, WikiTransactionError } from './chunk-FOX6TNFO.mjs';
2
- export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, isWikiSearchUnavailableError, parseEmbedding, safeSlice, validateManifest } from './chunk-FOX6TNFO.mjs';
3
- import { deriveTrustTier, isStaleAfter, appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList } from '@equationalapplications/core-okf';
1
+ import { BaseRepository, WikiGraphNodeOwnershipConflict, parseJsonObject, parseJsonArray, liveAtSql, reanchorRebuildFingerprint, __privateAdd, warnChangedDefaultsOnce, EdgeRepository, MetadataRepository, EmbeddingService, SearchService, TemporalService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, createLegacySourceTypeIndex, writeNormalizeStamp, CURRENT_SCHEMA_VERSION, detectSchemaVersion, MIGRATIONS, runSourceRefNormalize, normalizeSourceRef, normalizeSourceHash, resolveLibrarianStrategy, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, MAX_EMBED_ATTEMPTS, UsageMeter, isWikiSearchUnavailableError, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, probePendingWork, WikiMigrationRequiredError, setupDatabase, UnavailableIndexStrategy, createdAtValue, isUsableDate, assertEntityId, assertEpochMs, FTS5_STATE_KEY, fts5LedgerDropSql, fts5TablesDdl, fts5PendingIndexesDdl, fts5TriggersDdl, writeRebuildStart, FTS5_RETIRED_COUNTER_KEY, retiredTableName, FTS5_RETIRED_TABLES_KEY, isRetiredTableName, idReindexChunkSql, readRebuildProgress, FTS5_DRAIN_CHUNK, FTS5_RECLAIM_MERGE_PAGES, windowHiSql, windowChunkSql, FTS5_REBUILD_WM_KEY, sweepHiSql, sweepChunkSql, FTS5_SWEEP_CURSOR_KEY, drainHiSql, drainChunkSql, FTS5_REBUILD_SNAPSHOT_KEY, idDrainChunkSql, entityDrainHiSql, entityDrainChunkSql, fts5TriggerNames, extractSqliteCode, WikiTransactionError } from './chunk-V432RHCG.mjs';
2
+ export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, isWikiSearchUnavailableError, parseEmbedding, safeSlice, validateManifest } from './chunk-V432RHCG.mjs';
3
+ import { deriveTrustTier, isStaleAfter, appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, createEventIdDeriver, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList } from '@equationalapplications/core-okf';
4
4
  import MiniSearch from 'minisearch';
5
5
 
6
6
  // src/db/migrationGate.ts
@@ -1573,6 +1573,19 @@ var SourceRefIndexRepository = class extends BaseRepository {
1573
1573
  [generateId("sri_"), entityId, sourceHash, sourceRef, Date.now()]
1574
1574
  );
1575
1575
  }
1576
+ /**
1577
+ * Hard-delete every row of the entity, live or soft-deleted (forget clearAll,
1578
+ * spec import-followups §6 rev 4). Nothing reads a soft-deleted row and
1579
+ * runPrune never sweeps this table, so a wipe leaves no tombstones.
1580
+ */
1581
+ async deleteByEntityId(entityId, tx) {
1582
+ const executor = this.getExecutor(tx);
1583
+ const result = await executor.runAsync(
1584
+ `DELETE FROM ${this.prefix}source_ref_index WHERE entity_id = ?`,
1585
+ [entityId]
1586
+ );
1587
+ return result.changes;
1588
+ }
1576
1589
  /**
1577
1590
  * Idempotent soft-delete of the live row for (entity_id, source_ref).
1578
1591
  * Called at the start of every ingestDocument to remove the prior run's
@@ -2015,6 +2028,10 @@ var EventRepository = class extends BaseRepository {
2015
2028
  );
2016
2029
  return rows.map(mapEvent);
2017
2030
  }
2031
+ /** Hard-delete every event of the entity, read or not (requested wipe, spec import-followups §6). */
2032
+ async deleteByEntityId(entityId, tx) {
2033
+ return tx.runAsync(`DELETE FROM ${this.prefix}events WHERE entity_id = ?`, [entityId]);
2034
+ }
2018
2035
  /**
2019
2036
  * Delete events for an entity that were created at or before the given cutoff timestamp.
2020
2037
  * Returns the number of deleted rows.
@@ -2160,183 +2177,6 @@ var EventRepository = class extends BaseRepository {
2160
2177
  return row?.total ?? 0;
2161
2178
  }
2162
2179
  };
2163
-
2164
- // src/repositories/EdgeRepository.ts
2165
- var CONFIDENCE_RANK = {
2166
- tentative: 0,
2167
- inferred: 1,
2168
- certain: 2
2169
- };
2170
- var EdgeRepository = class extends BaseRepository {
2171
- /**
2172
- * Insert an edge, silently skipping on primary-key or uniqueness conflicts.
2173
- * Returns true when a row was inserted, false when skipped as a duplicate.
2174
- * Throws when the insert was skipped due to an id collision with a different edge tuple.
2175
- */
2176
- async addIgnoreDuplicate(edge, tx) {
2177
- const executor = this.getExecutor(tx);
2178
- const result = await executor.runAsync(
2179
- `INSERT OR IGNORE INTO ${this.prefix}edges (id, entity_id, source_id, target_id, edge_type, created_at)
2180
- VALUES (?, ?, ?, ?, ?, ?)`,
2181
- [edge.id, edge.entity_id, edge.source_id, edge.target_id, edge.edge_type, edge.created_at]
2182
- );
2183
- if (result.changes > 0) return true;
2184
- const existing = await executor.getFirstAsync(
2185
- `SELECT entity_id, source_id, target_id, edge_type FROM ${this.prefix}edges WHERE id = ?`,
2186
- [edge.id]
2187
- );
2188
- if (!existing) return false;
2189
- if (String(existing.entity_id) !== edge.entity_id || String(existing.source_id) !== edge.source_id || String(existing.target_id) !== edge.target_id || String(existing.edge_type) !== edge.edge_type) {
2190
- throw new Error(
2191
- `Edge id collision: ${JSON.stringify(edge.id)} already exists with a different (entity_id, source_id, target_id, edge_type) tuple`
2192
- );
2193
- }
2194
- return false;
2195
- }
2196
- async getByEntityId(entityId, tx) {
2197
- const executor = this.getExecutor(tx);
2198
- const rows = await executor.getAllAsync(
2199
- `SELECT * FROM ${this.prefix}edges WHERE entity_id = ? ORDER BY created_at ASC`,
2200
- [entityId]
2201
- );
2202
- return rows.map(mapRowToEdge);
2203
- }
2204
- /** Hard delete — edges have no soft-delete concept, only presence/absence. `tx` is REQUIRED. */
2205
- async bulkDeleteByEntityId(entityId, tx) {
2206
- const executor = this.getExecutor(tx);
2207
- await executor.runAsync(`DELETE FROM ${this.prefix}edges WHERE entity_id = ?`, [entityId]);
2208
- }
2209
- /**
2210
- * Hard-delete every edge whose `source_id` is in `sourceFactIds`, scoped to
2211
- * `entityId`. Returns the number of rows deleted. Edges have no soft-delete
2212
- * concept; this method is named `softDeleteBySourceFactIds` for symmetry with
2213
- * `EntryRepository.softDeleteBySource` (which IS a soft delete), but its
2214
- * semantics are immediate presence/absence removal. Use ONLY inside an open
2215
- * transaction — the method requires `tx` and performs no autocommit.
2216
- *
2217
- * Used by `IngestionService.upsertGraphCore` to retire the prior parse's
2218
- * edges whose source facts are being superseded by `softDeleteBySource`.
2219
- */
2220
- async softDeleteBySourceFactIds(entityId, sourceFactIds, tx) {
2221
- if (sourceFactIds.length === 0) return 0;
2222
- const executor = this.getExecutor(tx);
2223
- const chunkSize = 500;
2224
- let totalChanges = 0;
2225
- for (let i = 0; i < sourceFactIds.length; i += chunkSize) {
2226
- const chunk = sourceFactIds.slice(i, i + chunkSize);
2227
- const placeholders = chunk.map(() => "?").join(",");
2228
- const result = await executor.runAsync(
2229
- `DELETE FROM ${this.prefix}edges
2230
- WHERE entity_id = ? AND source_id IN (${placeholders})`,
2231
- [entityId, ...chunk]
2232
- );
2233
- totalChanges += result.changes;
2234
- }
2235
- return totalChanges;
2236
- }
2237
- /**
2238
- * Multi-hop traversal from `sourceId` via SQLite `WITH RECURSIVE`. All filtering,
2239
- * dead-ending, cycle-guarding, capping, and ordering happens in this one query.
2240
- * The anchor is validated (exists, right entity, not soft-deleted) but never gated
2241
- * by confidence/source_type — only nodes discovered beyond it are.
2242
- */
2243
- async getNeighborhood(entityId, sourceId, opts, tx) {
2244
- const executor = this.getExecutor(tx);
2245
- if (opts.edgeTypes && opts.edgeTypes.length === 0) {
2246
- const anchor = await executor.getFirstAsync(
2247
- `SELECT id FROM ${this.prefix}entries WHERE id = ? AND entity_id = ? AND deleted_at IS NULL`,
2248
- [sourceId, entityId]
2249
- );
2250
- return { nodeIds: anchor ? [anchor.id] : [], edges: [] };
2251
- }
2252
- const edgeTypesClause = opts.edgeTypes ? `e.edge_type IN (${opts.edgeTypes.map(() => "?").join(",")})` : "1=1";
2253
- const excludeSourceTypesPlaceholders = opts.excludeSourceTypes.map(() => "?").join(",");
2254
- const minConfidenceRank = CONFIDENCE_RANK[opts.minConfidence];
2255
- const sql = `
2256
- WITH RECURSIVE walk(node_id, depth, visited) AS (
2257
- SELECT id, 0, ',' || id || ','
2258
- FROM ${this.prefix}entries
2259
- WHERE id = ? AND entity_id = ? AND deleted_at IS NULL
2260
-
2261
- UNION
2262
-
2263
- SELECT
2264
- CASE WHEN e.source_id = w.node_id THEN e.target_id ELSE e.source_id END,
2265
- w.depth + 1,
2266
- w.visited || (CASE WHEN e.source_id = w.node_id THEN e.target_id ELSE e.source_id END) || ','
2267
- FROM walk w
2268
- JOIN ${this.prefix}edges e
2269
- ON e.entity_id = ?
2270
- AND (
2271
- (? != 'inbound' AND e.source_id = w.node_id) OR
2272
- (? != 'outbound' AND e.target_id = w.node_id)
2273
- )
2274
- AND (${edgeTypesClause})
2275
- JOIN ${this.prefix}entries n
2276
- ON n.id = (CASE WHEN e.source_id = w.node_id THEN e.target_id ELSE e.source_id END)
2277
- AND n.entity_id = ?
2278
- AND n.deleted_at IS NULL
2279
- AND (
2280
- CASE n.confidence
2281
- WHEN 'tentative' THEN 0
2282
- WHEN 'inferred' THEN 1
2283
- WHEN 'certain' THEN 2
2284
- ELSE -1
2285
- END
2286
- ) >= ?
2287
- AND n.source_type NOT IN (${excludeSourceTypesPlaceholders})
2288
- AND (? = 0 OR n.lifecycle_status != 'draft')
2289
- AND ${liveAtSql(opts.live.mode, "n.")}
2290
- WHERE w.depth < ?
2291
- AND instr(w.visited, ',' || (CASE WHEN e.source_id = w.node_id THEN e.target_id ELSE e.source_id END) || ',') = 0
2292
- )
2293
- SELECT node_id, MIN(depth) AS depth
2294
- FROM walk
2295
- GROUP BY node_id
2296
- ORDER BY depth ASC, (SELECT updated_at FROM ${this.prefix}entries WHERE id = node_id) DESC
2297
- LIMIT ?
2298
- `;
2299
- const params = [
2300
- sourceId,
2301
- entityId,
2302
- entityId,
2303
- opts.direction,
2304
- opts.direction,
2305
- ...opts.edgeTypes ?? [],
2306
- entityId,
2307
- minConfidenceRank,
2308
- ...opts.excludeSourceTypes,
2309
- opts.excludeDrafts === true ? 1 : 0,
2310
- opts.live.t,
2311
- opts.live.t,
2312
- opts.maxDepth,
2313
- opts.maxNodes
2314
- ];
2315
- const rows = await executor.getAllAsync(sql, params);
2316
- const nodeIds = rows.map((r) => r.node_id);
2317
- if (nodeIds.length === 0) return { nodeIds: [], edges: [] };
2318
- const valueRows = nodeIds.map(() => "(?)").join(", ");
2319
- const edgeRows = await executor.getAllAsync(
2320
- `WITH neighborhood(node_id) AS (VALUES ${valueRows})
2321
- SELECT e.* FROM ${this.prefix}edges e
2322
- JOIN neighborhood ns ON e.source_id = ns.node_id
2323
- JOIN neighborhood nt ON e.target_id = nt.node_id
2324
- WHERE e.entity_id = ?`,
2325
- [...nodeIds, entityId]
2326
- );
2327
- return { nodeIds, edges: edgeRows.map(mapRowToEdge) };
2328
- }
2329
- };
2330
- function mapRowToEdge(row) {
2331
- return {
2332
- id: String(row.id),
2333
- entity_id: String(row.entity_id),
2334
- source_id: String(row.source_id),
2335
- target_id: String(row.target_id),
2336
- edge_type: String(row.edge_type),
2337
- created_at: Number(row.created_at)
2338
- };
2339
- }
2340
2180
  var MiniSearchIndexStrategy = class {
2341
2181
  constructor() {
2342
2182
  /**
@@ -3998,7 +3838,8 @@ var WikiMemory = class {
3998
3838
  this.jobManager,
3999
3839
  this.embeddingService,
4000
3840
  this.promptService,
4001
- this.ontologyService
3841
+ this.ontologyService,
3842
+ this.edgeRepo
4002
3843
  );
4003
3844
  this.maintenanceScheduler = new MaintenanceScheduler(
4004
3845
  this.db,
@@ -4511,6 +4352,16 @@ var WikiMemory = class {
4511
4352
  async importDump(dump, opts) {
4512
4353
  return this.importExportService.importDump(dump, opts);
4513
4354
  }
4355
+ /**
4356
+ * Soft-delete facts and tasks by id, by source, or all of them (`clearAll`).
4357
+ * `clearAll` also deletes the entity's edges and its source-ref index rows.
4358
+ * Add `includeEvents: true` to `clearAll` to hard-delete every event too,
4359
+ * read or not, and reset the librarian's position: without it a later
4360
+ * maintenance run can read the events into facts again. `runPrune()` then
4361
+ * hard-deletes the soft-deleted rows once they are older than
4362
+ * `retainSoftDeletedFor` (7 days by default; pass 0 to remove them now).
4363
+ * `dryRun` previews the counts.
4364
+ */
4514
4365
  async forget(entityId, params, opts) {
4515
4366
  return this.maintenanceService.forget(entityId, params, opts);
4516
4367
  }
@@ -5437,6 +5288,24 @@ function parseStaleAfterRaw(raw) {
5437
5288
  }
5438
5289
  return ms;
5439
5290
  }
5291
+ function replaceLoneSurrogates(s) {
5292
+ let out = "";
5293
+ for (let i = 0; i < s.length; i++) {
5294
+ const c = s.charCodeAt(i);
5295
+ if (c >= 55296 && c <= 56319) {
5296
+ const n = i + 1 < s.length ? s.charCodeAt(i + 1) : 0;
5297
+ if (n >= 56320 && n <= 57343) {
5298
+ out += s[i] + s[i + 1];
5299
+ i++;
5300
+ } else out += "\uFFFD";
5301
+ } else if (c >= 56320 && c <= 57343) {
5302
+ out += "\uFFFD";
5303
+ } else {
5304
+ out += s[i];
5305
+ }
5306
+ }
5307
+ return out;
5308
+ }
5440
5309
  function unescapeLogSummary(summary) {
5441
5310
  return summary.replace(/\\\]/g, "]").replace(/\\\[/g, "[").replace(/\\\\/g, "\\");
5442
5311
  }
@@ -5449,7 +5318,7 @@ function parseLogEntryText(text) {
5449
5318
  if (linkPath) {
5450
5319
  return { event_type, summary: unescapeLogSummary(linkedSummary), linkPath };
5451
5320
  }
5452
- return { event_type, summary: (plainSummary ?? "").trim() };
5321
+ return { event_type, summary: unescapeLogSummary((plainSummary ?? "").trim()) };
5453
5322
  }
5454
5323
  function frontmatterToFact(entityId, id, frontmatter, body, now) {
5455
5324
  const created_at = parseFrontmatterTimestamp(frontmatter.created_at, now);
@@ -5661,6 +5530,7 @@ function parseOkfBundle(entityId, files, options) {
5661
5530
  }
5662
5531
  const events = [];
5663
5532
  if (logContent != null) {
5533
+ const pending = [];
5664
5534
  const logPath = logMdPath ?? `entities/${entityId}/log.md`;
5665
5535
  for (const entry of parseLogMd(logContent)) {
5666
5536
  const { text, eventId } = parseEventIdComment(entry.text);
@@ -5678,8 +5548,9 @@ function parseOkfBundle(entityId, files, options) {
5678
5548
  }
5679
5549
  const created_at = (/* @__PURE__ */ new Date(`${entry.date}T00:00:00.000Z`)).getTime();
5680
5550
  if (!Number.isFinite(created_at)) continue;
5551
+ if (eventId === void 0) pending.push({ index: events.length, date: entry.date });
5681
5552
  events.push({
5682
- id: eventId ?? generateId("evt_"),
5553
+ id: eventId ?? "",
5683
5554
  entity_id: entityId,
5684
5555
  event_type: parsed.event_type,
5685
5556
  summary: parsed.summary,
@@ -5687,6 +5558,22 @@ function parseOkfBundle(entityId, files, options) {
5687
5558
  created_at
5688
5559
  });
5689
5560
  }
5561
+ const taken = new Set(events.map((e) => e.id).filter((id) => id !== ""));
5562
+ const nextOccurrence = /* @__PURE__ */ new Map();
5563
+ for (const { index, date } of pending) {
5564
+ const e = events[index];
5565
+ const key = JSON.stringify([date, e.event_type, replaceLoneSurrogates(e.summary)]);
5566
+ let occurrence = nextOccurrence.get(key) ?? 0;
5567
+ const derive = createEventIdDeriver({ entityId, date, eventType: e.event_type, summary: e.summary });
5568
+ let id = derive(occurrence);
5569
+ while (taken.has(id)) {
5570
+ occurrence += 1;
5571
+ id = derive(occurrence);
5572
+ }
5573
+ taken.add(id);
5574
+ nextOccurrence.set(key, occurrence + 1);
5575
+ e.id = id;
5576
+ }
5690
5577
  }
5691
5578
  return {
5692
5579
  generatedAt: now,