Skip to content

Commit a7fc798

Browse files
committed
docs(seed): os validate and a config boot read seed files too
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012eJQ8dtut5bZsnhFE3XGHF
1 parent 389fc18 commit a7fc798

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎.changeset/25779-seed-files.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ defineSeed(ContractVersion, {
2828
```
2929

3030
- **The path** is relative to the directory holding `objectstack.config.ts`, uses `/`, and stays inside it: an absolute path, a drive letter, a `\`, or an empty, `.` or `..` segment is refused at parse. A `multiple: true` file field takes an array of `seedFile(...)` values. `defineSeed` refuses `seedFile(...)` in a field that does not store a file.
31-
- **`os build` / `os compile`** reads each referenced file and writes its bytes into the dataset's new `files` map (`{ contentType, size, sha256, data }`, base64), so the compiled artifact carries them to every boot that loads it: `os dev`, `os serve`, a published package, an artifact URL. A path that names no file, or a file whose type is neither known by its extension nor named with `contentType`, fails the build.
31+
- **`os build` / `os compile`** reads each referenced file and writes its bytes into the dataset's new `files` map (`{ contentType, size, sha256, data }`, base64), so the compiled artifact carries them to every boot that loads it: `os dev`, `os serve`, a published package, an artifact URL. A path that names no file, or a file whose type is neither named with `contentType` nor known by its extension, fails the build, and `os validate` refuses the same paths. `os serve` / `os dev` booting a config rather than an artifact reads the files the same way, so both boots seed the same files.
3232
- **The seed loader** stores the bytes through the new `field-files` service (`FIELD_FILE_SERVICE`, `IFieldFileService`, registered by `@objectstack/service-storage`), writes the file's id into the field, and makes the written record the file's owner, the (object, record, field) ownership an upload gets. Each row gets a file of its own. A replay that finds the row holding a file stored from the same path with the same bytes, name and type keeps it, so a restart does not store a new file for an unchanged fixture. A file stays `pending` until its row lands, so a file whose row is refused is reclaimed by the pending-upload retention.
3333
- **Refused, by row, before the row is written**: a reference whose bytes the dataset does not carry, bytes that do not match their recorded size and SHA-256, a load with no `field-files` service, a field mixing `seedFile(...)` with other values, and several `seedFile(...)` values in a one-file field. Each is counted, reported in the load's errors and logged at `error`.
3434
- **The inline boot seed** of an app whose datasets carry seed files runs at `kernel:bootstrapped` (as one with `demoStaff` already does), once the storage service has read its settings, so the files land in the store the deployment serves from.

‎content/docs/data-modeling/seed-data.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ export const contractVersionsSeed = defineSeed(ContractVersion, {
467467
- **`os build`** reads each referenced file and bundles its bytes into the
468468
compiled artifact, so the seed carries them wherever the artifact goes
469469
(`os dev`, `os serve`, a published package). A path that names no file fails
470-
the build.
470+
the build, and `os validate` refuses it too. `os serve` booting the config
471+
itself reads the files the same way.
471472
- **The seed load** stores each file and writes its id into the field; the
472473
record owns the file exactly as if it had been uploaded into that field. Every
473474
row gets a file of its own, even when two rows name the same path. A replay

0 commit comments

Comments
 (0)