chores(medusa): cleanup registrations life time (#3699)
This commit is contained in:
1 parent
4c268238a4
commit
914d57336b
6 files changed
+28
-23
No files matched your search
@@ -28,7 +28,7 @@ export function registerPaymentServiceFromClass(
|
||||
container.registerAdd(
|
||||
"paymentProviders",
|
||||
asFunction((cradle) => new klass(cradle, pluginDetails.options), {
|
||||
lifetime: klass.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: klass.LIFE_TIME || Lifetime.SINGLETON,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ export function registerPaymentServiceFromClass(
|
||||
[registrationName]: asFunction(
|
||||
(cradle) => new klass(cradle, pluginDetails.options),
|
||||
{
|
||||
lifetime: klass.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: klass.LIFE_TIME || Lifetime.SINGLETON,
|
||||
}
|
||||
),
|
||||
[`pp_${(klass as unknown as typeof AbstractPaymentService).identifier}`]:
|
||||
@@ -59,7 +59,7 @@ export function registerPaymentProcessorFromClass(
|
||||
container.registerAdd(
|
||||
"paymentProviders",
|
||||
asFunction((cradle) => new klass(cradle, pluginDetails.options), {
|
||||
lifetime: klass.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: klass.LIFE_TIME || Lifetime.SINGLETON,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ export function registerPaymentProcessorFromClass(
|
||||
[registrationName]: asFunction(
|
||||
(cradle) => new klass(cradle, pluginDetails.options),
|
||||
{
|
||||
lifetime: klass.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: klass.LIFE_TIME || Lifetime.SINGLETON,
|
||||
}
|
||||
),
|
||||
[`pp_${(klass as unknown as typeof AbstractPaymentProcessor).identifier}`]:
|
||||
|
||||
@@ -385,7 +385,7 @@ export async function registerServices(
|
||||
[`${name}Oauth`]: asFunction(
|
||||
(cradle) => new loaded(cradle, pluginDetails.options),
|
||||
{
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.SINGLETON,
|
||||
}
|
||||
),
|
||||
})
|
||||
@@ -394,7 +394,7 @@ export async function registerServices(
|
||||
container.registerAdd(
|
||||
"fulfillmentProviders",
|
||||
asFunction((cradle) => new loaded(cradle, pluginDetails.options), {
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.SINGLETON,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -413,7 +413,7 @@ export async function registerServices(
|
||||
container.registerAdd(
|
||||
"notificationProviders",
|
||||
asFunction((cradle) => new loaded(cradle, pluginDetails.options), {
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.SINGLETON,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -438,7 +438,7 @@ export async function registerServices(
|
||||
[name]: asFunction(
|
||||
(cradle) => new loaded(cradle, pluginDetails.options),
|
||||
{
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.SINGLETON,
|
||||
}
|
||||
),
|
||||
[`fileService`]: aliasTo(name),
|
||||
@@ -450,7 +450,7 @@ export async function registerServices(
|
||||
[name]: asFunction(
|
||||
(cradle) => new loaded(cradle, pluginDetails.options),
|
||||
{
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.SINGLETON,
|
||||
}
|
||||
),
|
||||
[`searchService`]: aliasTo(name),
|
||||
@@ -461,7 +461,7 @@ export async function registerServices(
|
||||
container.registerAdd(
|
||||
"taxProviders",
|
||||
asFunction((cradle) => new loaded(cradle, pluginDetails.options), {
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.SINGLETON,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -479,7 +479,7 @@ export async function registerServices(
|
||||
[name]: asFunction(
|
||||
(cradle) => new loaded(cradle, pluginDetails.options),
|
||||
{
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.TRANSIENT,
|
||||
lifetime: loaded.LIFE_TIME || Lifetime.SCOPED,
|
||||
}
|
||||
),
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user