generate references (#7882)

This commit is contained in:
Shahed Nasser
2024-07-01 16:02:36 +03:00
committed by GitHub
parent b9036eca1a
commit dd864da4e0
2424 changed files with 106679 additions and 116201 deletions
@@ -0,0 +1,31 @@
---
slug: /references/data-model/model-methods/cascades
sidebar_label: cascades
---
import { TypeList } from "docs-ui"
# cascades Method - API Reference
This method configures which related data models an operation, such as deletion,
should be cascaded to.
For example, if a store is deleted, its product should also be deleted.
## Example
```ts
import { model } from "@medusajs/utils"
const Store = model.define("store", {
id: model.id(),
products: model.hasMany(() => Product),
})
.cascades({
delete: ["products"],
})
```
## Parameters
<TypeList types={[{"name":"options","type":"[EntityCascades](../../../../types/DmlTypes/types/types.DmlTypes.EntityCascades/page.mdx)&#60;[ExtractEntityRelations](../../../../types/DmlTypes/types/types.DmlTypes.ExtractEntityRelations/page.mdx)&#60;Schema, \"hasOne\" \\| \"hasMany\"&#62;&#62;","description":"The cascades configurations. They object's keys are the names of\nthe actions, such as `deleted`, and the value is an array of relations that the \naction should be cascaded to.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"delete","type":"Relationships","description":"The related models to delete when a record of this data model\nis deleted.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="cascades"/>
@@ -0,0 +1,81 @@
---
slug: /references/data-model/model-methods/indexes
sidebar_label: indexes
---
import { TypeList } from "docs-ui"
# indexes Method - API Reference
This method defines indices on the data model. An index can be on multiple columns
and have conditions.
## Example
An example of a simple index:
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id(),
name: model.text(),
age: model.number()
}).indexes([
{
on: ["name", "age"],
},
])
export default MyCustom
```
To add a condition on the index, use the `where` option:
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id(),
name: model.text(),
age: model.number()
}).indexes([
{
on: ["name", "age"],
where: {
age: 30
}
},
])
export default MyCustom
```
The condition can also be a negation. For example:
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id(),
name: model.text(),
age: model.number()
}).indexes([
{
on: ["name", "age"],
where: {
age: {
$ne: 30
}
}
},
])
export default MyCustom
```
In this example, the index is created when the value of `age` doesn't equal `30`.
## Parameters
<TypeList types={[{"name":"indexes","type":"[EntityIndex](../../../../types/DmlTypes/types/types.DmlTypes.EntityIndex/page.mdx)&#60;Schema, string \\| [QueryCondition](../../../../types/DmlTypes/types/types.DmlTypes.QueryCondition/page.mdx)&#60;Schema&#62;&#62;[]","description":"The index's configuration.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"on","type":"[InferIndexableProperties](../../../../types/DmlTypes/types/types.DmlTypes.InferIndexableProperties/page.mdx)&#60;[IDmlEntity](../../../../types/DmlTypes/interfaces/types.DmlTypes.IDmlEntity/page.mdx)&#60;TSchema&#62;&#62;[]","description":"The list of properties to create the index on.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"The name of the index. If not provided,\nMedusa generates the name.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"unique","type":"`boolean`","description":"When enabled, a unique index is created on the specified\nproperties.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"where","type":"TWhere","description":"Conditions to restrict which records are indexed.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="indexes"/>
@@ -0,0 +1,32 @@
---
slug: /references/data-model/property-configuration/default
sidebar_label: default
---
import { TypeList } from "docs-ui"
# default Method - API Reference
This method defines the default value of a property.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
color: model
.enum(["black", "white"])
.default("black"),
age: model
.number()
.default(0),
// ...
})
export default MyCustom
```
## Parameters
<TypeList types={[{"name":"value","type":"T","description":"The default value.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="default"/>
@@ -0,0 +1,29 @@
---
slug: /references/data-model/property-configuration/index
sidebar_label: index
---
import { TypeList } from "docs-ui"
# index Method - API Reference
This method defines an index on a property.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id(),
name: model.text().index(
"IDX_MY_CUSTOM_NAME"
),
})
export default MyCustom
```
## Parameters
<TypeList types={[{"name":"name","type":"`string`","description":"The index's name. If not provided,\nMedusa generates the name.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="index"/>
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-configuration/nullable
sidebar_label: nullable
---
import { TypeList } from "docs-ui"
# nullable Method - API Reference
This method indicates that a property's value can be `null`.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
price: model.bigNumber().nullable(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,28 @@
---
slug: /references/data-model/property-configuration/unique
sidebar_label: unique
---
import { TypeList } from "docs-ui"
# unique Method - API Reference
This method indicates that a property's value must be unique in the database.
A unique index is created on the property.
## Example
```ts
import { model } from "@medusajs/utils"
const User = model.define("user", {
email: model.text().unique(),
// ...
})
export default User
```
## Parameters
<TypeList types={[{"name":"name","type":"`string`","description":"The unique index's name. If not provided,\nMedusa generates the name.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="unique"/>
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-types/array
sidebar_label: array
---
import { TypeList } from "docs-ui"
# array Property Method - API Reference
This method defines an array of strings property.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
names: model.array(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-types/bignumber
sidebar_label: bigNumber
---
import { TypeList } from "docs-ui"
# bigNumber Property Method - API Reference
This method defines a number property that expects large numbers, such as prices.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
price: model.bigNumber(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-types/boolean
sidebar_label: boolean
---
import { TypeList } from "docs-ui"
# boolean Property Method - API Reference
This method defines a boolean property.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
hasAccount: model.boolean(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-types/datetime
sidebar_label: dateTime
---
import { TypeList } from "docs-ui"
# dateTime Property Method - API Reference
This method defines a timestamp property.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
date_of_birth: model.dateTime(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,31 @@
---
slug: /references/data-model/property-types/enum
sidebar_label: enum
---
import { TypeList } from "docs-ui"
# enum Property Method - API Reference
This method defines a property whose value can only be one of the specified values.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
color: model.enum(["black", "white"]),
// ...
})
export default MyCustom
```
## Type Parameters
<TypeList types={[{"name":"Values","type":"`unknown`","description":"The type of possible values. By default, it's `string`.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="enum"/>
## Parameters
<TypeList types={[{"name":"values","type":"Values[]","description":"An array of possible values.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="enum"/>
@@ -0,0 +1,29 @@
---
slug: /references/data-model/property-types/id
sidebar_label: id
---
import { TypeList } from "docs-ui"
# id Property Method - API Reference
This method defines an automatically generated string ID property.
By default, this property is considered to be the data models primary key.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id(),
// ...
})
export default MyCustom
```
## Parameters
<TypeList types={[{"name":"options","type":"`object`","description":"The ID's options.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"primaryKey","type":"`boolean`","description":"Whether the ID is the data model's primary key.","optional":true,"defaultValue":"true","expandable":false,"children":[]},{"name":"prefix","type":"`string`","description":"By default, Medusa shortens the data model's name and uses it as the \nprefix of all IDs. For example, `cm_123`.\n\nUse this option to specify the prefix to use instead.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="id"/>
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-types/json
sidebar_label: json
---
import { TypeList } from "docs-ui"
# json Property Method - API Reference
This method defines a property whose value is a stringified JSON object.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
metadata: model.json(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-types/number
sidebar_label: number
---
import { TypeList } from "docs-ui"
# number Property Method - API Reference
This method defines a number property.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
age: model.number(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,23 @@
---
slug: /references/data-model/property-types/text
sidebar_label: text
---
import { TypeList } from "docs-ui"
# text Property Method - API Reference
This method defines a string property.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
name: model.text(),
// ...
})
export default MyCustom
```
@@ -0,0 +1,31 @@
---
slug: /references/data-model/relationship-methods/belongsto
sidebar_label: belongsTo
---
import { TypeList } from "docs-ui"
# belongsTo Relationship Method - API Reference
This method defines the inverse of the [hasOne](../dml.Relationship_Methods.hasOne/page.mdx) or [hasMany](../dml.Relationship_Methods.hasMany/page.mdx) relationship.
For example, a product "belongsTo" a store.
## Example
```ts
const Product = model.define("product", {
id: model.id(),
store: model.belongsTo(() => Store, {
mappedBy: "products",
}),
})
```
## 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":false,"defaultValue":"","expandable":false,"children":[]}]} 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\nin the other data model. This is only required\nby the `belongsTo` relationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="belongsTo"/>
@@ -0,0 +1,33 @@
---
slug: /references/data-model/relationship-methods/hasmany
sidebar_label: hasMany
---
import { TypeList } from "docs-ui"
# hasMany Relationship Method - API Reference
This method defines a relationship between two data models,
where the owner of the relationship has many records of the related
data model, but the related data model only has one owner.
For example, a store "hasMany" products.
## Example
```ts
import { model } from "@medusajs/utils"
const Store = model.define("store", {
id: model.id(),
products: model.hasMany(() => 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":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="hasMany"/>
## 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\nin the other data model. This is only required\nby the `belongsTo` relationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="hasMany"/>
@@ -0,0 +1,36 @@
---
slug: /references/data-model/relationship-methods/hasone
sidebar_label: hasOne
---
import { TypeList } from "docs-ui"
# hasOne Relationship Method - API Reference
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/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":false,"defaultValue":"","expandable":false,"children":[]}]} 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":"[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\nin the other data model. This is only required\nby the `belongsTo` relationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="hasOne"/>
@@ -0,0 +1,38 @@
---
slug: /references/data-model/relationship-methods/manytomany
sidebar_label: manyToMany
---
import { TypeList } from "docs-ui"
# manyToMany Relationship Method - API Reference
This method defines a relationship between two data models,
where both data models have many related records.
For example, an order is associated with many products, and a product
is associated with many orders.
## Example
```ts
import { model } from "@medusajs/utils"
const Order = model.define("order", {
id: model.id(),
products: model.manyToMany(() => Product),
})
const Product = model.define("product", {
id: model.id(),
order: model.manyToMany(() => Order),
})
```
## 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":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="manyToMany"/>
## 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":"[ManyToManyOptions](../../../entity_builder/types/dml.entity_builder.ManyToManyOptions/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\nin the other data model. This is only required\nby the `belongsTo` relationship method.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"pivotTable","type":"`string`","description":"The name of the pivot table\ncreated in the database for this relationship.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"pivotEntity","type":"() => [DmlEntity](../../../entity/classes/dml.entity.DmlEntity/page.mdx)&#60;any&#62;","description":"A function that returns the data model \nrepresenting the pivot table created in the\ndatabase for this relationship.","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="manyToMany"/>
@@ -0,0 +1,14 @@
---
slug: /references/data-model/model-methods
---
import { TypeList } from "docs-ui"
# Model Methods - API Reference
The following methods are used on a module to configure it.
## Methods
- [cascades](../Model_Methods/methods/dml.Model_Methods.cascades/page.mdx)
- [indexes](../Model_Methods/methods/dml.Model_Methods.indexes/page.mdx)
@@ -0,0 +1,16 @@
---
slug: /references/data-model/property-configuration
---
import { TypeList } from "docs-ui"
# Property Configuration Methods - API Reference
The following methods are used on a property to configure it.
## Methods
- [nullable](../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.nullable/page.mdx)
- [index](../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.index/page.mdx)
- [unique](../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.unique/page.mdx)
- [default](../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.default/page.mdx)
@@ -0,0 +1,21 @@
---
slug: /references/data-model/property-types
---
import { TypeList } from "docs-ui"
# Property Types - API Reference
The following methods are used to define the type of a property in a data model.
## Methods
- [id](../Property_Types/methods/dml.Property_Types.id/page.mdx)
- [text](../Property_Types/methods/dml.Property_Types.text/page.mdx)
- [boolean](../Property_Types/methods/dml.Property_Types.boolean/page.mdx)
- [number](../Property_Types/methods/dml.Property_Types.number/page.mdx)
- [bigNumber](../Property_Types/methods/dml.Property_Types.bigNumber/page.mdx)
- [array](../Property_Types/methods/dml.Property_Types.array/page.mdx)
- [dateTime](../Property_Types/methods/dml.Property_Types.dateTime/page.mdx)
- [json](../Property_Types/methods/dml.Property_Types.json/page.mdx)
- [enum](../Property_Types/methods/dml.Property_Types.enum/page.mdx)
@@ -0,0 +1,16 @@
---
slug: /references/data-model/relationship-methods
---
import { TypeList } from "docs-ui"
# Relationship Methods - API Reference
The following methods are used to define a relationship between two data models.
## Methods
- [hasOne](../Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx)
- [belongsTo](../Relationship_Methods/methods/dml.Relationship_Methods.belongsTo/page.mdx)
- [hasMany](../Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx)
- [manyToMany](../Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx)
@@ -0,0 +1,11 @@
import { TypeList } from "docs-ui"
# isDmlEntity
A static method to check if an entity is an instance of DmlEntity.
It allows us to identify a specific object as being an instance of
DmlEntity.
## Parameters
<TypeList types={[{"name":"entity","type":"`unknown`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="isDmlEntity"/>
@@ -0,0 +1,5 @@
import { TypeList } from "docs-ui"
# parse
Parse entity to get its underlying information
@@ -0,0 +1,31 @@
import { TypeList } from "docs-ui"
# DmlEntity
Dml entity is a representation of a DML model with a unique
name, its schema and relationships.
## Type parameters
<TypeList types={[{"name":"Schema","type":"[DMLSchema](../../../../types/DmlTypes/types/types.DmlTypes.DMLSchema/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"type","type":"[RelationshipTypes](../../../../types/DmlTypes/types/types.DmlTypes.RelationshipTypes/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="DmlEntity"/>
## Methods
- [isDmlEntity](../../DmlEntity/methods/dml.entity.DmlEntity.isDmlEntity/page.mdx)
- [parse](../../DmlEntity/methods/dml.entity.DmlEntity.parse/page.mdx)
- [cascades](../../../Model_Methods/methods/dml.Model_Methods.cascades/page.mdx)
- [indexes](../../../Model_Methods/methods/dml.Model_Methods.indexes/page.mdx)
## constructor
### Type Parameters
<TypeList types={[{"name":"Schema","type":"[DMLSchema](../../../../types/DmlTypes/types/types.DmlTypes.DMLSchema/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"type","type":"[RelationshipTypes](../../../../types/DmlTypes/types/types.DmlTypes.RelationshipTypes/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="new DmlEntity"/>
### Parameters
<TypeList types={[{"name":"nameOrConfig","type":"`Config`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"schema","type":"Schema","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="new DmlEntity"/>
___
<TypeList types={[{"name":"[IsDmlEntity]","type":"`true`","description":"","optional":false,"defaultValue":"true","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"schema","type":"Schema","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="DmlEntity"/>
@@ -0,0 +1,30 @@
---
slug: /references/data-model/define
---
import { TypeList } from "docs-ui"
# define Method - API Reference
This method defines a data model.
## Example
```ts
import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id(),
name: model.text(),
})
export default MyCustom
```
## Type Parameters
<TypeList types={[{"name":"Schema","type":"[DMLSchema](../../../../../types/DmlTypes/types/types.DmlTypes.DMLSchema/page.mdx)","description":"The type of the accepted schema in the second parameter of the method.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"$dataType","type":"T","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"type","type":"[RelationshipTypes](../../../../../types/DmlTypes/types/types.DmlTypes.RelationshipTypes/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} sectionTitle="define"/>
## Parameters
<TypeList types={[{"name":"nameOrConfig","type":"[DefineOptions](../../../types/dml.entity_builder.DefineOptions/page.mdx)","description":"Either the data model's name, or configurations to name the data model.\nThe data model's name must be unique.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"tableName","type":"`string`","description":"The name of the data model's table in the database.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"The data model's name.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"schema","type":"Schema","description":"The schema of the data model's properties.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="define"/>
@@ -0,0 +1,25 @@
import { TypeList } from "docs-ui"
# EntityBuilder
Entity builder exposes the API to create an entity and define its
schema using the shorthand methods.
## Methods
- [define](../../EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx)
- [id](../../../Property_Types/methods/dml.Property_Types.id/page.mdx)
- [text](../../../Property_Types/methods/dml.Property_Types.text/page.mdx)
- [boolean](../../../Property_Types/methods/dml.Property_Types.boolean/page.mdx)
- [number](../../../Property_Types/methods/dml.Property_Types.number/page.mdx)
- [bigNumber](../../../Property_Types/methods/dml.Property_Types.bigNumber/page.mdx)
- [array](../../../Property_Types/methods/dml.Property_Types.array/page.mdx)
- [dateTime](../../../Property_Types/methods/dml.Property_Types.dateTime/page.mdx)
- [json](../../../Property_Types/methods/dml.Property_Types.json/page.mdx)
- [enum](../../../Property_Types/methods/dml.Property_Types.enum/page.mdx)
- [hasOne](../../../Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx)
- [belongsTo](../../../Relationship_Methods/methods/dml.Relationship_Methods.belongsTo/page.mdx)
- [hasMany](../../../Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx)
- [manyToMany](../../../Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx)
## constructor
@@ -0,0 +1,19 @@
import { TypeList } from "docs-ui"
# DefineOptions
**DefineOptions**: `string` \| `object`
## name
`Optional` **name**: `string`
The data model's name.
___
## tableName
**tableName**: `string`
The name of the data model's table in the database.
@@ -0,0 +1,34 @@
import { TypeList } from "docs-ui"
# ManyToManyOptions
**ManyToManyOptions**: [RelationshipOptions](../../../../types/DmlTypes/types/types.DmlTypes.RelationshipOptions/page.mdx) & `object` \| `object`
## mappedBy
`Optional` **mappedBy**: `string`
The name of the relationship as defined
in the other data model. This is only required
by the `belongsTo` relationship method.
___
## pivotTable
`Optional` **pivotTable**: `string`
The name of the pivot table
created in the database for this relationship.
___
## pivotEntity
`Optional` **pivotEntity**: () => [DmlEntity](../../../entity/classes/dml.entity.DmlEntity/page.mdx)&#60;any&#62;
A function that returns the data model
representing the pivot table created in the
database for this relationship.
### Type declaration
@@ -0,0 +1,5 @@
import { TypeList } from "docs-ui"
# model
`Const` **model**: [EntityBuilder](../../classes/dml.entity_builder.EntityBuilder/page.mdx)
@@ -0,0 +1,7 @@
import { TypeList } from "docs-ui"
# entity
## Classes
- [DmlEntity](../../entity/classes/dml.entity.DmlEntity/page.mdx)
@@ -0,0 +1,16 @@
import { TypeList } from "docs-ui"
# entity-builder
## Classes
- [EntityBuilder](../../entity_builder/classes/dml.entity_builder.EntityBuilder/page.mdx)
## Type Aliases
- [DefineOptions](../../entity_builder/types/dml.entity_builder.DefineOptions/page.mdx)
- [ManyToManyOptions](../../entity_builder/types/dml.entity_builder.ManyToManyOptions/page.mdx)
## Variables
- [model](../../entity_builder/variables/dml.entity_builder.model/page.mdx)
@@ -0,0 +1,7 @@
import { TypeList } from "docs-ui"
# properties/base
## Classes
- [BaseProperty](../../properties_base/classes/dml.properties_base.BaseProperty/page.mdx)
@@ -0,0 +1,9 @@
import { TypeList } from "docs-ui"
# parse
Returns the serialized metadata
## Parameters
<TypeList types={[{"name":"fieldName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="parse"/>
@@ -0,0 +1,28 @@
import { TypeList } from "docs-ui"
# BaseProperty
The BaseProperty class offers shared affordances to define
property classes
## Type parameters
<TypeList types={[{"name":"T","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="BaseProperty"/>
## Methods
- [nullable](../../../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.nullable/page.mdx)
- [index](../../../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.index/page.mdx)
- [unique](../../../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.unique/page.mdx)
- [default](../../../Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.default/page.mdx)
- [parse](../../BaseProperty/methods/dml.properties_base.BaseProperty.parse/page.mdx)
## constructor
### Type Parameters
<TypeList types={[{"name":"T","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="new BaseProperty"/>
___
<TypeList types={[{"name":"dataType","type":"`object`","description":"The runtime dataType for the schema. It is not the same as\nthe \"$dataType\".","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"name","type":"[KnownDataTypes](../../../../types/DmlTypes/types/types.DmlTypes.KnownDataTypes/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"$dataType","type":"T","description":"A type-only property to infer the JavScript data-type\nof the schema property","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="BaseProperty"/>