docs: enhance how references are generated (#5805)

* adjusted configurations

* enhancements to tool and configurations

* change reference in docs

* fixed issue in workflows reference

* added project name

* more optimizations

* fix context error

* added a types reference

* resolved missing types

* fix reference reflection types not having children

* add an expand url parameter

* added new option to the README

* added details about new option
This commit is contained in:
Shahed Nasser
2023-12-05 15:29:41 +02:00
committed by GitHub
parent a418e6cebc
commit 892d737c1f
4358 changed files with 947876 additions and 534760 deletions
@@ -21,7 +21,7 @@ You can also create a custom batch job or overwrite Medusas batch jobs.
### BatchJob Entity Overview
A batch job is stored in the database as a [BatchJob](../../references/entities/classes/BatchJob.mdx) entity. Some of its important attributes are:
A batch job is stored in the database as a [BatchJob](../../references/entities/classes/entities.BatchJob.mdx) entity. Some of its important attributes are:
- `status`: A string that determines the current status of the Batch Job.
- `context`: An object that can be used to store configurations related to the batch job. For example, you can use it to store listing configurations such as the limit or offset of the list to be retrieved during the processing of the batch job.
@@ -1948,7 +1948,7 @@ Triggered when a payment is created.
</td>
<td>
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/Payment.mdx) for an idea of what fields to expect.
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/entities.Payment.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -1966,7 +1966,7 @@ Triggered when a payment is updated.
</td>
<td>
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/Payment.mdx) for an idea of what fields to expect.
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/entities.Payment.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -1984,7 +1984,7 @@ Triggered when a payment is captured.
</td>
<td>
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/Payment.mdx) for an idea of what fields to expect.
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/entities.Payment.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -2002,7 +2002,7 @@ Triggered when the capturing of a payment fails.
</td>
<td>
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/Payment.mdx) for an idea of what fields to expect.
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/entities.Payment.mdx) for an idea of what fields to expect.
In addition, an error object is passed within the same object as the Payment Processor:
@@ -2034,7 +2034,7 @@ Triggered when a refund of a payment is created.
</td>
<td>
The entire refund passed as an object. You can refer to the [Refund entity](../../references/entities/classes/Refund.mdx) for an idea of what fields to expect.
The entire refund passed as an object. You can refer to the [Refund entity](../../references/entities/classes/entities.Refund.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -2052,7 +2052,7 @@ Triggered when a payment's refund fails.
</td>
<td>
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/Payment.mdx) for an idea of what fields to expect.
The entire payment passed as an object. You can refer to the [Payment entity](../../references/entities/classes/entities.Payment.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -2095,7 +2095,7 @@ Triggered when a payment collection is created.
</td>
<td>
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/PaymentCollection.mdx) for an idea of what fields to expect.
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/entities.PaymentCollection.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -2113,7 +2113,7 @@ Triggered when a payment collection is update.
</td>
<td>
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/PaymentCollection.mdx) for an idea of what fields to expect.
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/entities.PaymentCollection.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -2131,7 +2131,7 @@ Triggered when a payment collection is deleted.
</td>
<td>
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/PaymentCollection.mdx) for an idea of what fields to expect.
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/entities.PaymentCollection.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -2149,7 +2149,7 @@ Triggered when a payment collection is either marked authorized or its payment s
</td>
<td>
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/PaymentCollection.mdx) for an idea of what fields to expect.
The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../references/entities/classes/entities.PaymentCollection.mdx) for an idea of what fields to expect.
</td>
</tr>
@@ -2216,7 +2216,7 @@ Triggered when a product and data associated with it (options, variant orders, e
</td>
<td>
The entire product passed as an object. You can refer to the [Product entity](../../references/entities/classes/Product.mdx) for an idea of what fields to expect.
The entire product passed as an object. You can refer to the [Product entity](../../references/entities/classes/entities.Product.mdx) for an idea of what fields to expect.
In one case, when the `/admin/products/{id}` API Route is used to update the product, the payload is an object of the following format:
@@ -102,7 +102,7 @@ You can learn more about plugins and how to create them in the [Plugins](../plug
:::
Continuing on with the previous example, if you want to use the [`OrderService`](../../references/services/classes/OrderService.mdx) later when sending notifications, you can inject it into the constructor:
Continuing on with the previous example, if you want to use the [`OrderService`](../../references/services/classes/services.OrderService.mdx) later when sending notifications, you can inject it into the constructor:
```ts
import {
@@ -130,7 +130,7 @@ class EmailSenderService extends AbstractNotificationService {
### sendNotification
When an event is triggered that your Notification Provider is registered as a handler for, the [`NotificationService`](../../references/services/classes/NotificationService.mdx) in Medusas core will execute the `sendNotification` method of your Notification Provider.
When an event is triggered that your Notification Provider is registered as a handler for, the [`NotificationService`](../../references/services/classes/services.NotificationService.mdx) in Medusas core will execute the `sendNotification` method of your Notification Provider.
In this method, you can perform the necessary operation to send the Notification. Following the example above, you can send an email to the customer when they place an order.
@@ -138,7 +138,7 @@ This method receives three parameters:
1. `eventName`: This is the name of the event that was triggered. For example, `order.placed`.
2. `eventData`: This is the data payload of the event that was triggered. For example, if the `order.placed` event is triggered, the `eventData` object contains the property `id` which is the ID of the order that was placed.
3. `attachmentGenerator`: If youve previously attached a generator to the `NotificationService` using the [`registerAttachmentGenerator`](../../references/services/classes/NotificationService.mdx#registerattachmentgenerator) method, you have access to it here. You can use the `attachmentGenerator` to generate on-demand invoices or other documents. The default value of this parameter is null.
3. `attachmentGenerator`: If youve previously attached a generator to the `NotificationService` using the [`registerAttachmentGenerator`](../../references/services/classes/services.NotificationService.mdx#registerattachmentgenerator) method, you have access to it here. You can use the `attachmentGenerator` to generate on-demand invoices or other documents. The default value of this parameter is null.
:::info
@@ -200,13 +200,13 @@ The `to` and `data` properties are used in the `NotificationService` in Medusa
### resendNotification
Using the [Resend Notification API Route](https://docs.medusajs.com/api/admin#notifications_postnotificationsnotificationresend), an admin user can resend a Notification to the customer. The [`NotificationService`](../../references/services/classes/NotificationService.mdx) in Medusas core then executes the `resendNotification` method in your Notification Provider.
Using the [Resend Notification API Route](https://docs.medusajs.com/api/admin#notifications_postnotificationsnotificationresend), an admin user can resend a Notification to the customer. The [`NotificationService`](../../references/services/classes/services.NotificationService.mdx) in Medusas core then executes the `resendNotification` method in your Notification Provider.
This method receives three parameters:
1. `notification`: This is the original Notification record that was created after you sent the notification with `sendNotification`. You can get an overview of the entity and its attributes in the [architecture overview](./overview.mdx#notification-entity-overview), but most notably it includes the `to` and `data` attributes which are populated originally using the `to` and `data` properties of the object you return in `sendNotification`.
2. `config`: In the Resend Notification API Route you may specify an alternative receiver of the notification using the `to` request body parameter. For example, you may want to resend the order confirmation email to a different email. If thats the case, you have access to it in the `config` parameter object. Otherwise, `config` will be an empty object.
3. `attachmentGenerator`: If youve previously attached a generator to the Notification Service using the [`registerAttachmentGenerator`](../../references/services/classes/NotificationService.mdx#registerattachmentgenerator) method, you have access to it here. You can use the `attachmentGenerator` to generate on-demand invoices or other documents. The default value of this parameter is null.
3. `attachmentGenerator`: If youve previously attached a generator to the Notification Service using the [`registerAttachmentGenerator`](../../references/services/classes/services.NotificationService.mdx#registerattachmentgenerator) method, you have access to it here. You can use the `attachmentGenerator` to generate on-demand invoices or other documents. The default value of this parameter is null.
Similarly to the `sendNotification` method, this method must return an object containing two properties:
@@ -25,7 +25,7 @@ An example of a notification provider is SendGrid. When an order is placed, the
### How Notification Provider is Created
A Notification Provider is essentially a Medusa [Service](../services/create-service.mdx) with a unique identifier, and it extends the [`NotificationService`](../../references/services/classes/NotificationService.mdx) provided by the `medusa-interfaces` package. It can be created as part of a [Plugin](../plugins/overview.mdx), or it can be created just as a Service file in your Medusa backend.
A Notification Provider is essentially a Medusa [Service](../services/create-service.mdx) with a unique identifier, and it extends the [`NotificationService`](../../references/services/classes/services.NotificationService.mdx) provided by the `medusa-interfaces` package. It can be created as part of a [Plugin](../plugins/overview.mdx), or it can be created just as a Service file in your Medusa backend.
As a developer, you mainly work with the Notification Provider when integrating a third-party service that handles notifications in Medusa.
@@ -58,7 +58,7 @@ A Notification also represents a resent notification. So, when a notification is
### Notification Entity Overview
The two most important properties in the [`Notification`](../../references/entities/classes/Notification.mdx) entity are the `to` and `data` properties.
The two most important properties in the [`Notification`](../../references/entities/classes/entities.Notification.mdx) entity are the `to` and `data` properties.
The `to` property is a string that represents the receiver of the Notification. For example, if the Notification was sent to an email address, the `to` property holds the email address the Notification was sent to.
@@ -88,7 +88,7 @@ You then resolve the `JobSchedulerService` and use the `jobSchedulerService.crea
- The first parameter is a unique name to give to the scheduled job. In the example above, you use the name `publish-products`.
- The second parameter is an object which can be used to [pass data to the job](#pass-data-to-the-scheduled-job).
- The third parameter is the scheduled job expression pattern. In this example, it will execute the scheduled job once a day at 12 AM.
- The fourth parameter is the function to execute. This is where you add the code to execute once the scheduled job runs. In this example, you retrieve the draft products using the [ProductService](../../references/services/classes/ProductService.mdx) and update the status of each of these products to `published`.
- The fourth parameter is the function to execute. This is where you add the code to execute once the scheduled job runs. In this example, you retrieve the draft products using the [ProductService](../../references/services/classes/services.ProductService.mdx) and update the status of each of these products to `published`.
:::tip