* init * remove date string validator; * add transformOptionalDate transformer to api * move type conversion to the datalayer * fix final module integration test * update arrow-function * make string optional * move work to utils * make check for value exists * move util back to pricng * change utils * refactor get-iso-string * fix build * flip transform condition * add null check for isDate * feat(pricing): Separate Pricing Module internal types from `@medusajs/types` (#5777) * create types for pricing repositories * create RepositoryTypes input * add service types * use models for repository types * fix build * update types to match interface types * add aliases * types instead of moduletypes * move repository to types for pricing module * add changeset * fix merge error * fix conflict * fix build * re-add validation of dates in updatePriceLists_
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import {
|
|
ExternalModuleDeclaration,
|
|
InternalModuleDeclaration,
|
|
MODULE_PACKAGE_NAMES,
|
|
MedusaModule,
|
|
Modules,
|
|
} from "@medusajs/modules-sdk"
|
|
import { IPricingModuleService, ModulesSdkTypes } from "@medusajs/types"
|
|
|
|
import { InitializeModuleInjectableDependencies } from "@types"
|
|
import { moduleDefinition } from "../module-definition"
|
|
|
|
export const initialize = async (
|
|
options?:
|
|
| ModulesSdkTypes.ModuleServiceInitializeOptions
|
|
| ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions
|
|
| ExternalModuleDeclaration
|
|
| InternalModuleDeclaration,
|
|
injectedDependencies?: InitializeModuleInjectableDependencies
|
|
): Promise<IPricingModuleService> => {
|
|
const serviceKey = Modules.PRICING
|
|
|
|
const loaded = await MedusaModule.bootstrap<IPricingModuleService>({
|
|
moduleKey: serviceKey,
|
|
defaultPath: MODULE_PACKAGE_NAMES[Modules.PRICING],
|
|
declaration: options as
|
|
| InternalModuleDeclaration
|
|
| ExternalModuleDeclaration,
|
|
injectedDependencies,
|
|
moduleExports: moduleDefinition,
|
|
})
|
|
|
|
return loaded[serviceKey]
|
|
}
|