ソースを参照

feat(docs): Add note on DI for ConfigurableOperationDefs

Michael Bromley 5 年 前
コミット
405b754d51

+ 6 - 0
docs/content/docs/developer-guide/payment-integrations/index.md

@@ -107,6 +107,12 @@ export const config: VendureConfig = {
 };
 ```
 
+{{% alert %}}
+**Dependency Injection**
+
+If your PaymentMethodHandler needs access to the database or other providers, see the [ConfigurableOperationDef Dependency Injection guide]({{< relref "configurable-operation-def" >}}#dependency-injection).
+{{< /alert >}}
+
 ## Payment flow
 
 1. Once the active Order has been transitioned to the ArrangingPayment state (see the [Order Workflow guide]({{< relref "order-workflow" >}})), one or more Payments are created by executing the [`addPaymentToOrder` mutation]({{< relref "/docs/graphql-api/shop/mutations#addpaymenttoorder" >}}). This mutation has a required `method` input field, which _must_ match the `code` of one of the configured PaymentMethodHandlers. In the case above, this would be set to `"my-payment-method"`.

+ 6 - 0
docs/content/docs/developer-guide/promotions.md

@@ -155,3 +155,9 @@ export const config: VendureConfig = {
   }
 }
 ```
+
+{{% alert %}}
+**Dependency Injection**
+
+If your PromotionCondition or PromotionAction needs access to the database or other providers, see the [ConfigurableOperationDef Dependency Injection guide]({{< relref "configurable-operation-def" >}}#dependency-injection).
+{{< /alert >}}

+ 6 - 0
docs/content/docs/developer-guide/shipping.md

@@ -125,6 +125,12 @@ export const config: VendureConfig = {
 }
 ```
 
+{{% alert %}}
+**Dependency Injection**
+
+If your ShippingEligibilityChecker or ShippingCalculator needs access to the database or other providers, see the [ConfigurableOperationDef Dependency Injection guide]({{< relref "configurable-operation-def" >}}#dependency-injection).
+{{< /alert >}}
+
 ## Fulfillments
 
 Fulfillments represent the actual shipping status of items in an order. Like Orders, Fulfillments are governed by a [finite state machine]({{< relref "fsm" >}}) and by default, a Fulfillment can be in one of the [following states]({{< relref "fulfillment-state" >}}):

+ 1 - 1
packages/core/src/common/configurable-operation.ts

@@ -243,7 +243,7 @@ export interface ConfigurableOperationDefOptions<T extends ConfigArgs> extends I
  * the docs of {@link ConfigArgs}.
  *
  * ## Dependency Injection
- * If your business logic relies on injectable providers, such as the TypeORM `Connection` object, or any of the
+ * If your business logic relies on injectable providers, such as the `TransactionalConnection` object, or any of the
  * internal Vendure services or those defined in a plugin, you can inject them by using the config object's
  * `init()` method, which exposes the {@link Injector}.
  *

+ 1 - 1
packages/core/src/common/injector.ts

@@ -26,7 +26,7 @@ export class Injector {
 
     /**
      * @description
-     * Retrieve the TypeORM `Connection` instance.
+     * (deprecated) Retrieve the TypeORM `Connection` instance.
      *
      * @deprecated Use `.get(TransactionalConnection)` instead.
      */