Skip to content

Commit

Permalink
fix(medusa): fix constructor container type for abstract services (#6259
Browse files Browse the repository at this point in the history
)
  • Loading branch information
shahednasser authored Feb 8, 2024
1 parent 5c6ba67 commit 3ded231
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-wolves-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---

fix(medusa): fix constructor container type for abstract services
4 changes: 2 additions & 2 deletions packages/medusa/src/interfaces/file-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export abstract class AbstractFileService
* Additionally, if you’re creating your file service as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin,
* you can access them in the constructor.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} config - If this file service is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
Expand Down Expand Up @@ -334,7 +334,7 @@ export abstract class AbstractFileService
* }
*/
protected constructor(
protected readonly container: MedusaContainer,
protected readonly container: Record<string, unknown>,
protected readonly config?: Record<string, unknown> // eslint-disable-next-line @typescript-eslint/no-empty-function
) {
super(container, config)
Expand Down
4 changes: 2 additions & 2 deletions packages/medusa/src/interfaces/fulfillment-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export abstract class AbstractFulfillmentService
* You can also use the constructor to initialize your integration with the third-party provider. For example, if you use a client to connect to the third-party provider’s APIs, you can initialize it in the constructor and use it in other methods in the service.
* Additionally, if you’re creating your fulfillment provider as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin, you can access it in the constructor.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} config - If this fulfillment provider is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
Expand All @@ -433,7 +433,7 @@ export abstract class AbstractFulfillmentService
* }
*/
protected constructor(
protected readonly container: MedusaContainer,
protected readonly container: Record<string, unknown>,
protected readonly config?: Record<string, unknown> // eslint-disable-next-line @typescript-eslint/no-empty-function
) {
super(container, config)
Expand Down
4 changes: 2 additions & 2 deletions packages/medusa/src/interfaces/notification-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export abstract class AbstractNotificationService
* Additionally, if you’re creating your notification provider as an external plugin to be installed on any Medusa backend and you want to access the options
* added for the plugin, you can access it in the constructor.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} config - If this notification provider is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
Expand Down Expand Up @@ -264,7 +264,7 @@ export abstract class AbstractNotificationService
* export default EmailSenderService
*/
protected constructor(
protected readonly container: MedusaContainer,
protected readonly container: Record<string, unknown>,
protected readonly config?: Record<string, unknown> // eslint-disable-next-line @typescript-eslint/no-empty-function
) {
super(container, config)
Expand Down
4 changes: 2 additions & 2 deletions packages/medusa/src/interfaces/payment-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ export abstract class AbstractPaymentProcessor implements PaymentProcessor {
* Additionally, if you’re creating your Payment Processor as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin,
* you can access it in the constructor. The options are passed as a second parameter.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend through [dependency injection](https://docs.medusajs.com/development/fundamentals/dependency-injection)
* @param {Record<string, unknown>} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend through [dependency injection](https://docs.medusajs.com/development/fundamentals/dependency-injection)
* @param {Record<string, unknown>} config - If this fulfillment provider is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
Expand All @@ -672,7 +672,7 @@ export abstract class AbstractPaymentProcessor implements PaymentProcessor {
* ```
*/
protected constructor(
protected readonly container: MedusaContainer,
protected readonly container: Record<string, unknown>,
protected readonly config?: Record<string, unknown> // eslint-disable-next-line @typescript-eslint/no-empty-function
) {}

Expand Down
4 changes: 2 additions & 2 deletions packages/medusa/src/interfaces/price-selection-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export abstract class AbstractPriceSelectionStrategy
/**
* You can use the `constructor` of your price-selection strategy to access the different services in Medusa through dependency injection.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} config - If this price-selection strategy is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
Expand Down Expand Up @@ -254,7 +254,7 @@ export abstract class AbstractPriceSelectionStrategy
* export default MyStrategy
*/
protected constructor(
protected readonly container: MedusaContainer,
protected readonly container: Record<string, unknown>,
protected readonly config?: Record<string, unknown> // eslint-disable-next-line @typescript-eslint/no-empty-function
) {
super(container, config)
Expand Down
4 changes: 2 additions & 2 deletions packages/medusa/src/interfaces/tax-calculation-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export abstract class AbstractTaxCalculationStrategy
* You can also use the constructor to initialize your integration with the third-party provider. For example, if you use a client to connect to the third-party provider’s APIs, you can initialize it in the constructor and use it in other methods in the service.
* Additionally, if you’re creating your tax calculation strategy as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin, you can access it in the constructor.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} config - If this tax calculation strategy is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
Expand Down Expand Up @@ -156,7 +156,7 @@ export abstract class AbstractTaxCalculationStrategy
* export default TaxCalculationStrategy
*/
protected constructor(
protected readonly container: MedusaContainer,
protected readonly container: Record<string, unknown>,
protected readonly config?: Record<string, unknown> // eslint-disable-next-line @typescript-eslint/no-empty-function
) {
super(container, config)
Expand Down
4 changes: 2 additions & 2 deletions packages/medusa/src/interfaces/tax-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export abstract class AbstractTaxService
* You can also use the constructor to initialize your integration with the third-party provider. For example, if you use a client to connect to the third-party provider’s APIs, you can initialize it in the constructor and use it in other methods in the service.
* Additionally, if you’re creating your tax provider as an external plugin to be installed on any Medusa backend and you want to access the options added for the plugin, you can access it in the constructor.
*
* @param {MedusaContainer} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} container - An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend.
* @param {Record<string, unknown>} config - If this tax provider is created in a plugin, the plugin's options are passed in this parameter.
*
* @example
Expand Down Expand Up @@ -235,7 +235,7 @@ export abstract class AbstractTaxService
* export default MyTaxService
*/
protected constructor(
protected readonly container: MedusaContainer,
protected readonly container: Record<string, unknown>,
protected readonly config?: Record<string, unknown> // eslint-disable-next-line @typescript-eslint/no-empty-function
) {
super(container, config)
Expand Down

0 comments on commit 3ded231

Please sign in to comment.