import { SeedSchema, SeedColumnSchema, SeedMode } from '@objectstack/spec/data';import type { Seed, SeedColumn } from '@objectstack/spec/data';// Validate dataconst result = SeedSchema.parse(data);
What a load does with a record whose externalId matches an existing row. ignore (default) is create-only: a missing row is inserted and an existing row is left as it is, so a replay (every boot, a package install or upgrade, a publish) never writes a seeded value back over a later edit. upsert also writes every declared column back onto the matched row on each replay; declare it for reference data the package keeps current. update writes matched rows only, insert inserts every record with no match, so each replay inserts them again, and replace does the same and deletes nothing: it is for a table the caller cleared. On the loads AppPlugin runs for an organization (the boot seed, the seed-replayer replay, the dev hot reload), an ignore or upsert row that landed once and was later deleted is not inserted again; a publish or package install keeps no such record, and seed-replayer called with { reseed: true } inserts every missing row.
Per-column write policy, keyed by field name: { status: { applyOn: 'create' } } writes status only when the seed creates the row. Omitted, every column is written on create and update.
env
Enum<'prod' | 'dev' | 'test'>[]
optional (default: ["prod","dev","test"])
Applicable environments
locale
string[]
optional
Applicable locales (BCP-47 tags); omitted applies to every locale. The boot seed filters on the app's i18n.defaultLocale; the marketplace install, sample-data reseed, restart heal and per-organization replay filter on the locale resolved for the load (the localization.locale setting when set, then the locale of the installing, reseeding or founding user, then the app's i18n.defaultLocale where the load names one); package apply and draft publish do not filter by locale — they load every dataset and warn
Bytes of the package files the records name with seedFile(path), keyed by path. Written by os build, which reads each path relative to the package root; the loader stores each one as a file the written record owns.
When a seed load writes this column. always (default) writes it on every row the load creates or updates. create writes it only when the load creates the row: an upsert replay that matches an existing row leaves the row's value as it is, and an update dataset never writes it, so replaying the seed refreshes the always columns without reverting state the app wrote since the first load. A column of the dataset's externalId is still matched on and stays in the matched row's update. The same values and meaning as an import mapping entry's applyOn.
When a seed load writes this column. always (default) writes it on every row the load creates or updates. create writes it only when the load creates the row: an upsert replay that matches an existing row leaves the row's value as it is, and an update dataset never writes it, so replaying the seed refreshes the always columns without reverting state the app wrote since the first load. A column of the dataset's externalId is still matched on and stays in the matched row's update. The same values and meaning as an import mapping entry's applyOn.