docs: update typedoc, convert packages to esm, generate references (#10699)
This commit is contained in:
1 parent
0559d54c18
commit
870cb6e88c
1210 files changed
+746989
-813362
No files matched your search
+2
-2
@@ -26,8 +26,8 @@ const Product = model.define("product", {
|
||||
|
||||
## Type Parameters
|
||||
|
||||
<TypeList types={[{"name":"T","type":"`object`","description":"The type of the entity builder passed as a first parameter. By default, it's\na function returning the related model.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="belongsTo"/>
|
||||
<TypeList types={[{"name":"T","type":"`object`","description":"The type of the entity builder passed as a first parameter. By default, it's\na function returning the related model.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"ForeignKeyName","type":"`undefined` \\| `string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="belongsTo"/>
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"entityBuilder","type":"T","description":"A function that returns the data model this model is related to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"[RelationshipOptions](../../../../types/DmlTypes/types/types.DmlTypes.RelationshipOptions/page.mdx)","description":"The relationship's options.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"mappedBy","type":"`string`","description":"The name of the relationship as defined in the other\ndata model. This is only required by the `belongsTo` and `manyToMany`\nrelationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="belongsTo"/>
|
||||
<TypeList types={[{"name":"entityBuilder","type":"T","description":"A function that returns the data model this model is related to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object` & `Record<string, any>` & `object`","description":"The relationship's options.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"mappedBy","type":"`string`","description":"The name of the relationship as defined in the other\ndata model. This is only required by the `belongsTo` and `manyToMany`\nrelationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"foreignKeyName","type":"ForeignKeyName","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="belongsTo"/>
|
||||
+34
-10
@@ -7,7 +7,37 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# hasOne Relationship Method - DML Reference
|
||||
|
||||
## hasOne<TypeParameter T>(entityBuilder, options): HasOneWithForeignKey<T>
|
||||
## hasOne<TypeParameter T, TypeParameter ForeignKeyName>(entityBuilder, options): HasOneWithForeignKey<T, ForeignKeyName>
|
||||
|
||||
This method defines a relationship between two data models,
|
||||
where the owner of the relationship has one record of the related
|
||||
data model.
|
||||
|
||||
For example: A user "hasOne" email.
|
||||
|
||||
Use the [belongsTo](../dml.Relationship_Methods.belongsTo/page.mdx) method to define the inverse of this relationship in
|
||||
the other data model.
|
||||
|
||||
### Example
|
||||
|
||||
```ts
|
||||
import { model } from "@medusajs/framework/utils"
|
||||
|
||||
const User = model.define("user", {
|
||||
id: model.id(),
|
||||
email: model.hasOne(() => Email),
|
||||
})
|
||||
```
|
||||
|
||||
### Type Parameters
|
||||
|
||||
<TypeList types={[{"name":"T","type":"`object`","description":"The type of the entity builder passed as a first parameter. By default, it's\na function returning the related model.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"ForeignKeyName","type":"`undefined` \\| `string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="hasOne"/>
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"entityBuilder","type":"T","description":"A function that returns the data model this model is related to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object` & `Record<string, any>` & `object`","description":"The relationship's options.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"foreignKey","type":"`true`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"mappedBy","type":"`string`","description":"The name of the relationship as defined in the other\ndata model. This is only required by the `belongsTo` and `manyToMany`\nrelationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"foreignKeyName","type":"ForeignKeyName","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="hasOne"/>
|
||||
|
||||
## hasOne<TypeParameter T>(entityBuilder, options?): HasOne<T>
|
||||
|
||||
This method defines a relationship between two data models,
|
||||
where the owner of the relationship has one record of the related
|
||||
@@ -35,14 +65,8 @@ const User = model.define("user", {
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"entityBuilder","type":"T","description":"A function that returns the data model this model is related to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object` & `Record<string, any>` & `object`","description":"The relationship's options.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"foreignKey","type":"`true`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"mappedBy","type":"`string`","description":"The name of the relationship as defined in the other\ndata model. This is only required by the `belongsTo` and `manyToMany`\nrelationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="hasOne"/>
|
||||
<TypeList types={[{"name":"entityBuilder","type":"T","description":"A function that returns the data model this model is related to.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object` & `Record<string, any>` & `object`","description":"The relationship's options.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"mappedBy","type":"`string`","description":"The name of the relationship as defined in the other\ndata model. This is only required by the `belongsTo` and `manyToMany`\nrelationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"foreignKey","type":"`false`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="hasOne"/>
|
||||
|
||||
## hasOne<TypeParameter T>(entityBuilder, options?): HasOne<T>
|
||||
### Custom Namespace
|
||||
|
||||
### Type Parameters
|
||||
|
||||
<TypeList types={[{"name":"T","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="hasOne"/>
|
||||
|
||||
### Parameters
|
||||
|
||||
<TypeList types={[{"name":"entityBuilder","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`object` & `Record<string, any>` & `object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"mappedBy","type":"`string`","description":"The name of the relationship as defined in the other\ndata model. This is only required by the `belongsTo` and `manyToMany`\nrelationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"foreignKey","type":"`false`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="hasOne"/>
|
||||
Relationship Methods
|
||||
Reference in new issue
Block a user