Skip to content

Storage

Flux Importer keeps its own data in EmDash's plugin storage under the ID fluximporter, stages source files in your site's media storage, and cleans up old jobs every hour.

Flux Importer never adds tables or opens EmDash’s database for its own data. It uses what EmDash gives every plugin: storage collections, a key-value store and settings, all scoped to the plugin ID fluximporter. The content it imports goes through EmDash like any other content.

These are the collections Flux Importer declares. Each row is a JSON document.

Collection What each row holds Deleted by retention
jobs One import or rollback job: its template (a copy, as it was at creation), options, status, cursor, counters, warnings and error. Yes
records One record a job read: its outcome, source key, entry ID, field changes, errors and warnings. Yes, with its job
journal What a real job changed in one entry, written before the change: whether it created the entry, or what the entry held before. Rollbacks read it. Yes, with its job
journalMedia One media item a real job’s upload created. A rollback lists them in its warnings. Yes, with its job
links One row per imported entry, keyed by collection, locale and source key: the entry ID, the revision the importer last wrote, a fingerprint of each mapped value, and the owner. This is how a later run finds the entry a record updates. No
media The site-wide media map: each downloaded URL and the media item it became, with its type, size and validators. Later imports reuse the item instead of downloading again. No
templates Saved templates, with name, description, revision and who changed them. No
sources Saved URL sources: name, URL, credential name, the last fetch (time, status, hash, size, staged file) and the last error. No
schedules Schedules: template, source, cron expression, options, whether they’re enabled or paused, and the log of their last 20 runs. No

Templates, sources and schedules stay until you delete them on their tabs. Links and the media map are never deleted by the plugin: they connect your source keys and URLs to entries and media items across runs, and deleting them would make the next import create duplicates.

Settings are on EmDash’s plugin settings page for Flux Importer. See Configuration and settings.

Setting Stored as
Keep import logs for (days) (retentionDays) A number, 0 to 3,650. Default 30.
Mapping suggestions (aiProvider) none, anthropic or openai-compatible. Default none.
Provider API key (aiApiKey) A secret, stored encrypted.
Model (aiModel), OpenAI-compatible base URL (aiBaseUrl) Text.
Credentials (credentials) A secret: one encrypted JSON object holding every credential, headers and secrets alike. Manage it on the Sources tab, not here. Saving other text in this field removes every credential. Before version 0.9.0 this setting was labelled URL source credentials.

Secrets need EMDASH_ENCRYPTION_KEY set on the site.

Flux Importer keeps two small values in its key-value store:

  • retention:cursor: where an hourly cleanup that ran out of budget stopped, so the next run starts there.
  • ai:usage: the count behind the limit of 30 provider suggestions an hour.

Every upload, paste and URL fetch is first saved as a file in your site’s storage (emdash.storage: the local directory in development, R2 or S3 in production). Jobs read their records from that file, batch by batch.

  • Files are named fluximporter-upload-<id>.csv, whatever the format. The ID is random and long, and only the Administrator who uploaded it and the import routes see it.
  • They’re written to storage directly, not added to the media library.
  • An .xlsx job has two files: the workbook as uploaded, and the JSON Lines its sheet was converted to.

A staged file is deleted as soon as no job needs it: after the last batch of a job that completed with no failed, conflict or locked records, or when the job is cancelled. It’s kept as long as another job reads the same file, and while it’s a URL source’s latest fetch.

Otherwise it stays while its job is kept: a created, running, paused or failed job can still run, a completed job with failed records can retry them, and a dry run’s file is the one its real run reads. Retention deletes those files with their jobs. Clear dry runs on the Jobs tab deletes a cleared dry run’s file once that dry run has been idle for an hour.

What an import writes lives in EmDash, not in plugin storage:

  • Entries in the collections you import into, written through EmDash, with revisions as usual.
  • The flux_source_id field. The first real run into a collection adds this field to it. It holds each entry’s import key. The plugin never removes it.
  • Fields the wizard creates when you choose that in the Map step.
  • Terms an import creates, when a taxonomy mapping has create: true.
  • Media items for image and file fields and Portable Text images, uploaded to the media library.

A rollback deletes or restores entries, but keeps the terms and media items an import created; its warnings list them. Delete them in EmDash if you don’t need them.

Every hour, at minute 17 (UTC), Flux Importer deletes old import data. See Hooks for how the task runs.

It deletes:

  • Finished jobs (completed, cancelled or failed) created more than Keep import logs for (days) ago, with their records, journal and journalMedia rows. Once a job’s journal is gone it can’t be rolled back, so keep the setting at least as long as you might want to undo an import.
  • Staged files last changed before that cutoff, except the files a remaining job reads and each URL source’s latest fetch.

It keeps, however old:

  • Jobs that haven’t finished (created, running or paused).
  • A job whose batch is running.
  • An import while its rollback job is kept. Both go in the same run once both are old enough.
  • A scheduled job until the scheduler has logged its run, and a job a schedule is launching.

Setting the days to 0 deletes every finished job and unused staged file at the next hourly run.

Each run is bounded to about 150 storage calls. A run that stops early saves where it stopped and the next run continues. If more than 1,000 jobs are stored, a run deletes the expired jobs among the oldest 1,000 and no staged files, and logs a warning; staged files are cleaned again once fewer jobs are kept.

Flux Importer is a native plugin, so you remove it by taking fluxImporter() and fluxImporterRoutes() out of astro.config.mjs and uninstalling the package. EmDash then stops loading it, and its schedules stop running. Its storage collections, settings and KV keys stay in EmDash’s plugin storage, so adding the plugin back later picks up the same templates, sources and history. The plugin registers no uninstall hook and deletes nothing itself.

Entries, media, taxonomy terms and flux_source_id fields that imports created belong to your site and stay where they are.