@diagonal-hq/cli 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -907,6 +907,10 @@ A field file holds one builder call, `export default field.<type>({...})`. The f
907
907
 
908
908
  `field.select` takes `options` and `field.relation` takes `resource` (`Resources.<Name>.slug`) and `type` as options. A relation file imports `Resources` from `@app/generated/resources`. Other settings go in `settings`. A setting that an option writes, such as `settings.unique`, is refused. A relation can declare `settings.inverse: { uid, key, label?, settings? }` in its own field file. `uid` is the uid of the inverse field. The build then adds the inverse relation field to the target resource, which has no file for it. A target that declares a field with the same key is an error.
909
909
 
910
+ A `belongs_to` relation can set `settings.inverse.settings.type` to `'has_one'` to read a single record through the inverse. Add `unique: true` to the declaring field if each target can belong to only one record. The default inverse type is `has_many`. For every other relation type, the build derives the inverse type and rejects an explicit inverse `type`.
911
+
912
+ A file with an inverse `type` needs a `@diagonal-hq/cli` version that has this option. An older version reports `Unknown setting "type" on the inverse of field "<key>"`.
913
+
910
914
  ```ts
911
915
  // resources/classes/fields/instructor.ts
912
916
  import { Resources } from '@app/generated/resources';