Files
initiative/specs/030-bulk-import-sources/data-model.md
Lukas c323adc343 Add spec, plan, and tasks for 030-bulk-import-sources feature
Defines the "Bulk Import All Sources" feature for the on-demand bestiary
system: one-click loading of all ~104 bestiary sources with concurrent
fetching, progress feedback, toast notifications, and completion reporting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 22:46:24 +01:00

1.8 KiB

Data Model: Bulk Import All Sources

Entities

BulkImportState

Tracks the progress and outcome of a bulk import operation.

Field Type Description
status "idle" / "loading" / "complete" / "partial-failure" Current phase of the import operation
total number Total number of sources to fetch (excludes already-cached)
completed number Number of sources successfully fetched and cached
failed number Number of sources that failed to fetch

State Transitions:

  • idleloading: User clicks "Load All"
  • loadingcomplete: All sources fetched successfully (failed === 0)
  • loadingpartial-failure: Some sources failed (failed > 0)
  • complete / partial-failureidle: User dismisses or starts a new import

ToastNotification

Lightweight notification data for the toast component.

Field Type Description
message string Primary text to display (e.g., "Loading sources... 34/102")
progress number (0-1) or undefined Optional progress bar value
dismissible boolean Whether the toast shows a dismiss button
autoDismissMs number or undefined Auto-dismiss delay in ms; undefined means persistent

Relationships

  • BulkImportState drives the content of both the side panel progress UI and the toast notification.
  • ToastNotification is derived from BulkImportState when the side panel is closed during an active import.
  • Both consume state from the useBulkImport hook.

Existing Entities (unchanged)

  • CachedSourceRecord (bestiary-cache.ts): Stores normalized creature data per source in IndexedDB. No schema changes.
  • BestiaryIndex (domain): Read-only index with source codes and compact creature entries. No changes.