import { TypeList } from "docs-ui"
# utils
## Namespaces
- [CoreFlowsUitls](../../utils/utils.CoreFlowsUitls/page.mdx)
- [FulfillmentUtils](../../utils/utils.FulfillmentUtils/page.mdx)
- [GraphQLUtils](../../utils/utils.GraphQLUtils/page.mdx)
- [InventoryUtils](../../utils/utils.InventoryUtils/page.mdx)
- [LinkUtils](../../utils/utils.LinkUtils/page.mdx)
- [OrderUtils](../../utils/utils.OrderUtils/page.mdx)
- [ProductUtils](../../utils/utils.ProductUtils/page.mdx)
- [PromotionUtils](../../utils/utils.PromotionUtils/page.mdx)
- [ShippingProfileUtils](../../utils/utils.ShippingProfileUtils/page.mdx)
- [UserUtils](../../utils/utils.UserUtils/page.mdx)
## Enumerations
- [NotificationStatus](../../utils/enums/utils.NotificationStatus/page.mdx)
- [PaymentCollectionStatus](../../utils/enums/utils.PaymentCollectionStatus/page.mdx)
- [PaymentSessionStatus](../../utils/enums/utils.PaymentSessionStatus/page.mdx)
- [PaymentWebhookEvents](../../utils/enums/utils.PaymentWebhookEvents/page.mdx)
- [PaymentActions](../../utils/enums/utils.PaymentActions/page.mdx)
- [PriceListStatus](../../utils/enums/utils.PriceListStatus/page.mdx)
- [PriceListType](../../utils/enums/utils.PriceListType/page.mdx)
## Classes
- [GraphQLParser](../../utils/classes/utils.GraphQLParser/page.mdx)
## Interfaces
- [JoinerArgument](../../utils/interfaces/utils.JoinerArgument/page.mdx)
- [JoinerDirective](../../utils/interfaces/utils.JoinerDirective/page.mdx)
- [RemoteJoinerQuery](../../utils/interfaces/utils.RemoteJoinerQuery/page.mdx)
- [Argument](../../utils/interfaces/utils.Argument/page.mdx)
- [Directive](../../utils/interfaces/utils.Directive/page.mdx)
- [Entity](../../utils/interfaces/utils.Entity/page.mdx)
## Variables
- [MedusaModuleType](page.mdx#medusamoduletype)
- [NotificationEvents](page.mdx#notificationevents)
- [PaymentEvents](page.mdx#paymentevents)
- [PricingEvents](page.mdx#pricingevents)
## Functions
- [generateJwtToken](page.mdx#generatejwttoken)
- [cleanGraphQLSchema](page.mdx#cleangraphqlschema)
- [extractRelationsFromGQL](page.mdx#extractrelationsfromgql)
- [gqlGetFieldsAndRelations](page.mdx#gqlgetfieldsandrelations)
- [graphqlSchemaToFields](page.mdx#graphqlschematofields)
- [gqlSchemaToTypes](page.mdx#gqlschematotypes)
- [parseConnectionString](page.mdx#parseconnectionstring)
- [createClient](page.mdx#createclient)
- [createDb](page.mdx#createdb)
- [dbExists](page.mdx#dbexists)
___
## Variables
### MedusaModuleType
`Const` **MedusaModuleType**: typeof [MedusaModuleType](page.mdx#medusamoduletype)
### NotificationEvents
`Const` **NotificationEvents**: ReturnType<["notification"]>
### PaymentEvents
`Const` **PaymentEvents**: `Object`
#### Properties
### PricingEvents
`Const` **PricingEvents**: ReturnType<["priceListRule", "priceList", "priceRule", "priceSet", "price"]>
___
## Functions
### generateJwtToken
#### Parameters
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"jwtConfig","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"secret","type":"`undefined` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"expiresIn","type":"`undefined` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="generateJwtToken"/>
#### Returns
### cleanGraphQLSchema
#### Parameters
#### Returns
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="cleanGraphQLSchema"/>
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="cleanGraphQLSchema"/>
### extractRelationsFromGQL
Extracts only the relation fields from the GraphQL type map.
#### Parameters
#### Returns
### gqlGetFieldsAndRelations
Generate a list of fields and fields relations for a given type with the requested relations
#### Parameters
#### Returns
### graphqlSchemaToFields
From graphql schema get all the fields for the requested type and relations
#### Example
```ts
const userModule = `
type User {
id: ID!
name: String!
blabla: WHATEVER
}
type Post {
author: User!
}
`
const postModule = `
type Post {
id: ID!
title: String!
date: String
}
type User {
posts: [Post!]!
}
type WHATEVER {
random_field: String
post: Post
}
`
const mergedSchema = mergeTypeDefs([userModule, postModule])
const schema = makeExecutableSchema({
typeDefs: mergedSchema,
})
const fields = graphqlSchemaToFields(types, "User", ["posts"])
console.log(fields)
// [
// "id",
// "name",
// "posts.id",
// "posts.title",
// "posts.date",
// ]
```
#### Parameters
#### Returns
### gqlSchemaToTypes
#### Parameters
`","description":"Keys that can be used to link to other modules. e.g { product\\_id: \"Product\" } \"Product\" being the entity it refers to","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"isReadOnlyLink","type":"`boolean`","description":"If true it expands a RemoteQuery property but doesn't create a pivot table","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"extraDataFields","type":"`string`[]","description":"Fields that will be part of the link record aside from the primary keys that can be updated\nIf not explicitly defined, this array will be populated by databaseConfig.extraFields","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"databaseConfig","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"interfaceName","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="gqlSchemaToTypes"/>
#### Returns
### parseConnectionString
Parsers the database connection string into an object
of postgreSQL options
#### Parameters
#### Returns
### createClient
Creates a PostgreSQL database client using the connection
string or database options
#### Parameters
#### Returns
### createDb
Creates a database using the client. Make sure to call
`client.connect` before using this utility.
#### Parameters
#### Returns
### dbExists
Checks if a database exists using the Client. Make sure to call
`client.connect` before using this utility.
#### Parameters
#### Returns