@tailor-platform/sdk-plugin-seed
v0.1.1
Published
Tailor CLI plugin providing the `tailor seed` commands (TailorDB and IdP seed data)
Downloads
1,049
Maintainers
Keywords
Readme
@tailor-platform/sdk-plugin-seed
Tailor CLI plugin that provides the tailor seed commands: seed TailorDB (and IdP _User) data from JSONL files generated by seedPlugin, and validate that data against the generated schemas.
[!NOTE] This package is a CLI plugin: it ships an external
tailor-seedexecutable that the Tailor CLI dispatches to when you runtailor seed. KeepseedPluginfrom@tailor-platform/sdk/plugin/seedindefinePlugins()— it generates the seed data and schema files this plugin consumes.
Installation
Install it next to @tailor-platform/sdk in your project:
npm install -D @tailor-platform/sdk-plugin-seed@nextThe Tailor CLI discovers the plugin automatically from node_modules/.bin (or your PATH). Run tailor plugin list to confirm it resolves.
Usage
# Seed everything (TailorDB types, then IdP _User)
tailor seed apply
# Truncate target tables first, without a confirmation prompt
tailor seed apply --truncate --yes
# Seed a single TailorDB namespace (excludes _User)
tailor seed apply --namespace my-db
# Seed specific types only
tailor seed apply User Order
# Validate JSONL seed data against the generated schemas
tailor seed validate
tailor seed validate ./seed/data/User.jsonl
# Update existing rows (matched by id, or by name for _User) instead of failing on duplicates
tailor seed apply --upsertWithout --upsert, a row whose id already exists in a target table fails the seed run. With --upsert, every row must supply an id (and any field the type requires), and a matching row is updated in place instead. Because the update goes through the same write path as any other update, it runs update hooks and validation and updates fields such as updatedAt, and it publishes a record-updated event — so an executor using recordUpdatedTrigger fires for each existing row that gets updated.
The machine user used for seeding comes from --machine-user or the machineUserName seedPlugin option:
definePlugins(
seedPlugin({
distPath: "./seed",
machineUserName: "admin-machine-user",
}),
);Run tailor seed <command> --help for the full option reference.
