From c726ed54f5a1c4f22199f095a679e746358257e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20Poli=C4=87?= <16856471+fPolic@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:37:56 +0200 Subject: [PATCH 1/9] fix(pricing): price set update deletes price list prices (#9308) **Why** - price set update uses `upsertWithReplace` so price list prices are removed since we "ignore" them in regular price set operations and use price list methods to manage them **What** - preserve price list prices when updating price sets --- FIXES CC-516 --- .../services/pricing-module/price-set.spec.ts | 87 +++++++++++++++++++ .../pricing/src/services/pricing-module.ts | 37 ++++++-- 2 files changed, 116 insertions(+), 8 deletions(-) diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts index a28a95af78374..505e34dd88e0f 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-set.spec.ts @@ -402,6 +402,93 @@ moduleIntegrationTestRunner({ ) }) + it("should update price set prices and preserve price list prices", async () => { + const priceSetBefore = await service.retrievePriceSet(id, { + relations: ["prices"], + }) + + const [pl] = await service.createPriceLists([ + { + title: "test", + description: "test", + + prices: [ + { + amount: 400, + currency_code: "EUR", + price_set_id: priceSetBefore.id, + }, + ], + }, + ]) + + const updateResponse = await service.updatePriceSets( + priceSetBefore.id, + { + prices: [ + { amount: 100, currency_code: "USD" }, + { amount: 200, currency_code: "EUR" }, + ], + } + ) + + const priceSetAfter = await service.retrievePriceSet(id, { + relations: ["prices"], + }) + + expect(priceSetBefore.prices).toHaveLength(1) + expect(priceSetBefore.prices?.[0]).toEqual( + expect.objectContaining({ + amount: 500, + currency_code: "USD", + }) + ) + + // Price list prices are not present in this response + expect(priceSetAfter.prices).toHaveLength(2) + expect(priceSetAfter.prices).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + amount: 100, + currency_code: "USD", + }), + expect.objectContaining({ + amount: 200, + currency_code: "EUR", + }), + ]) + ) + expect(updateResponse.prices).toHaveLength(2) + expect(updateResponse.prices).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + amount: 100, + currency_code: "USD", + }), + expect.objectContaining({ + amount: 200, + currency_code: "EUR", + }), + ]) + ) + + const plAfter = await service.retrievePriceList(pl.id, { + relations: ["prices"], + }) + + // Price list prices are preserved + expect(plAfter.prices).toHaveLength(1) + expect(plAfter.prices).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + amount: 400, + currency_code: "EUR", + price_set_id: priceSetBefore.id, + }), + ]) + ) + }) + it("should upsert the later price when setting a price set with existing equivalent rules", async () => { await service.updatePriceSets(id, { prices: [ diff --git a/packages/modules/pricing/src/services/pricing-module.ts b/packages/modules/pricing/src/services/pricing-module.ts index c6d9d0d457be8..0d02c2defad63 100644 --- a/packages/modules/pricing/src/services/pricing-module.ts +++ b/packages/modules/pricing/src/services/pricing-module.ts @@ -515,6 +515,11 @@ export default class PricingModuleService // We can make the `insert` inside upsertWithReplace do an `upsert` instead to avoid this const normalizedData = await this.normalizeUpdateData(data) + const priceListPrices = await this.priceService_.list({ + price_set_id: normalizedData.map(({ id }) => id), + price_list_id: { $ne: null }, + }) + const prices = normalizedData.flatMap((priceSet) => priceSet.prices || []) const { entities: upsertedPrices } = await this.priceService_.upsertWithReplace( @@ -527,13 +532,23 @@ export default class PricingModuleService const { prices, ...rest } = priceSet return { ...rest, - prices: upsertedPrices - .filter((p) => p.price_set_id === priceSet.id) - .map((price) => { - // @ts-ignore - delete price.price_rules - return price - }), + prices: [ + ...upsertedPrices + .filter((p) => p.price_set_id === priceSet.id) + .map((price) => { + // @ts-ignore + delete price.price_rules + return price + }), + ...priceListPrices + .filter((p) => p.price_set_id === priceSet.id) + .map((price) => ({ + id: price.id, + amount: price.amount, + price_set_id: price.price_set_id, + price_list_id: price.price_list_id, + })), + ], } }) @@ -544,7 +559,13 @@ export default class PricingModuleService sharedContext ) - return priceSets + return priceSets.map((ps) => { + if (ps.prices) { + ps.prices = (ps.prices as any).filter((p) => !p.price_list_id) + } + + return ps + }) } private async normalizeUpdateData(data: ServiceTypes.UpdatePriceSetInput[]) { From 2e16949979a509fdbd8ee8a1356b02be5b93cf68 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 1 Oct 2024 12:03:42 +0300 Subject: [PATCH 2/9] docs: update imports and package names across docs (#9375) * docs: update imports and package names across docs + reference configs * generate files * fix import * change preview to rc --- .../admin/widgets/page.mdx | 2 +- .../api-routes/additional-data/page.mdx | 6 +- .../api-routes/cors/page.mdx | 4 +- .../api-routes/errors/page.mdx | 6 +- .../api-routes/protected-routes/page.mdx | 8 +- .../custom-cli-scripts/page.mdx | 6 +- .../data-models/configure-properties/page.mdx | 6 +- .../data-models/index/page.mdx | 10 +- .../data-models/infer-type/page.mdx | 6 +- .../data-models/primary-key/page.mdx | 2 +- .../data-models/property-types/page.mdx | 20 +- .../data-models/relationships/page.mdx | 10 +- .../data-models/searchable-property/page.mdx | 2 +- .../emit-event/page.mdx | 6 +- .../modules/container/page.mdx | 2 +- .../modules/module-links/page.mdx | 14 +- .../modules/options/page.mdx | 4 +- .../modules/query/page.mdx | 2 +- .../modules/remote-link/page.mdx | 12 +- .../modules/service-constraints/page.mdx | 2 +- .../modules/service-factory/page.mdx | 4 +- .../workflows/add-workflow-hook/page.mdx | 4 +- .../workflows/compensation-function/page.mdx | 10 +- .../workflows/conditions/page.mdx | 4 +- .../constructor-constraints/page.mdx | 8 +- .../execute-another-workflow/page.mdx | 18 +- .../workflows/long-running-workflow/page.mdx | 14 +- .../workflows/parallel-steps/page.mdx | 4 +- .../workflows/retry-failed-steps/page.mdx | 2 +- .../workflows/variable-manipulation/page.mdx | 6 +- .../workflows/workflow-hooks/page.mdx | 8 +- .../workflows/workflow-timeout/page.mdx | 2 +- .../book/app/basics/commerce-modules/page.mdx | 6 +- www/apps/book/app/basics/data-models/page.mdx | 4 +- .../basics/events-and-subscribers/page.mdx | 6 +- .../book/app/basics/medusa-container/page.mdx | 6 +- .../app/basics/modules-and-services/page.mdx | 4 +- .../book/app/basics/scheduled-jobs/page.mdx | 6 +- www/apps/book/app/basics/workflows/page.mdx | 20 +- .../custom-features/module/page.mdx | 8 +- .../custom-features/workflow/page.mdx | 4 +- .../customize-admin/widget/page.mdx | 2 +- .../extend-models/create-links/page.mdx | 6 +- .../extend-models/define-link/page.mdx | 6 +- .../extend-create-product/page.mdx | 6 +- .../query-linked-records/page.mdx | 2 +- .../integrate-systems/handle-event/page.mdx | 8 +- .../integrate-systems/schedule-task/page.mdx | 20 +- .../integrate-systems/service/page.mdx | 6 +- .../debugging-and-testing/logging/page.mdx | 2 +- .../integration-tests/api-routes/page.mdx | 2 +- .../integration-tests/workflows/page.mdx | 2 +- .../modules-tests/module-example/page.mdx | 2 +- .../testing-tools/modules-tests/page.mdx | 2 +- .../testing-tools/page.mdx | 4 +- www/apps/book/app/page.mdx | 2 +- www/apps/book/generated/edit-dates.mjs | 110 ++++----- .../app/admin-widget-injection-zones/page.mdx | 112 ++++----- .../cache/create/page.mdx | 8 +- .../cache/in-memory/page.mdx | 22 +- .../cache/redis/page.mdx | 22 +- .../event/create/page.mdx | 10 +- .../event/local/page.mdx | 20 +- .../event/redis/page.mdx | 20 +- .../architectural-modules/file/local/page.mdx | 24 +- .../architectural-modules/file/s3/page.mdx | 20 +- .../notification/local/page.mdx | 24 +- .../notification/page.mdx | 6 +- .../notification/send-notification/page.mdx | 4 +- .../notification/sendgrid/page.mdx | 26 +- .../workflow-engine/in-memory/page.mdx | 20 +- .../workflow-engine/redis/page.mdx | 18 +- .../api-key/examples/page.mdx | 30 +-- .../app/commerce-modules/api-key/page.mdx | 18 +- .../auth/auth-providers/emailpass/page.mdx | 8 +- .../auth/auth-providers/github/page.mdx | 16 +- .../auth/auth-providers/google/page.mdx | 16 +- .../auth/create-actor-type/page.mdx | 18 +- .../commerce-modules/auth/examples/page.mdx | 40 +-- .../auth/module-options/page.mdx | 6 +- .../app/commerce-modules/auth/page.mdx | 18 +- .../commerce-modules/cart/examples/page.mdx | 50 ++-- .../app/commerce-modules/cart/page.mdx | 18 +- .../commerce-modules/cart/promotions/page.mdx | 4 +- .../currency/examples/page.mdx | 12 +- .../app/commerce-modules/currency/page.mdx | 18 +- .../customer/examples/page.mdx | 24 +- .../app/commerce-modules/customer/page.mdx | 18 +- .../fulfillment/module-options/page.mdx | 6 +- .../app/commerce-modules/fulfillment/page.mdx | 18 +- .../inventory/examples/page.mdx | 54 ++--- .../app/commerce-modules/inventory/page.mdx | 18 +- .../app/commerce-modules/order/page.mdx | 18 +- .../order/promotion-adjustments/page.mdx | 4 +- .../payment/examples/page.mdx | 36 +-- .../payment/module-options/page.mdx | 6 +- .../app/commerce-modules/payment/page.mdx | 18 +- .../payment/payment-provider/page.mdx | 2 +- .../payment/payment-provider/stripe/page.mdx | 22 +- .../pricing/examples/page.mdx | 40 +-- .../app/commerce-modules/pricing/page.mdx | 18 +- .../product/examples/page.mdx | 36 +-- .../product/guides/price-with-taxes/page.mdx | 12 +- .../product/guides/price/page.mdx | 2 +- .../app/commerce-modules/product/page.mdx | 18 +- .../promotion/examples/page.mdx | 24 +- .../app/commerce-modules/promotion/page.mdx | 18 +- .../commerce-modules/region/examples/page.mdx | 30 +-- .../app/commerce-modules/region/page.mdx | 18 +- .../sales-channel/examples/page.mdx | 30 +-- .../commerce-modules/sales-channel/page.mdx | 18 +- .../stock-location/examples/page.mdx | 24 +- .../commerce-modules/stock-location/page.mdx | 18 +- .../commerce-modules/store/examples/page.mdx | 30 +-- .../app/commerce-modules/store/page.mdx | 18 +- .../commerce-modules/tax/examples/page.mdx | 30 +-- .../tax/module-options/page.mdx | 4 +- .../app/commerce-modules/tax/page.mdx | 18 +- .../commerce-modules/user/examples/page.mdx | 42 ++-- .../user/module-options/page.mdx | 4 +- .../app/commerce-modules/user/page.mdx | 18 +- .../medusa-application/railway/page.mdx | 12 +- .../app/medusa-container-resources/page.mdx | 4 +- .../app/medusa-workflows-reference/page.mdx | 2 +- www/apps/resources/app/recipes/b2b/page.mdx | 18 +- .../app/recipes/commerce-automation/page.mdx | 28 +-- .../examples/standard/page.mdx | 102 ++++---- .../resources/app/recipes/ecommerce/page.mdx | 2 +- .../integrate-ecommerce-stack/page.mdx | 14 +- .../examples/restaurant-delivery/page.mdx | 160 ++++++------ .../marketplace/examples/vendors/page.mdx | 70 +++--- www/apps/resources/app/recipes/pos/page.mdx | 6 +- .../subscriptions/examples/standard/page.mdx | 88 +++---- .../app/storefront-development/tips/page.mdx | 2 +- .../outdated-preview.mdx | 4 +- .../resources/app/troubleshooting/page.mdx | 4 +- www/apps/resources/generated/edit-dates.mjs | 228 ++++++++++-------- .../page.mdx | 24 +- .../page.mdx | 4 +- .../page.mdx | 4 +- .../page.mdx | 2 +- .../page.mdx | 4 +- .../page.mdx | 6 +- .../core_flows.Common.Steps_Common/page.mdx | 20 +- .../core_flows.Steps_Common/page.mdx | 20 +- .../dml.Model_Methods.cascades/page.mdx | 2 +- .../dml.Model_Methods.indexes/page.mdx | 6 +- .../page.mdx | 2 +- .../page.mdx | 2 +- .../page.mdx | 2 +- .../page.mdx | 2 +- .../methods/dml.Property_Types.array/page.mdx | 2 +- .../dml.Property_Types.bigNumber/page.mdx | 2 +- .../dml.Property_Types.boolean/page.mdx | 2 +- .../dml.Property_Types.dateTime/page.mdx | 2 +- .../methods/dml.Property_Types.enum/page.mdx | 2 +- .../methods/dml.Property_Types.id/page.mdx | 2 +- .../methods/dml.Property_Types.json/page.mdx | 2 +- .../dml.Property_Types.number/page.mdx | 2 +- .../methods/dml.Property_Types.text/page.mdx | 2 +- .../dml.Relationship_Methods.hasMany/page.mdx | 2 +- .../dml.Relationship_Methods.hasOne/page.mdx | 2 +- .../page.mdx | 2 +- .../page.mdx | 2 +- .../file.AbstractFileProviderService/page.mdx | 10 +- .../page.mdx | 6 +- .../page.mdx | 4 +- .../page.mdx | 4 +- .../helper_steps.emitEventStep/page.mdx | 2 +- .../page.mdx | 4 +- .../helper_steps.useRemoteQueryStep/page.mdx | 6 +- .../medusa_config.ConfigModule/page.mdx | 2 +- .../references/modules/core_flows/page.mdx | 20 +- .../references/modules/workflows/page.mdx | 2 +- .../page.mdx | 12 +- .../page.mdx | 32 +-- .../search.AbstractSearchService/page.mdx | 8 +- .../tax_provider.ITaxProvider/page.mdx | 4 +- .../types.CommonTypes.ConfigModule/page.mdx | 2 +- .../types.DetailWidgetProps/page.mdx | 2 +- .../page.mdx | 2 +- .../functions/workflows.createHook/page.mdx | 4 +- .../functions/workflows.createStep/page.mdx | 4 +- .../workflows.createWorkflow/page.mdx | 4 +- .../functions/workflows.parallelize/page.mdx | 4 +- .../functions/workflows.transform/page.mdx | 4 +- .../functions/workflows.when/page.mdx | 2 +- .../merger-custom-options/auth-provider.ts | 8 +- .../merger-custom-options/core-flows.ts | 4 +- .../constants/merger-custom-options/file.ts | 8 +- .../fulfillment-provider.ts | 8 +- .../merger-custom-options/helper-steps.ts | 4 +- .../merger-custom-options/notification.ts | 8 +- .../merger-custom-options/payment-provider.ts | 8 +- .../constants/merger-custom-options/search.ts | 2 +- .../merger-custom-options/workflows.ts | 4 +- 196 files changed, 1379 insertions(+), 1491 deletions(-) diff --git a/www/apps/book/app/advanced-development/admin/widgets/page.mdx b/www/apps/book/app/advanced-development/admin/widgets/page.mdx index 47f0a385b07c9..a1ae8871f6481 100644 --- a/www/apps/book/app/advanced-development/admin/widgets/page.mdx +++ b/www/apps/book/app/advanced-development/admin/widgets/page.mdx @@ -94,7 +94,7 @@ import { Container, Heading } from "@medusajs/ui" import { DetailWidgetProps, AdminProduct, -} from "@medusajs/types" +} from "@medusajs/framework/types" // The widget const ProductWidget = ({ diff --git a/www/apps/book/app/advanced-development/api-routes/additional-data/page.mdx b/www/apps/book/app/advanced-development/api-routes/additional-data/page.mdx index e90528ae2e7c6..31c7ce6dbb9f3 100644 --- a/www/apps/book/app/advanced-development/api-routes/additional-data/page.mdx +++ b/www/apps/book/app/advanced-development/api-routes/additional-data/page.mdx @@ -135,9 +135,9 @@ For example, consider you want to store the data passed in `additional_data` in To do that, create the file `src/workflows/hooks/product-created.ts` with the following content: ```ts title="src/workflows/hooks/product-created.ts" -import { StepResponse } from "@medusajs/workflows-sdk" -import { createProductsWorkflow } from "@medusajs/core-flows" -import { Modules } from "@medusajs/utils" +import { StepResponse } from "@medusajs/framework/workflows-sdk" +import { createProductsWorkflow } from "@medusajs/medusa/core-flows" +import { Modules } from "@medusajs/framework/utils" createProductsWorkflow.hooks.productsCreated( async ({ products, additional_data }, { container }) => { diff --git a/www/apps/book/app/advanced-development/api-routes/cors/page.mdx b/www/apps/book/app/advanced-development/api-routes/cors/page.mdx index 48f5244e567ac..f193c26b41481 100644 --- a/www/apps/book/app/advanced-development/api-routes/cors/page.mdx +++ b/www/apps/book/app/advanced-development/api-routes/cors/page.mdx @@ -87,8 +87,8 @@ import type { MedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { ConfigModule } from "@medusajs/types" -import { parseCorsOrigins } from "@medusajs/utils" +import { ConfigModule } from "@medusajs/framework/types" +import { parseCorsOrigins } from "@medusajs/framework/utils" import cors from "cors" export default defineMiddlewares({ diff --git a/www/apps/book/app/advanced-development/api-routes/errors/page.mdx b/www/apps/book/app/advanced-development/api-routes/errors/page.mdx index f4b09b6b0fa7f..7151b12850ad0 100644 --- a/www/apps/book/app/advanced-development/api-routes/errors/page.mdx +++ b/www/apps/book/app/advanced-development/api-routes/errors/page.mdx @@ -10,7 +10,7 @@ In this guide, you'll learn how to throw errors in your Medusa application, how ## Throw MedusaError -When throwing an error in your API routes, middlewares, workflows, or any customization, throw a `MedusaError`, which is imported from `@medusajs/utils`. +When throwing an error in your API routes, middlewares, workflows, or any customization, throw a `MedusaError`, which is imported from `@medusajs/framework/utils`. The Medusa application's API route error handler then wraps your thrown error in a uniform object and returns it in the response. @@ -18,7 +18,7 @@ For example: ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" export const GET = async ( req: MedusaRequest, @@ -258,7 +258,7 @@ import { MedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" export default defineMiddlewares({ errorHandler: ( diff --git a/www/apps/book/app/advanced-development/api-routes/protected-routes/page.mdx b/www/apps/book/app/advanced-development/api-routes/protected-routes/page.mdx index 163b9257c20dc..46706bb2b2ff1 100644 --- a/www/apps/book/app/advanced-development/api-routes/protected-routes/page.mdx +++ b/www/apps/book/app/advanced-development/api-routes/protected-routes/page.mdx @@ -125,8 +125,8 @@ import type { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { Modules } from "@medusajs/utils" -import { ICustomerModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/framework/utils" +import { ICustomerModuleService } from "@medusajs/framework/types" export const GET = async ( req: AuthenticatedMedusaRequest, @@ -160,8 +160,8 @@ import type { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { Modules } from "@medusajs/utils" -import { IUserModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/framework/utils" +import { IUserModuleService } from "@medusajs/framework/types" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/www/apps/book/app/advanced-development/custom-cli-scripts/page.mdx b/www/apps/book/app/advanced-development/custom-cli-scripts/page.mdx index 366153061daf7..847045051d196 100644 --- a/www/apps/book/app/advanced-development/custom-cli-scripts/page.mdx +++ b/www/apps/book/app/advanced-development/custom-cli-scripts/page.mdx @@ -22,8 +22,8 @@ For example, create the file `src/scripts/my-script.ts` with the following conte import { ExecArgs, IProductModuleService, -} from "@medusajs/types" -import { Modules } from "@medusajs/utils" +} from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export default async function myScript({ container }: ExecArgs) { const productModuleService: IProductModuleService = container.resolve( @@ -58,7 +58,7 @@ Your script can accept arguments from the command line. Arguments are passed to For example: ```ts -import { ExecArgs } from "@medusajs/types" +import { ExecArgs } from "@medusajs/framework/types" export default async function myScript({ args }: ExecArgs) { console.log(`The arguments you passed: ${args}`) diff --git a/www/apps/book/app/advanced-development/data-models/configure-properties/page.mdx b/www/apps/book/app/advanced-development/data-models/configure-properties/page.mdx index 7739769bd5cde..bf9ecaf7ff69a 100644 --- a/www/apps/book/app/advanced-development/data-models/configure-properties/page.mdx +++ b/www/apps/book/app/advanced-development/data-models/configure-properties/page.mdx @@ -18,7 +18,7 @@ export const defaultHighlights = [ ] ```ts highlights={defaultHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { color: model @@ -48,7 +48,7 @@ export const nullableHighlights = [ ] ```ts highlights={nullableHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { price: model.bigNumber().nullable(), @@ -71,7 +71,7 @@ export const uniqueHighlights = [ ] ```ts highlights={uniqueHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const User = model.define("user", { email: model.text().unique(), diff --git a/www/apps/book/app/advanced-development/data-models/index/page.mdx b/www/apps/book/app/advanced-development/data-models/index/page.mdx index e1babac983bff..b66ad3bbaf829 100644 --- a/www/apps/book/app/advanced-development/data-models/index/page.mdx +++ b/www/apps/book/app/advanced-development/data-models/index/page.mdx @@ -18,7 +18,7 @@ export const highlights = [ ] ```ts highlights={highlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), @@ -48,7 +48,7 @@ export const dataModelIndexHighlights = [ ] ```ts highlights={dataModelIndexHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), @@ -77,7 +77,7 @@ export const conditionHighlights = [ ] ```ts highlights={conditionHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), @@ -106,7 +106,7 @@ export const negationHighlights = [ ] ```ts highlights={negationHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), @@ -141,7 +141,7 @@ export const uniqueHighlights = [ ] ```ts highlights={uniqueHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), diff --git a/www/apps/book/app/advanced-development/data-models/infer-type/page.mdx b/www/apps/book/app/advanced-development/data-models/infer-type/page.mdx index 9db0843586d4d..6191f160e85f9 100644 --- a/www/apps/book/app/advanced-development/data-models/infer-type/page.mdx +++ b/www/apps/book/app/advanced-development/data-models/infer-type/page.mdx @@ -10,12 +10,12 @@ In this chapter, you'll learn how to infer the type of a data model. Consider you have a `MyCustom` data model. You can't reference this data model in a type, such as a workflow input or service method output types, since it's a variable. -Instead, Medusa provides an `InferTypeOf` utility imported from `@medusajs/types` that transforms your data model to a type. +Instead, Medusa provides an `InferTypeOf` utility imported from `@medusajs/framework/types` that transforms your data model to a type. For example: ```ts -import { InferTypeOf } from "@medusajs/types" +import { InferTypeOf } from "@medusajs/framework/types" import { MyCustom } from "../models/my-custom" // relative path to the model export type MyCustom = InferTypeOf @@ -29,7 +29,7 @@ You can now use the `MyCustom` type to reference a data model in other types, su ```ts title="Example Service" // other imports... -import { InferTypeOf } from "@medusajs/types" +import { InferTypeOf } from "@medusajs/framework/types" import { MyCustom } from "../models/my-custom" type MyCustom = InferTypeOf diff --git a/www/apps/book/app/advanced-development/data-models/primary-key/page.mdx b/www/apps/book/app/advanced-development/data-models/primary-key/page.mdx index d88c910670237..6d378228ba33b 100644 --- a/www/apps/book/app/advanced-development/data-models/primary-key/page.mdx +++ b/www/apps/book/app/advanced-development/data-models/primary-key/page.mdx @@ -17,7 +17,7 @@ export const highlights = [ ] ```ts highlights={highlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), diff --git a/www/apps/book/app/advanced-development/data-models/property-types/page.mdx b/www/apps/book/app/advanced-development/data-models/property-types/page.mdx index b2ca1f28298d2..aa747de235a2e 100644 --- a/www/apps/book/app/advanced-development/data-models/property-types/page.mdx +++ b/www/apps/book/app/advanced-development/data-models/property-types/page.mdx @@ -6,7 +6,7 @@ export const metadata = { In this chapter, you’ll learn about the types of properties in a data model’s schema. -These types are available as methods on the `model` utility imported from `@medusajs/utils`. +These types are available as methods on the `model` utility imported from `@medusajs/framework/utils`. ## id @@ -17,7 +17,7 @@ For example: export const idHighlights = [["4", ".id()", "Define an `id` property."]] ```ts highlights={idHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id(), @@ -38,7 +38,7 @@ For example: export const textHighlights = [["4", "text", "Define a `text` property."]] ```ts highlights={textHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { name: model.text(), @@ -59,7 +59,7 @@ For example: export const numberHighlights = [["4", "number", "Define a `number` property."]] ```ts highlights={numberHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { age: model.number(), @@ -80,7 +80,7 @@ For example: export const bigNumberHighlights = [["4", "bigNumber", "Define a `bigNumber` property."]] ```ts highlights={bigNumberHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { price: model.bigNumber(), @@ -101,7 +101,7 @@ For example: export const booleanHighlights = [["4", "boolean", "Define a `boolean` property."]] ```ts highlights={booleanHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { hasAccount: model.boolean(), @@ -122,7 +122,7 @@ For example: export const enumHighlights = [["4", "enum", "Define a `enum` property."]] ```ts highlights={enumHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { color: model.enum(["black", "white"]), @@ -145,7 +145,7 @@ For example: export const dateTimeHighlights = [["4", "dateTime", "Define a `dateTime` property."]] ```ts highlights={dateTimeHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { date_of_birth: model.dateTime(), @@ -166,7 +166,7 @@ For example: export const jsonHighlights = [["4", "json", "Define a `json` property."]] ```ts highlights={jsonHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { metadata: model.json(), @@ -187,7 +187,7 @@ For example: export const arrHightlights = [["4", "array", "Define an `array` property."]] ```ts highlights={arrHightlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { names: model.array(), diff --git a/www/apps/book/app/advanced-development/data-models/relationships/page.mdx b/www/apps/book/app/advanced-development/data-models/relationships/page.mdx index 9946a51ac39c4..47078fa2136c8 100644 --- a/www/apps/book/app/advanced-development/data-models/relationships/page.mdx +++ b/www/apps/book/app/advanced-development/data-models/relationships/page.mdx @@ -46,7 +46,7 @@ export const oneToOneHighlights = [ ] ```ts highlights={oneToOneHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const User = model.define("user", { id: model.id().primaryKey(), @@ -100,7 +100,7 @@ export const oneToManyHighlights = [ ] ```ts highlights={oneToManyHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const Store = model.define("store", { id: model.id().primaryKey(), @@ -146,7 +146,7 @@ export const manyToManyHighlights = [ ] ```ts highlights={manyToManyHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const Order = model.define("order", { id: model.id().primaryKey(), @@ -193,7 +193,7 @@ export const relationNameHighlights = [ ] ```ts highlights={relationNameHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const User = model.define("user", { id: model.id().primaryKey(), @@ -229,7 +229,7 @@ export const highlights = [ ] ```ts highlights={highlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const Store = model.define("store", { id: model.id().primaryKey(), diff --git a/www/apps/book/app/advanced-development/data-models/searchable-property/page.mdx b/www/apps/book/app/advanced-development/data-models/searchable-property/page.mdx index d35148b74feab..b1dbeb9d65e79 100644 --- a/www/apps/book/app/advanced-development/data-models/searchable-property/page.mdx +++ b/www/apps/book/app/advanced-development/data-models/searchable-property/page.mdx @@ -25,7 +25,7 @@ export const searchableHighlights = [ ] ```ts highlights={searchableHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { name: model.text().searchable(), diff --git a/www/apps/book/app/advanced-development/events-and-subscribers/emit-event/page.mdx b/www/apps/book/app/advanced-development/events-and-subscribers/emit-event/page.mdx index f14ea2bc108f3..7f768aa385a34 100644 --- a/www/apps/book/app/advanced-development/events-and-subscribers/emit-event/page.mdx +++ b/www/apps/book/app/advanced-development/events-and-subscribers/emit-event/page.mdx @@ -8,7 +8,7 @@ In this chapter, you'll learn how to emit an event in a workflow. ## Emit Event Step -Medusa provides an `emitEventStep` helper step in the `@medusajs/core-flows` package that emits an event. +Medusa provides an `emitEventStep` helper step in the `@medusajs/medusa/core-flows` package that emits an event. When you emit an event, you specify the event's name and data payload to pass with the event. @@ -23,10 +23,10 @@ export const highlights = [ ```ts highlights={highlights} import { createWorkflow, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { emitEventStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" const helloWorldWorkflow = createWorkflow( "hello-world", diff --git a/www/apps/book/app/advanced-development/modules/container/page.mdx b/www/apps/book/app/advanced-development/modules/container/page.mdx index d97e33c6b56b6..61c03c7b3f31c 100644 --- a/www/apps/book/app/advanced-development/modules/container/page.mdx +++ b/www/apps/book/app/advanced-development/modules/container/page.mdx @@ -53,7 +53,7 @@ For example: ```ts highlights={[["9"]]} import { LoaderOptions, -} from "@medusajs/modules-sdk" +} from "@medusajs/framework/modules-sdk" import { Logger } from "@medusajs/medusa" export default async function helloWorldLoader({ diff --git a/www/apps/book/app/advanced-development/modules/module-links/page.mdx b/www/apps/book/app/advanced-development/modules/module-links/page.mdx index ac02b1db54dd5..8f9690bc1ce11 100644 --- a/www/apps/book/app/advanced-development/modules/module-links/page.mdx +++ b/www/apps/book/app/advanced-development/modules/module-links/page.mdx @@ -32,7 +32,7 @@ You want to create a relationship between data models in the same module. Use da ### 1. Create Link File -Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines the link using the `defineLink` function imported from `@medusajs/utils` and exports it. +Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines the link using the `defineLink` function imported from `@medusajs/framework/utils` and exports it. For example: @@ -43,8 +43,8 @@ export const highlights = [ ```ts title="src/links/hello-product.ts" highlights={highlights} import HelloModule from "../modules/hello" -import ProductModule from "@medusajs/product" -import { defineLink } from "@medusajs/utils" +import ProductModule from "@medusajs/medusa/product" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( ProductModule.linkable.product, @@ -84,8 +84,8 @@ For example: ```ts import HelloModule from "../modules/hello" -import ProductModule from "@medusajs/product" -import { defineLink } from "@medusajs/utils" +import ProductModule from "@medusajs/medusa/product" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( ProductModule.linkable.product, @@ -130,8 +130,8 @@ For example: ```ts import HelloModule from "../modules/hello" -import ProductModule from "@medusajs/product" -import { defineLink } from "@medusajs/utils" +import ProductModule from "@medusajs/medusa/product" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( ProductModule.linkable.product, diff --git a/www/apps/book/app/advanced-development/modules/options/page.mdx b/www/apps/book/app/advanced-development/modules/options/page.mdx index d3f5f93930196..f76f39bd113d5 100644 --- a/www/apps/book/app/advanced-development/modules/options/page.mdx +++ b/www/apps/book/app/advanced-development/modules/options/page.mdx @@ -47,7 +47,7 @@ The module’s main service receives the module options as a second parameter. For example: ```ts title="src/modules/hello/service.ts" highlights={[["12"], ["14", "options?: ModuleOptions"], ["17"], ["18"], ["19"]]} -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import MyCustom from "./models/my-custom" // recommended to define type in another file @@ -83,7 +83,7 @@ For example: ```ts title="src/modules/hello/loaders/hello-world.ts" highlights={[["11"], ["12", "ModuleOptions", "The type of expected module options."], ["16"]]} import { LoaderOptions, -} from "@medusajs/modules-sdk" +} from "@medusajs/framework/modules-sdk" // recommended to define type in another file type ModuleOptions = { diff --git a/www/apps/book/app/advanced-development/modules/query/page.mdx b/www/apps/book/app/advanced-development/modules/query/page.mdx index 5ea407e4b4b66..6cbc612ec6ddf 100644 --- a/www/apps/book/app/advanced-development/modules/query/page.mdx +++ b/www/apps/book/app/advanced-development/modules/query/page.mdx @@ -40,7 +40,7 @@ import { } from "@medusajs/medusa" import { ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" export const GET = async ( req: MedusaRequest, diff --git a/www/apps/book/app/advanced-development/modules/remote-link/page.mdx b/www/apps/book/app/advanced-development/modules/remote-link/page.mdx index 691262dfe7bef..ef054f4ac453c 100644 --- a/www/apps/book/app/advanced-development/modules/remote-link/page.mdx +++ b/www/apps/book/app/advanced-development/modules/remote-link/page.mdx @@ -21,10 +21,10 @@ import { } from "@medusajs/medusa" import { ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { RemoteLink, -} from "@medusajs/modules-sdk" +} from "@medusajs/framework/modules-sdk" export async function POST( req: MedusaRequest, @@ -49,7 +49,7 @@ To create a link between records of two data models, use the `create` method of For example: ```ts -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" // ... @@ -84,7 +84,7 @@ To remove a link between records of two data models, use the `dismiss` method of For example: ```ts -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" // ... @@ -115,7 +115,7 @@ If a record is deleted, use the `delete` method of the remote link to delete all For example: ```ts -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" // ... @@ -139,7 +139,7 @@ If a record that was previously soft-deleted is now restored, use the `restore` For example: ```ts -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" // ... diff --git a/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx b/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx index a5414bd243b0e..d4607c959b9f3 100644 --- a/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx +++ b/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx @@ -13,7 +13,7 @@ Medusa wraps adds wrappers around your service's methods and executes them as as So, make sure your service's methods are always async to avoid unexpected errors or behavior. ```ts highlights={[["8", "", "Method must be async."], ["13", "async", "Correct way of defining the method."]]} -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import MyCustom from "./models/my-custom" class HelloModuleService extends MedusaService({ diff --git a/www/apps/book/app/advanced-development/modules/service-factory/page.mdx b/www/apps/book/app/advanced-development/modules/service-factory/page.mdx index 71623b16f304a..b4d2dbfb833d8 100644 --- a/www/apps/book/app/advanced-development/modules/service-factory/page.mdx +++ b/www/apps/book/app/advanced-development/modules/service-factory/page.mdx @@ -34,7 +34,7 @@ export const highlights = [ ] ```ts title="src/modules/hello/service.ts" highlights={highlights} -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import MyCustom from "./models/my-custom" class HelloModuleService extends MedusaService({ @@ -284,7 +284,7 @@ If you implement the `constructor` of your service, make sure to call `super` pa For example: ```ts highlights={[["8"]]} -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import MyCustom from "./models/my-custom" class HelloModuleService extends MedusaService({ diff --git a/www/apps/book/app/advanced-development/workflows/add-workflow-hook/page.mdx b/www/apps/book/app/advanced-development/workflows/add-workflow-hook/page.mdx index 2625de36e3c9f..5ab8883b95b81 100644 --- a/www/apps/book/app/advanced-development/workflows/add-workflow-hook/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/add-workflow-hook/page.mdx @@ -24,7 +24,7 @@ Your workflow isn't reusable by other applications. Use a step that performs wha ## How to Expose a Hook in a Workflow? -To expose a hook in your workflow, use the `createHook` function imported from `@medusajs/workflows-sdk`. +To expose a hook in your workflow, use the `createHook` function imported from `@medusajs/framework/workflows-sdk`. For example: @@ -41,7 +41,7 @@ import { createHook, createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createProductStep } from "./steps/create-product" export const myWorkflow = createWorkflow( diff --git a/www/apps/book/app/advanced-development/workflows/compensation-function/page.mdx b/www/apps/book/app/advanced-development/workflows/compensation-function/page.mdx index fb0c3b2a3397e..6d1ff1d434cc4 100644 --- a/www/apps/book/app/advanced-development/workflows/compensation-function/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/compensation-function/page.mdx @@ -26,7 +26,7 @@ For example, create the file `src/workflows/hello-world.ts` with the following c import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep( "step-1", @@ -66,7 +66,7 @@ Then, create a workflow that uses the steps: import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" // other imports... // steps... @@ -135,7 +135,7 @@ export const inputHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep( "step-1", @@ -172,8 +172,8 @@ export const containerHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" -import { ContainerRegistrationKeys } from "@medusajs/utils" +} from "@medusajs/framework/workflows-sdk" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" const step1 = createStep( "step-1", diff --git a/www/apps/book/app/advanced-development/workflows/conditions/page.mdx b/www/apps/book/app/advanced-development/workflows/conditions/page.mdx index fe7155101e997..fc4b73e99fc06 100644 --- a/www/apps/book/app/advanced-development/workflows/conditions/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/conditions/page.mdx @@ -37,7 +37,7 @@ import { createWorkflow, WorkflowResponse, when, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" // step imports... const workflow = createWorkflow( @@ -70,7 +70,7 @@ In this code snippet, you execute the `isActiveStep` only if the `input.is_activ ### When Parameters -`when` utility is a function imported from `@medusajs/workflows-sdk`. It accepts the following parameters: +`when` utility is a function imported from `@medusajs/framework/workflows-sdk`. It accepts the following parameters: 1. The first parameter is either an object or the workflow's input. This data is passed as a parameter to the function in `when`'s second parameter. 2. The second parameter is a function that returns a boolean indicating whether to execute the action in `then`. diff --git a/www/apps/book/app/advanced-development/workflows/constructor-constraints/page.mdx b/www/apps/book/app/advanced-development/workflows/constructor-constraints/page.mdx index 1bee88f1b82b4..7383e2c5ee576 100644 --- a/www/apps/book/app/advanced-development/workflows/constructor-constraints/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/constructor-constraints/page.mdx @@ -38,7 +38,7 @@ Learn more about why you can't manipulate variables [in this chapter](../conditi -Instead, use the `transform` utility function imported from `@medusajs/workflows-sdk`: +Instead, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`: export const highlights = [ ["9", "", "Don't manipulate variables directly."], @@ -89,7 +89,7 @@ Learn more about why you can't use if-conditions [in this chapter](../conditions -Instead, use the when-then utility function imported from `@medusajs/workflows-sdk`: +Instead, use the when-then utility function imported from `@medusajs/framework/workflows-sdk`: ```ts // Don't @@ -129,7 +129,7 @@ Values of other types, such as Maps, aren't allowed. import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep( "step-1", @@ -148,7 +148,7 @@ const step1 = createStep( import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep( "step-1", diff --git a/www/apps/book/app/advanced-development/workflows/execute-another-workflow/page.mdx b/www/apps/book/app/advanced-development/workflows/execute-another-workflow/page.mdx index 0994482f6181e..f9acd8896a7bf 100644 --- a/www/apps/book/app/advanced-development/workflows/execute-another-workflow/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/execute-another-workflow/page.mdx @@ -20,10 +20,10 @@ export const workflowsHighlights = [ ```ts highlights={workflowsHighlights} collapsibleLines="1-7" expandMoreButton="Show Imports" import { createWorkflow, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createProductsWorkflow, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" const workflow = createWorkflow( "hello-world", @@ -49,7 +49,7 @@ The object has an `input` property to pass input to the workflow. ## Preparing Input Data -If you need to perform some data manipulation to prepare the other workflow's input data, use the `transform` utility function imported from `@medusajs/workflows-sdk`. +If you need to perform some data manipulation to prepare the other workflow's input data, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`. @@ -68,10 +68,10 @@ export const transformHighlights = [ import { createWorkflow, transform, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createProductsWorkflow, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" type WorkflowInput = { title: string @@ -105,7 +105,7 @@ In this example, you use the `transform` function to prepend `Hello` to the titl ## Run Workflow Conditionally -To run a workflow in another based on a condition, use the when-then utility functions imported from `@medusajs/workflows-sdk`. +To run a workflow in another based on a condition, use the when-then utility functions imported from `@medusajs/framework/workflows-sdk`. @@ -124,13 +124,13 @@ export const whenHighlights = [ import { createWorkflow, when, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createProductsWorkflow, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import { CreateProductWorkflowInputDTO, -} from "@medusajs/types" +} from "@medusajs/framework/types" type WorkflowInput = { product?: CreateProductWorkflowInputDTO diff --git a/www/apps/book/app/advanced-development/workflows/long-running-workflow/page.mdx b/www/apps/book/app/advanced-development/workflows/long-running-workflow/page.mdx index 0f2610c9117ee..b9f4f7b3a2955 100644 --- a/www/apps/book/app/advanced-development/workflows/long-running-workflow/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/long-running-workflow/page.mdx @@ -35,7 +35,7 @@ import { createWorkflow, WorkflowResponse, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep("step-1", async () => { return new StepResponse({}) @@ -114,11 +114,11 @@ export const successStatusHighlights = [ import { Modules, TransactionHandlerType, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { StepResponse, createStep, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" type SetStepSuccessStepInput = { transactionId: string @@ -232,11 +232,11 @@ export const failureStatusHighlights = [ import { Modules, TransactionHandlerType, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { StepResponse, createStep, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" type SetStepFailureStepInput = { transactionId: string @@ -288,8 +288,8 @@ import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import myWorkflow from "../../../workflows/hello-world" import { IWorkflowEngineService, -} from "@medusajs/types" -import { Modules } from "@medusajs/utils" +} from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export async function GET(req: MedusaRequest, res: MedusaResponse) { const { transaction, result } = await myWorkflow(req.scope).run() diff --git a/www/apps/book/app/advanced-development/workflows/parallel-steps/page.mdx b/www/apps/book/app/advanced-development/workflows/parallel-steps/page.mdx index 31941584f19eb..2fc5abf218f27 100644 --- a/www/apps/book/app/advanced-development/workflows/parallel-steps/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/parallel-steps/page.mdx @@ -8,7 +8,7 @@ In this chapter, you’ll learn how to run workflow steps in parallel. ## parallelize Utility Function -If your workflow has steps that don’t rely on one another’s results, run them in parallel using the `parallelize` utility function imported from the `@medusajs/workflows-sdk`. +If your workflow has steps that don’t rely on one another’s results, run them in parallel using the `parallelize` utility function imported from the `@medusajs/framework/workflows-sdk`. The workflow waits until all steps passed to the `parallelize` function finish executing before continuing to the next step. @@ -24,7 +24,7 @@ import { createWorkflow, WorkflowResponse, parallelize, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createProductStep, getProductStep, diff --git a/www/apps/book/app/advanced-development/workflows/retry-failed-steps/page.mdx b/www/apps/book/app/advanced-development/workflows/retry-failed-steps/page.mdx index 103a7a80d948f..8e5f5643de5bb 100644 --- a/www/apps/book/app/advanced-development/workflows/retry-failed-steps/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/retry-failed-steps/page.mdx @@ -19,7 +19,7 @@ import { createStep, createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep( { diff --git a/www/apps/book/app/advanced-development/workflows/variable-manipulation/page.mdx b/www/apps/book/app/advanced-development/workflows/variable-manipulation/page.mdx index b2cd4f66fe6c6..edb7acfbdbb77 100644 --- a/www/apps/book/app/advanced-development/workflows/variable-manipulation/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/variable-manipulation/page.mdx @@ -43,7 +43,7 @@ import { createWorkflow, WorkflowResponse, transform, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" // step imports... const myWorkflow = createWorkflow( @@ -62,7 +62,7 @@ const myWorkflow = createWorkflow( ) ``` -The `transform` utility function is imported from `@medusajs/workflows-sdk`. It accepts two parameters: +The `transform` utility function is imported from `@medusajs/framework/workflows-sdk`. It accepts two parameters: 1. The first parameter is an object of variables to manipulate. The object is passed as a parameter to `transform`'s second parameter function. 2. The second parameter is the function performing the variable manipulation. @@ -84,7 +84,7 @@ import { createWorkflow, WorkflowResponse, transform, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" // step imports... type WorkflowInput = { diff --git a/www/apps/book/app/advanced-development/workflows/workflow-hooks/page.mdx b/www/apps/book/app/advanced-development/workflows/workflow-hooks/page.mdx index a90e7be0cacf7..be8a3d6d2bbb7 100644 --- a/www/apps/book/app/advanced-development/workflows/workflow-hooks/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/workflow-hooks/page.mdx @@ -43,7 +43,7 @@ export const handlerHighlights = [ ] ```ts title="src/workflows/hooks/product-created.ts" highlights={handlerHighlights} -import { createProductsWorkflow } from "@medusajs/core-flows" +import { createProductsWorkflow } from "@medusajs/medusa/core-flows" createProductsWorkflow.hooks.productsCreated( async ({ products }, { container }) => { @@ -83,7 +83,7 @@ Since the hook handler is a step function, you can set its compensation function For example: ```ts title="src/workflows/hooks/product-created.ts" -import { createProductsWorkflow } from "@medusajs/core-flows" +import { createProductsWorkflow } from "@medusajs/medusa/core-flows" createProductsWorkflow.productCreated( async ({ productId }, { container }) => { @@ -108,7 +108,7 @@ It also accepts as a second parameter an object holding a `container` property t Medusa's workflows pass in the hook's input an `additional_data` property: ```ts title="src/workflows/hooks/product-created.ts" highlights={[["4", "additional_data"]]} -import { createProductsWorkflow } from "@medusajs/core-flows" +import { createProductsWorkflow } from "@medusajs/medusa/core-flows" createProductsWorkflow.hooks.productsCreated( async ({ products, additional_data }, { container }) => { @@ -131,7 +131,7 @@ You can also pass that additional data when executing the workflow. Pass it as a ```ts title="src/workflows/hooks/product-created.ts" highlights={[["10", "additional_data"]]} import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { createProductsWorkflow } from "@medusajs/core-flows" +import { createProductsWorkflow } from "@medusajs/medusa/core-flows" export async function POST(req: MedusaRequest, res: MedusaResponse) { await createProductsWorkflow(req.scope).run({ diff --git a/www/apps/book/app/advanced-development/workflows/workflow-timeout/page.mdx b/www/apps/book/app/advanced-development/workflows/workflow-timeout/page.mdx index e7488827b94ca..a318ddf970306 100644 --- a/www/apps/book/app/advanced-development/workflows/workflow-timeout/page.mdx +++ b/www/apps/book/app/advanced-development/workflows/workflow-timeout/page.mdx @@ -31,7 +31,7 @@ import { createStep, createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep( "step-1", diff --git a/www/apps/book/app/basics/commerce-modules/page.mdx b/www/apps/book/app/basics/commerce-modules/page.mdx index 511cab64c4228..d2a5a2c5750d9 100644 --- a/www/apps/book/app/basics/commerce-modules/page.mdx +++ b/www/apps/book/app/basics/commerce-modules/page.mdx @@ -26,8 +26,8 @@ For example, you saw this code snippet in the [Medusa container chapter](../medu ```ts highlights={[["10"]]} import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { IProductModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +import { IProductModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export const GET = async ( req: MedusaRequest, @@ -50,6 +50,6 @@ When you resolve the `Modules.PRODUCT` (or `productModuleService`) registration -To resolve the main service of any commerce module, use the registration name defined in the `Modules` enum imported from `@medusajs/utils`. +To resolve the main service of any commerce module, use the registration name defined in the `Modules` enum imported from `@medusajs/framework/utils`. diff --git a/www/apps/book/app/basics/data-models/page.mdx b/www/apps/book/app/basics/data-models/page.mdx index 2fe9704636d03..17dfe23c27422 100644 --- a/www/apps/book/app/basics/data-models/page.mdx +++ b/www/apps/book/app/basics/data-models/page.mdx @@ -16,12 +16,12 @@ A data model is created in a module, and its record are managed in the database ## How to Create a Data Model? -A data model is created in a TypeScript or JavaScript file under a module's `models` directory. It's defined using the `model` utility imported from `@medusajs/utils`. +A data model is created in a TypeScript or JavaScript file under a module's `models` directory. It's defined using the `model` utility imported from `@medusajs/framework/utils`. For example, create the file `src/modules/hello/models/my-custom.ts` with the following content: ```ts title="src/modules/hello/models/my-custom.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), diff --git a/www/apps/book/app/basics/events-and-subscribers/page.mdx b/www/apps/book/app/basics/events-and-subscribers/page.mdx index ef970ff9f1ac2..f8aae6bafd71e 100644 --- a/www/apps/book/app/basics/events-and-subscribers/page.mdx +++ b/www/apps/book/app/basics/events-and-subscribers/page.mdx @@ -85,13 +85,13 @@ For example: export const highlights = [ ["7", "container", "Recieve the Medusa Container in the object parameter."], ["10", "resolve", "Resolve the Product Module's main service."], - ["10", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/utils`."] + ["10", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/framework/utils`."] ] ```ts title="src/subscribers/product-created.ts" highlights={highlights} import { SubscriberArgs, type SubscriberConfig } from "@medusajs/medusa" -import { IProductModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +import { IProductModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export default async function productCreateHandler({ event: { data }, diff --git a/www/apps/book/app/basics/medusa-container/page.mdx b/www/apps/book/app/basics/medusa-container/page.mdx index a5b8624f3b7e8..745a8cddf459a 100644 --- a/www/apps/book/app/basics/medusa-container/page.mdx +++ b/www/apps/book/app/basics/medusa-container/page.mdx @@ -19,14 +19,14 @@ export const highlights = [ [ "10", "Modules.PRODUCT", - "The resource registration name imported from `@medusajs/utils`.", + "The resource registration name imported from `@medusajs/framework/utils`.", ], ] ```ts highlights={highlights} import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { IProductModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +import { IProductModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export const GET = async ( req: MedusaRequest, diff --git a/www/apps/book/app/basics/modules-and-services/page.mdx b/www/apps/book/app/basics/modules-and-services/page.mdx index b780ede382dd6..568a7cb833c3d 100644 --- a/www/apps/book/app/basics/modules-and-services/page.mdx +++ b/www/apps/book/app/basics/modules-and-services/page.mdx @@ -52,7 +52,7 @@ For example, create the file `src/modules/hello/index.ts` with the following con ```ts title="src/modules/hello/index.ts" highlights={[["7", "", "The main service of the module."]]} import HelloModuleService from "./service" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" export const HELLO_MODULE = "helloModuleService" @@ -61,7 +61,7 @@ export default Module(HELLO_MODULE, { }) ``` -You use the `Module` function imported from `@medusajs/utils` to create the module definition. It requires two parameters: +You use the `Module` function imported from `@medusajs/framework/utils` to create the module definition. It requires two parameters: 1. The module's name. 2. An object with a required property `service` indicating the module's main service. diff --git a/www/apps/book/app/basics/scheduled-jobs/page.mdx b/www/apps/book/app/basics/scheduled-jobs/page.mdx index f242cff466c27..f589ae46c66e2 100644 --- a/www/apps/book/app/basics/scheduled-jobs/page.mdx +++ b/www/apps/book/app/basics/scheduled-jobs/page.mdx @@ -87,15 +87,15 @@ For example: export const highlights = [ ["11", "resolve", "Resolve the Product Module's main service."], - ["11", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/utils`."] + ["11", "Modules.PRODUCT", "The module's registration name imported from `@medusajs/framework/utils`."] ] ```ts title="src/jobs/hello-world.ts" highlights={highlights} import { IProductModuleService, MedusaContainer, -} from "@medusajs/types" -import { Modules } from "@medusajs/utils" +} from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export default async function myCustomJob( container: MedusaContainer diff --git a/www/apps/book/app/basics/workflows/page.mdx b/www/apps/book/app/basics/workflows/page.mdx index f34a6279d8195..6c6643f74b936 100644 --- a/www/apps/book/app/basics/workflows/page.mdx +++ b/www/apps/book/app/basics/workflows/page.mdx @@ -22,12 +22,12 @@ By using a workflow, you can track its execution's progress, provide roll-back l ### 1. Create the Steps -A workflow is made of a series of steps. A step is created using the `createStep` utility function imported from `@medusajs/workflows-sdk`. +A workflow is made of a series of steps. A step is created using the `createStep` utility function imported from `@medusajs/framework/workflows-sdk`. Create the file `src/workflows/hello-world.ts` with the following content: ```ts title="src/workflows/hello-world.ts" -import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk" const step1 = createStep("step-1", async () => { return new StepResponse(`Hello from step one!`) @@ -59,7 +59,7 @@ import { // other imports... createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" // ... @@ -127,8 +127,8 @@ To execute the workflow, invoke it passing the Medusa container as a parameter. type SubscriberArgs, } from "@medusajs/medusa" import myWorkflow from "../workflows/hello-world" - import { Modules } from "@medusajs/utils" - import { IUserModuleService } from "@medusajs/types" + import { Modules } from "@medusajs/framework/utils" + import { IUserModuleService } from "@medusajs/framework/types" export default async function handleCustomerCreate({ event: { data }, @@ -160,7 +160,7 @@ To execute the workflow, invoke it passing the Medusa container as a parameter. ```ts title="src/jobs/message-daily.ts" highlights={[["7"], ["8"], ["9"], ["10"], ["11"], ["12"]]} - import { MedusaContainer } from "@medusajs/types" + import { MedusaContainer } from "@medusajs/framework/types" import myWorkflow from "../workflows/hello-world" export default async function myCustomJob( @@ -230,7 +230,7 @@ export const highlights = [ [ "12", "Modules.PRODUCT", - "The resource registration name imported from `@medusajs/utils`.", + "The resource registration name imported from `@medusajs/framework/utils`.", ], ] @@ -240,9 +240,9 @@ import { StepResponse, createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" -import { IProductModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +} from "@medusajs/framework/workflows-sdk" +import { IProductModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, context) => { const productModuleService: IProductModuleService = diff --git a/www/apps/book/app/customization/custom-features/module/page.mdx b/www/apps/book/app/customization/custom-features/module/page.mdx index b30f5bb0f7c78..53ce9e786e4d9 100644 --- a/www/apps/book/app/customization/custom-features/module/page.mdx +++ b/www/apps/book/app/customization/custom-features/module/page.mdx @@ -21,7 +21,7 @@ Start by creating the directory `src/modules/brand` that will hold the Brand Mod To create a data model that represents a new `brand` table in the database, create the file `src/modules/brand/models/brand.ts` with the following content: ```ts title="src/modules/brand/models/brand.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" export const Brand = model.define("brand", { id: model.id().primaryKey(), @@ -44,7 +44,7 @@ export const serviceHighlights = [ ] ```ts title="src/modules/brand/service.ts" highlights={serviceHighlights} -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import { Brand } from "./models/brand" class BrandModuleService extends MedusaService({ @@ -56,7 +56,7 @@ class BrandModuleService extends MedusaService({ export default BrandModuleService ``` -The `BrandModuleService` extends a `MedusaService` function imported from `@medusajs/utils` which is a service factory. +The `BrandModuleService` extends a `MedusaService` function imported from `@medusajs/framework/utils` which is a service factory. The `MedusaService` function receives an object of the module's data models as a parameter, and generates methods to manage those data models, such as `createBrands` and `updateBrands`. @@ -75,7 +75,7 @@ Find a reference of the generated methods in [this guide](!resources!/service-fa To export the module's definition, create the file `src/modules/brand/index.ts` with the following content: ```ts title="src/modules/brand/index.ts" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" import BrandModuleService from "./service" export const BRAND_MODULE = "brandModuleService" diff --git a/www/apps/book/app/customization/custom-features/workflow/page.mdx b/www/apps/book/app/customization/custom-features/workflow/page.mdx index 7919e6c0de08d..cd283ecdfdb25 100644 --- a/www/apps/book/app/customization/custom-features/workflow/page.mdx +++ b/www/apps/book/app/customization/custom-features/workflow/page.mdx @@ -45,7 +45,7 @@ Create the file `src/workflows/create-brand/index.ts` with the following content import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" export type CreateBrandInput = { name: string @@ -71,7 +71,7 @@ Create the file `src/workflows/create-brand/steps/create-brand.ts` with the foll import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { CreateBrandInput } from ".." import { BRAND_MODULE } from "../../../modules/brand" import BrandModuleService from "../../../modules/brand/service" diff --git a/www/apps/book/app/customization/customize-admin/widget/page.mdx b/www/apps/book/app/customization/customize-admin/widget/page.mdx index 7f745f489ef90..a1c10153e1702 100644 --- a/www/apps/book/app/customization/customize-admin/widget/page.mdx +++ b/www/apps/book/app/customization/customize-admin/widget/page.mdx @@ -34,7 +34,7 @@ export const highlights = [ ```tsx title="src/admin/widgets/product-brand.tsx" highlights={highlights} import { defineWidgetConfig } from "@medusajs/admin-sdk" -import { DetailWidgetProps, AdminProduct } from "@medusajs/types" +import { DetailWidgetProps, AdminProduct } from "@medusajs/framework/types" import { useEffect, useState } from "react" import { Container, Heading } from "@medusajs/ui" diff --git a/www/apps/book/app/customization/extend-models/create-links/page.mdx b/www/apps/book/app/customization/extend-models/create-links/page.mdx index 7e4035ed9f6e0..0db80a28e0591 100644 --- a/www/apps/book/app/customization/extend-models/create-links/page.mdx +++ b/www/apps/book/app/customization/extend-models/create-links/page.mdx @@ -29,11 +29,11 @@ export const stepHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { Modules, ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { BRAND_MODULE } from "../../modules/brand" type LinkProductToBrandStepInput = { @@ -71,7 +71,7 @@ The `create` method accepts as a parameter an object whose properties are the na -Use the `Modules` enum imported from `@medusajs/utils` to for the commerce module's names. +Use the `Modules` enum imported from `@medusajs/framework/utils` to for the commerce module's names. diff --git a/www/apps/book/app/customization/extend-models/define-link/page.mdx b/www/apps/book/app/customization/extend-models/define-link/page.mdx index 8f6977c077359..0891dbfc979df 100644 --- a/www/apps/book/app/customization/extend-models/define-link/page.mdx +++ b/www/apps/book/app/customization/extend-models/define-link/page.mdx @@ -23,7 +23,7 @@ This chapter covers how to define a link between the `Brand` and `Product`data m ]} /> -Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines and exports the link using the `defineLink` function imported from `@medusajs/utils`. +Links are defined in a TypeScript or JavaScript file under the `src/links` directory. The file defines and exports the link using the `defineLink` function imported from `@medusajs/framework/utils`. So, create the file `src/links/product-brand.ts` with the following content: @@ -34,8 +34,8 @@ export const highlights = [ ```ts title="src/links/product-brand.ts" highlights={highlights} import BrandModule from "../modules/brand" -import ProductModule from "@medusajs/product" -import { defineLink } from "@medusajs/utils" +import ProductModule from "@medusajs/medusa/product" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( { diff --git a/www/apps/book/app/customization/extend-models/extend-create-product/page.mdx b/www/apps/book/app/customization/extend-models/extend-create-product/page.mdx index 41b7df42f4e8f..3f6be8ec48542 100644 --- a/www/apps/book/app/customization/extend-models/extend-create-product/page.mdx +++ b/www/apps/book/app/customization/extend-models/extend-create-product/page.mdx @@ -86,9 +86,9 @@ export const hookHighlights = [ ] ```ts title="src/workflows/hooks/created-product.ts" highlights={hookHighlights} -import { createProductsWorkflow } from "@medusajs/core-flows" -import { StepResponse } from "@medusajs/workflows-sdk" -import { Modules, ContainerRegistrationKeys } from "@medusajs/utils" +import { createProductsWorkflow } from "@medusajs/medusa/core-flows" +import { StepResponse } from "@medusajs/framework/workflows-sdk" +import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils" import { BRAND_MODULE } from "../../modules/brand" import BrandModuleService from "../../modules/brand/service" diff --git a/www/apps/book/app/customization/extend-models/query-linked-records/page.mdx b/www/apps/book/app/customization/extend-models/query-linked-records/page.mdx index b8bc1c8efbc5e..4e96f96fe47e5 100644 --- a/www/apps/book/app/customization/extend-models/query-linked-records/page.mdx +++ b/www/apps/book/app/customization/extend-models/query-linked-records/page.mdx @@ -52,7 +52,7 @@ import { } from "@medusajs/medusa" import { ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" export const GET = async ( req: MedusaRequest, diff --git a/www/apps/book/app/customization/integrate-systems/handle-event/page.mdx b/www/apps/book/app/customization/integrate-systems/handle-event/page.mdx index 295e127c7dbf0..c75850fec67e3 100644 --- a/www/apps/book/app/customization/integrate-systems/handle-event/page.mdx +++ b/www/apps/book/app/customization/integrate-systems/handle-event/page.mdx @@ -25,7 +25,7 @@ This chapter covers how to emit an event when a brand is created, listen to that To handle brand-creation event, you'll emit a custom event when a brand is created. -In the `createBrandWorkflow` defined in `src/workflows/create-brand/index.ts`, use the `emitEventStep` helper step imported from `@medusajs/core-flows` after the `createBrandStep`: +In the `createBrandWorkflow` defined in `src/workflows/create-brand/index.ts`, use the `emitEventStep` helper step imported from `@medusajs/medusa/core-flows` after the `createBrandStep`: export const eventHighlights = [ ["13", "emitEventStep", "Emit an event."], @@ -37,7 +37,7 @@ export const eventHighlights = [ // other imports... import { emitEventStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" // ... @@ -75,7 +75,7 @@ Create the file `src/workflows/sync-brand-to-system/index.ts` with the following import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" export type SyncBrandToSystemInput = { id: string @@ -104,7 +104,7 @@ export const stepHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { SyncBrandToSystemInput } from ".." import BrandModuleService from "../../../modules/brand/service" import { BRAND_MODULE } from "../../../modules/brand" diff --git a/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx b/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx index 32d0153e6194e..8e8ae9515e51f 100644 --- a/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx +++ b/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx @@ -39,7 +39,7 @@ To create the step that retrieves the brands from the third-party service, creat import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import BrandModuleService from "../../../modules/brand/service" import { BRAND_MODULE } from "../../../modules/brand" @@ -74,8 +74,8 @@ export const createBrandsHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" -import { InferTypeOf } from "@medusajs/types" +} from "@medusajs/framework/workflows-sdk" +import { InferTypeOf } from "@medusajs/framework/types" import BrandModuleService from "../../../modules/brand/service" import { BRAND_MODULE } from "../../../modules/brand" import { Brand } from "../../../modules/brand/models/brand" @@ -109,7 +109,7 @@ This step receives the brands to create as input. -Since a data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/types` to infer its type. +Since a data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type. @@ -131,8 +131,8 @@ export const updateBrandsHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" -import { InferTypeOf } from "@medusajs/types" +} from "@medusajs/framework/workflows-sdk" +import { InferTypeOf } from "@medusajs/framework/types" import BrandModuleService from "../../../modules/brand/service" import { BRAND_MODULE } from "../../../modules/brand" import { Brand } from "../../../modules/brand/models/brand" @@ -181,8 +181,8 @@ import { createWorkflow, WorkflowResponse, transform, -} from "@medusajs/workflows-sdk" -import { InferTypeOf } from "@medusajs/types" +} from "@medusajs/framework/workflows-sdk" +import { InferTypeOf } from "@medusajs/framework/types" import { retrieveBrandsFromSystemStep } from "./steps/retrieve-brands-from-system" import { createBrandsStep } from "./steps/create-brands" import { updateBrandsStep } from "./steps/update-brands" @@ -206,7 +206,7 @@ Next, you need to identify which brands must be created or updated. Since workflows are constructed internally and are only evaluated during execution, you can't access any data's value to perform data manipulation or checks. -Instead, use the `transform` utility function imported from `@medusajs/workflows-sdk`, which gives you access to the real-time values of the data to perfrom actions on them. +Instead, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`, which gives you access to the real-time values of the data to perfrom actions on them. So, replace the `TODO` with the following: @@ -275,7 +275,7 @@ Then, you return the created and updated brands. To schedule a task that syncs brands from the third-party system, create a scheduled job at `src/jobs/sync-brands-from-system.ts`: ```ts title="src/jobs/sync-brands-from-system.ts" -import { MedusaContainer } from "@medusajs/types" +import { MedusaContainer } from "@medusajs/framework/types" import { syncBrandsFromSystemWorkflow } from "../workflows/sync-brands-from-system" export default async function (container: MedusaContainer) { diff --git a/www/apps/book/app/customization/integrate-systems/service/page.mdx b/www/apps/book/app/customization/integrate-systems/service/page.mdx index d81a6aec74e34..260d5d5224933 100644 --- a/www/apps/book/app/customization/integrate-systems/service/page.mdx +++ b/www/apps/book/app/customization/integrate-systems/service/page.mdx @@ -32,7 +32,7 @@ export const serviceHighlights = [ ] ```ts title="src/modules/brand/services/client.ts" highlights={serviceHighlights} -import { Logger, ConfigModule } from "@medusajs/types" +import { Logger, ConfigModule } from "@medusajs/framework/types" import { BRAND_MODULE } from ".." export type BrandClientOptions = { @@ -88,7 +88,7 @@ export const methodsHighlights = [ ```ts title="src/modules/brand/services/client.ts" highlights={methodsHighlights} // other imports... -import { InferTypeOf } from "@medusajs/types" +import { InferTypeOf } from "@medusajs/framework/types" import { Brand } from "../models/brand" export class BrandClient { @@ -125,7 +125,7 @@ The `sendRequest` method is a dummy method to simulate sending a request to a th You also add three methods that use the `sendRequest` method: -- `createBrand` that creates a brand in the third-party system. To reference a brand's type, you use the `InferTypeOf` utility imported from `@medusajs/types`. This transforms a data model, which is a variable, to its equivalent type. +- `createBrand` that creates a brand in the third-party system. To reference a brand's type, you use the `InferTypeOf` utility imported from `@medusajs/framework/types`. This transforms a data model, which is a variable, to its equivalent type. - `deleteBrand` that deletes the brand in the third-party system. - `retrieveBrands` to retrieve a brand from the third-party system. diff --git a/www/apps/book/app/debugging-and-testing/logging/page.mdx b/www/apps/book/app/debugging-and-testing/logging/page.mdx index 45204e8f4b380..7cc54c5d9af40 100644 --- a/www/apps/book/app/debugging-and-testing/logging/page.mdx +++ b/www/apps/book/app/debugging-and-testing/logging/page.mdx @@ -27,7 +27,7 @@ export const highlights = [ ```ts title="src/jobs/log-message.ts" highlights={highlights} import { Logger } from "@medusajs/medusa" -import { MedusaContainer } from "@medusajs/types" +import { MedusaContainer } from "@medusajs/framework/types" export default async function myCustomJob( container: MedusaContainer diff --git a/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx b/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx index eb30944739adc..e83982d9fe4a7 100644 --- a/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx +++ b/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx @@ -93,7 +93,7 @@ This runs your Medusa application and runs the tests available under the `src/in Suppose you have a `hello` module whose main service extends the service factory, and that has the following model: ```ts title="src/modules/hello/models/my-custom.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id().primaryKey(), diff --git a/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx b/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx index c2da893cf8e66..3895378754bcb 100644 --- a/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx +++ b/www/apps/book/app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx @@ -27,7 +27,7 @@ import { createStep, StepResponse, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" const step1 = createStep("step-1", () => { return new StepResponse("Hello, World!") diff --git a/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx b/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx index 2d1e28653054d..713a5337a3870 100644 --- a/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx +++ b/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx @@ -22,7 +22,7 @@ In this chapter, find an example of writing an integration test for a module usi Consider a `hello` module with a `HelloModuleService` that has a `getMessage` method: ```ts title="src/modules/hello/service.ts" -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import MyCustom from "./models/my-custom" class HelloModuleService extends MedusaService({ diff --git a/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx b/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx index 4ec365d0d4b2f..b116eca15bea5 100644 --- a/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx +++ b/www/apps/book/app/debugging-and-testing/testing-tools/modules-tests/page.mdx @@ -105,7 +105,7 @@ For example: ```ts import { moduleIntegrationTestRunner } from "medusa-test-utils" import HelloModuleService from "../service" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const DummyModel = model.define("dummy_model", { id: model.id().primaryKey(), diff --git a/www/apps/book/app/debugging-and-testing/testing-tools/page.mdx b/www/apps/book/app/debugging-and-testing/testing-tools/page.mdx index f28af7be52c6d..1fe81dfaeca29 100644 --- a/www/apps/book/app/debugging-and-testing/testing-tools/page.mdx +++ b/www/apps/book/app/debugging-and-testing/testing-tools/page.mdx @@ -15,7 +15,7 @@ Medusa provides a `medusa-test-utils` package with utility tools to create integ To use the `medusa-test-utils` package, install it as a `devDependency`: ```bash npm2yarn -npm install --save-dev medusa-test-utils@preview +npm install --save-dev medusa-test-utils@rc ``` --- @@ -41,7 +41,7 @@ npm install --save-dev jest @types/jest @swc/jest Then, create the file `jest.config.js` with the following content: ```js title="jest.config.js" -const { loadEnv } = require("@medusajs/utils") +const { loadEnv } = require("@medusajs/framework/utils") loadEnv("test", process.cwd()) module.exports = { diff --git a/www/apps/book/app/page.mdx b/www/apps/book/app/page.mdx index 9838644f89874..3b531832794c8 100644 --- a/www/apps/book/app/page.mdx +++ b/www/apps/book/app/page.mdx @@ -39,7 +39,7 @@ With these tools, you save time you would spend with other platforms on maintain Create your first Medusa store by running the following command: ```bash -npx create-medusa-app@preview +npx create-medusa-app@rc ``` --- diff --git a/www/apps/book/generated/edit-dates.mjs b/www/apps/book/generated/edit-dates.mjs index 5acefcd78071f..c9b65ef8251b8 100644 --- a/www/apps/book/generated/edit-dates.mjs +++ b/www/apps/book/generated/edit-dates.mjs @@ -1,110 +1,110 @@ export const generatedEditDates = { - "app/basics/scheduled-jobs/page.mdx": "2024-08-05T07:24:27+00:00", - "app/basics/workflows/page.mdx": "2024-09-18T08:01:24.328Z", + "app/basics/scheduled-jobs/page.mdx": "2024-09-30T08:43:53.132Z", + "app/basics/workflows/page.mdx": "2024-09-30T08:43:53.132Z", "app/deployment/page.mdx": "2024-08-05T07:24:05+00:00", "app/page.mdx": "2024-09-03T07:09:09.034Z", - "app/basics/modules-and-services/page.mdx": "2024-09-11T10:48:35.195Z", - "app/basics/commerce-modules/page.mdx": "2024-09-03T07:48:48.148Z", - "app/advanced-development/workflows/retry-failed-steps/page.mdx": "2024-07-31T17:01:33+03:00", - "app/advanced-development/workflows/workflow-hooks/page.mdx": "2024-09-18T12:27:15.321Z", + "app/basics/modules-and-services/page.mdx": "2024-09-30T08:43:53.132Z", + "app/basics/commerce-modules/page.mdx": "2024-09-30T08:43:53.131Z", + "app/advanced-development/workflows/retry-failed-steps/page.mdx": "2024-09-30T08:43:53.130Z", + "app/advanced-development/workflows/workflow-hooks/page.mdx": "2024-09-30T08:43:53.131Z", "app/cheatsheet/page.mdx": "2024-07-11T13:53:40+03:00", - "app/debugging-and-testing/logging/page.mdx": "2024-07-04T17:26:03+03:00", + "app/debugging-and-testing/logging/page.mdx": "2024-09-30T08:43:53.135Z", "app/more-resources/page.mdx": "2024-07-04T17:26:03+03:00", "app/storefront-development/page.mdx": "2024-09-11T10:58:59.290Z", "app/storefront-development/nextjs-starter/page.mdx": "2024-07-04T17:26:03+03:00", "app/basics/page.mdx": "2024-09-03T07:11:06.879Z", "app/basics/admin-customizations/page.mdx": "2024-09-03T08:07:35.584Z", - "app/advanced-development/workflows/workflow-timeout/page.mdx": "2024-09-18T13:03:13.095Z", - "app/advanced-development/workflows/parallel-steps/page.mdx": "2024-09-18T12:56:50.436Z", + "app/advanced-development/workflows/workflow-timeout/page.mdx": "2024-09-30T08:43:53.131Z", + "app/advanced-development/workflows/parallel-steps/page.mdx": "2024-09-30T08:43:53.130Z", "app/advanced-development/page.mdx": "2024-07-04T17:26:03+03:00", "app/first-customizations/page.mdx": "2024-09-11T10:48:42.374Z", "app/debugging-and-testing/page.mdx": "2024-05-03T17:36:38+03:00", - "app/basics/medusa-container/page.mdx": "2024-09-03T07:31:40.214Z", + "app/basics/medusa-container/page.mdx": "2024-09-30T08:43:53.132Z", "app/basics/project-directories-files/page.mdx": "2024-07-04T17:26:03+03:00", "app/basics/api-routes/page.mdx": "2024-09-11T10:48:31.777Z", "app/basics/modules-directory-structure/page.mdx": "2024-05-07T18:00:28+02:00", "app/advanced-development/workflows/access-workflow-errors/page.mdx": "2024-09-18T12:54:04.695Z", - "app/basics/events-and-subscribers/page.mdx": "2024-09-03T08:01:30.986Z", - "app/advanced-development/modules/container/page.mdx": "2024-08-05T07:23:49+00:00", - "app/basics/data-models/page.mdx": "2024-09-19T07:24:38.584Z", - "app/advanced-development/workflows/execute-another-workflow/page.mdx": "2024-09-18T13:29:11.644Z", + "app/basics/events-and-subscribers/page.mdx": "2024-09-30T08:43:53.131Z", + "app/advanced-development/modules/container/page.mdx": "2024-09-30T08:43:53.125Z", + "app/basics/data-models/page.mdx": "2024-09-30T08:43:53.131Z", + "app/advanced-development/workflows/execute-another-workflow/page.mdx": "2024-09-30T08:43:53.129Z", "app/basics/loaders/page.mdx": "2024-09-03T08:00:45.993Z", - "app/advanced-development/admin/widgets/page.mdx": "2024-08-06T09:44:22+02:00", + "app/advanced-development/admin/widgets/page.mdx": "2024-09-30T08:43:53.120Z", "app/advanced-development/data-models/page.mdx": "2024-09-19T07:26:43.535Z", - "app/advanced-development/modules/remote-link/page.mdx": "2024-07-24T09:16:01+02:00", - "app/advanced-development/api-routes/protected-routes/page.mdx": "2024-09-11T10:45:44.293Z", - "app/advanced-development/workflows/add-workflow-hook/page.mdx": "2024-09-18T12:52:24.511Z", + "app/advanced-development/modules/remote-link/page.mdx": "2024-09-30T08:43:53.127Z", + "app/advanced-development/api-routes/protected-routes/page.mdx": "2024-09-30T08:43:53.121Z", + "app/advanced-development/workflows/add-workflow-hook/page.mdx": "2024-09-30T08:43:53.128Z", "app/advanced-development/events-and-subscribers/data-payload/page.mdx": "2024-07-16T17:12:05+01:00", "app/advanced-development/data-models/default-properties/page.mdx": "2024-09-19T07:32:06.118Z", "app/advanced-development/workflows/advanced-example/page.mdx": "2024-09-11T10:46:59.975Z", - "app/advanced-development/events-and-subscribers/emit-event/page.mdx": "2024-09-10T11:39:51.168Z", - "app/advanced-development/workflows/conditions/page.mdx": "2024-09-18T08:52:40.755Z", + "app/advanced-development/events-and-subscribers/emit-event/page.mdx": "2024-09-30T08:43:53.125Z", + "app/advanced-development/workflows/conditions/page.mdx": "2024-09-30T08:43:53.128Z", "app/advanced-development/modules/module-link-directions/page.mdx": "2024-07-24T09:16:01+02:00", "app/advanced-development/admin/page.mdx": "2024-05-29T13:50:19+03:00", - "app/advanced-development/workflows/long-running-workflow/page.mdx": "2024-09-18T13:26:19.706Z", - "app/advanced-development/workflows/constructor-constraints/page.mdx": "2024-09-18T08:58:08.705Z", + "app/advanced-development/workflows/long-running-workflow/page.mdx": "2024-09-30T08:43:53.129Z", + "app/advanced-development/workflows/constructor-constraints/page.mdx": "2024-09-30T08:43:53.128Z", "app/advanced-development/data-models/write-migration/page.mdx": "2024-07-15T17:46:10+02:00", "app/advanced-development/data-models/manage-relationships/page.mdx": "2024-09-10T11:39:51.167Z", "app/advanced-development/modules/remote-query/page.mdx": "2024-07-21T21:20:24+02:00", - "app/advanced-development/modules/options/page.mdx": "2024-08-05T07:23:49+00:00", - "app/advanced-development/data-models/relationships/page.mdx": "2024-09-11T11:28:55.494Z", - "app/advanced-development/workflows/compensation-function/page.mdx": "2024-09-18T09:13:11.941Z", - "app/advanced-development/modules/service-factory/page.mdx": "2024-07-26T14:40:56+00:00", - "app/advanced-development/data-models/primary-key/page.mdx": "2024-07-02T12:34:44+03:00", - "app/advanced-development/modules/module-links/page.mdx": "2024-07-24T09:16:01+02:00", - "app/advanced-development/data-models/searchable-property/page.mdx": "2024-09-19T08:48:53.599Z", + "app/advanced-development/modules/options/page.mdx": "2024-09-30T08:43:53.126Z", + "app/advanced-development/data-models/relationships/page.mdx": "2024-09-30T08:43:53.125Z", + "app/advanced-development/workflows/compensation-function/page.mdx": "2024-09-30T08:43:53.128Z", + "app/advanced-development/modules/service-factory/page.mdx": "2024-09-30T08:43:53.127Z", + "app/advanced-development/data-models/primary-key/page.mdx": "2024-09-30T08:43:53.123Z", + "app/advanced-development/modules/module-links/page.mdx": "2024-09-30T08:43:53.126Z", + "app/advanced-development/data-models/searchable-property/page.mdx": "2024-09-30T08:43:53.125Z", "app/advanced-development/scheduled-jobs/execution-number/page.mdx": "2024-07-02T09:41:15+00:00", "app/advanced-development/api-routes/parameters/page.mdx": "2024-09-11T10:44:13.491Z", "app/advanced-development/api-routes/http-methods/page.mdx": "2024-09-11T10:43:33.169Z", "app/advanced-development/admin/tips/page.mdx": "2024-09-10T11:39:51.165Z", - "app/advanced-development/api-routes/cors/page.mdx": "2024-09-04T08:24:47.068Z", + "app/advanced-development/api-routes/cors/page.mdx": "2024-09-30T08:43:53.121Z", "app/advanced-development/admin/ui-routes/page.mdx": "2024-08-06T09:44:22+02:00", "app/advanced-development/api-routes/middlewares/page.mdx": "2024-09-11T10:45:31.861Z", "app/advanced-development/modules/isolation/page.mdx": "2024-07-04T17:26:03+03:00", - "app/advanced-development/data-models/configure-properties/page.mdx": "2024-07-04T17:26:03+03:00", - "app/advanced-development/data-models/index/page.mdx": "2024-09-19T08:47:12.961Z", - "app/advanced-development/custom-cli-scripts/page.mdx": "2024-07-04T17:26:03+03:00", - "app/advanced-development/data-models/property-types/page.mdx": "2024-09-19T07:31:20.696Z", - "app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2024-09-11T10:48:09.593Z", + "app/advanced-development/data-models/configure-properties/page.mdx": "2024-09-30T08:43:53.122Z", + "app/advanced-development/data-models/index/page.mdx": "2024-09-30T08:43:53.122Z", + "app/advanced-development/custom-cli-scripts/page.mdx": "2024-09-30T08:43:53.122Z", + "app/advanced-development/data-models/property-types/page.mdx": "2024-09-30T08:43:53.124Z", + "app/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2024-09-30T08:43:53.136Z", "app/debugging-and-testing/testing-tools/integration-tests/page.mdx": "2024-09-10T11:39:51.170Z", - "app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2024-09-10T11:39:51.171Z", - "app/debugging-and-testing/testing-tools/page.mdx": "2024-09-10T11:39:51.172Z", + "app/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2024-09-30T08:43:53.139Z", + "app/debugging-and-testing/testing-tools/page.mdx": "2024-09-30T08:43:53.139Z", "app/debugging-and-testing/testing-tools/unit-tests/module-example/page.mdx": "2024-09-02T11:04:27.232Z", "app/debugging-and-testing/testing-tools/unit-tests/page.mdx": "2024-09-02T11:03:26.997Z", - "app/advanced-development/modules/service-constraints/page.mdx": "2024-09-04T15:37:04.166Z", + "app/advanced-development/modules/service-constraints/page.mdx": "2024-09-30T08:43:53.127Z", "app/advanced-development/api-routes/page.mdx": "2024-09-04T09:36:33.961Z", "app/advanced-development/api-routes/responses/page.mdx": "2024-09-11T10:44:37.016Z", "app/advanced-development/api-routes/validation/page.mdx": "2024-09-11T10:46:31.476Z", - "app/advanced-development/api-routes/errors/page.mdx": "2024-09-10T11:39:51.166Z", + "app/advanced-development/api-routes/errors/page.mdx": "2024-09-30T08:43:53.121Z", "app/advanced-development/admin/constraints/page.mdx": "2024-09-10T11:39:51.165Z", - "app/advanced-development/modules/query/page.mdx": "2024-09-11T10:46:49.512Z", - "app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-09-10T11:39:51.171Z", - "app/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-09-10T11:39:51.171Z", + "app/advanced-development/modules/query/page.mdx": "2024-09-30T08:43:53.127Z", + "app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-09-30T08:43:53.139Z", + "app/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-09-30T08:43:53.139Z", "app/debugging-and-testing/instrumentation/page.mdx": "2024-09-17T08:53:15.910Z", - "app/advanced-development/api-routes/additional-data/page.mdx": "2024-09-18T12:22:26.063Z", + "app/advanced-development/api-routes/additional-data/page.mdx": "2024-09-30T08:43:53.120Z", "app/advanced-development/workflows/page.mdx": "2024-09-18T08:00:57.364Z", - "app/advanced-development/workflows/variable-manipulation/page.mdx": "2024-09-18T09:03:20.805Z", + "app/advanced-development/workflows/variable-manipulation/page.mdx": "2024-09-30T08:43:53.130Z", "app/customization/custom-features/api-route/page.mdx": "2024-09-12T12:42:34.201Z", - "app/customization/custom-features/module/page.mdx": "2024-09-12T12:39:37.928Z", - "app/customization/custom-features/workflow/page.mdx": "2024-09-12T12:40:39.582Z", - "app/customization/extend-models/create-links/page.mdx": "2024-09-26T08:31:08.177Z", - "app/customization/extend-models/extend-create-product/page.mdx": "2024-09-12T12:43:57.702Z", + "app/customization/custom-features/module/page.mdx": "2024-09-30T08:43:53.133Z", + "app/customization/custom-features/workflow/page.mdx": "2024-09-30T08:43:53.133Z", + "app/customization/extend-models/create-links/page.mdx": "2024-09-30T08:43:53.133Z", + "app/customization/extend-models/extend-create-product/page.mdx": "2024-09-30T08:43:53.134Z", "app/customization/custom-features/page.mdx": "2024-09-12T11:18:13.271Z", "app/customization/customize-admin/page.mdx": "2024-09-12T12:25:29.853Z", "app/customization/customize-admin/route/page.mdx": "2024-09-12T12:45:39.258Z", - "app/customization/customize-admin/widget/page.mdx": "2024-09-12T12:26:36.013Z", - "app/customization/extend-models/define-link/page.mdx": "2024-09-12T12:38:53.230Z", + "app/customization/customize-admin/widget/page.mdx": "2024-09-30T08:43:53.133Z", + "app/customization/extend-models/define-link/page.mdx": "2024-09-30T08:43:53.134Z", "app/customization/extend-models/page.mdx": "2024-09-12T12:38:57.394Z", - "app/customization/extend-models/query-linked-records/page.mdx": "2024-09-12T12:44:41.089Z", - "app/customization/integrate-systems/handle-event/page.mdx": "2024-09-26T08:34:57.278Z", + "app/customization/extend-models/query-linked-records/page.mdx": "2024-09-30T08:43:53.134Z", + "app/customization/integrate-systems/handle-event/page.mdx": "2024-09-30T08:43:53.135Z", "app/customization/integrate-systems/page.mdx": "2024-09-12T12:33:29.827Z", - "app/customization/integrate-systems/schedule-task/page.mdx": "2024-09-26T08:40:26.509Z", - "app/customization/integrate-systems/service/page.mdx": "2024-09-26T08:34:30.313Z", + "app/customization/integrate-systems/schedule-task/page.mdx": "2024-09-30T08:43:53.135Z", + "app/customization/integrate-systems/service/page.mdx": "2024-09-30T08:43:53.135Z", "app/customization/next-steps/page.mdx": "2024-09-12T10:50:04.873Z", "app/customization/page.mdx": "2024-09-12T11:16:18.504Z", "app/more-resources/cheatsheet/page.mdx": "2024-07-11T16:11:26.480Z", "app/more-resources/examples/page.mdx": "2024-09-19T10:30:30.398Z", "app/architecture/architectural-modules/page.mdx": "2024-09-23T12:51:04.520Z", "app/architecture/overview/page.mdx": "2024-09-23T12:55:01.339Z", - "app/advanced-development/data-models/infer-type/page.mdx": "2024-09-26T08:28:13.041Z" + "app/advanced-development/data-models/infer-type/page.mdx": "2024-09-30T08:43:53.123Z" } \ No newline at end of file diff --git a/www/apps/resources/app/admin-widget-injection-zones/page.mdx b/www/apps/resources/app/admin-widget-injection-zones/page.mdx index e01ba4306b7b2..63f2cd91b732c 100644 --- a/www/apps/resources/app/admin-widget-injection-zones/page.mdx +++ b/www/apps/resources/app/admin-widget-injection-zones/page.mdx @@ -114,7 +114,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -137,7 +137,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -160,7 +160,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -183,7 +183,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -254,7 +254,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -277,7 +277,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -334,7 +334,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -357,7 +357,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -428,7 +428,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -451,7 +451,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -474,7 +474,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -497,7 +497,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -554,7 +554,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -577,7 +577,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -634,7 +634,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -657,7 +657,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -680,7 +680,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -703,7 +703,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -774,7 +774,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -797,7 +797,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -820,7 +820,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -843,7 +843,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -914,7 +914,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -937,7 +937,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -960,7 +960,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -983,7 +983,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1040,7 +1040,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1063,7 +1063,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1086,7 +1086,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1109,7 +1109,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1182,7 +1182,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1205,7 +1205,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1242,7 +1242,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1265,7 +1265,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1302,7 +1302,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1325,7 +1325,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1396,7 +1396,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1419,7 +1419,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1490,7 +1490,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1513,7 +1513,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1584,7 +1584,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1607,7 +1607,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1630,7 +1630,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1653,7 +1653,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1724,7 +1724,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1747,7 +1747,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1818,7 +1818,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1841,7 +1841,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1864,7 +1864,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1887,7 +1887,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1958,7 +1958,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -1981,7 +1981,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -2052,7 +2052,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -2075,7 +2075,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -2146,7 +2146,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { @@ -2169,7 +2169,7 @@ This documentation page includes the list of injection zones you can add Admin W - Type `DetailWidgetProps` imported from `@medusajs/types` + Type `DetailWidgetProps` imported from `@medusajs/framework/types` ```ts blockStyle="inline" { diff --git a/www/apps/resources/app/architectural-modules/cache/create/page.mdx b/www/apps/resources/app/architectural-modules/cache/create/page.mdx index 775ce8a876e3c..4c9d1e83c4afe 100644 --- a/www/apps/resources/app/architectural-modules/cache/create/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/create/page.mdx @@ -16,10 +16,10 @@ Start by creating a new directory for your module. For example, `src/modules/my- Create the file `src/modules/my-cache/service.ts` that holds the implementation of the cache service. -The Cache Module's main service must implement the `ICacheService` interface imported from `@medusajs/types`: +The Cache Module's main service must implement the `ICacheService` interface imported from `@medusajs/framework/types`: ```ts title="src/modules/my-cache/service.ts" -import { ICacheService } from "@medusajs/types" +import { ICacheService } from "@medusajs/framework/types" class MyCacheService implements ICacheService { get(key: string): Promise { @@ -135,7 +135,7 @@ Create the file `src/modules/my-cache/index.ts` with the following content: ```ts title="src/modules/my-cache/index.ts" import MyCacheService from "./service" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" export default Module("my-cache", { service: MyCacheService, @@ -153,7 +153,7 @@ To use your Cache Module, add it to the `modules` object exported as part of the For example: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx b/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx index 9bce2dba0df8c..d6a11dcd3367c 100644 --- a/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/in-memory/page.mdx @@ -14,30 +14,18 @@ For production, it’s recommended to use modules like [Redis Cache Module](../r --- -## Install the In-Memory Cache Module +## Register the In-Memory Cache Module -The In-Memory Cache Module is installed by default in your application. +The In-Memory Cache Module is registered by default in your application. -To install the In-Memory Cache Module, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/cache-inmemory@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.js`: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -45,7 +33,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.CACHE]: { - resolve: "@medusajs/cache-inmemory", + resolve: "@medusajs/medusa/cache-inmemory", options: { // optional options }, diff --git a/www/apps/resources/app/architectural-modules/cache/redis/page.mdx b/www/apps/resources/app/architectural-modules/cache/redis/page.mdx index 50dbdd7726cb9..fb7dc2adc9d4d 100644 --- a/www/apps/resources/app/architectural-modules/cache/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/cache/redis/page.mdx @@ -10,7 +10,7 @@ The Redis Cache Module uses Redis to cache data in your store. In production, it --- -## Install the Redis Cache Module +## Register the Redis Cache Module -To install Redis Cache Module, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/cache-redis@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.js`: export const highlights = [ ["11", "redisUrl", "The Redis connection URL."] ] ```js title="medusa-config.js" highlights={highlights} -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -46,7 +34,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.CACHE]: { - resolve: "@medusajs/cache-redis", + resolve: "@medusajs/medusa/cache-redis", options: { redisUrl: process.env.CACHE_REDIS_URL, }, @@ -166,6 +154,8 @@ CACHE_REDIS_URL= +--- + ## Test the Module To test the module, start the Medusa application: diff --git a/www/apps/resources/app/architectural-modules/event/create/page.mdx b/www/apps/resources/app/architectural-modules/event/create/page.mdx index b683a739191a7..474a8a0310c68 100644 --- a/www/apps/resources/app/architectural-modules/event/create/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/create/page.mdx @@ -16,11 +16,11 @@ Start by creating a new directory for your module. For example, `src/modules/my- Create the file `src/modules/my-event/service.ts` that holds the implementation of the event service. -The Event Module's main service must extend the `AbstractEventBusModuleService` class imported from `@medusajs/utils`: +The Event Module's main service must extend the `AbstractEventBusModuleService` class imported from `@medusajs/framework/utils`: ```ts title="src/modules/my-event/service.ts" -import { EmitData, Message } from "@medusajs/types" -import { AbstractEventBusModuleService } from "@medusajs/utils" +import { EmitData, Message } from "@medusajs/framework/types" +import { AbstractEventBusModuleService } from "@medusajs/framework/utils" class MyEventService extends AbstractEventBusModuleService { emit(eventName: string, data: T, options: Record): Promise; @@ -90,7 +90,7 @@ Create the file `src/modules/my-event/index.ts` with the following content: ```ts title="src/modules/my-event/index.ts" import MyEventService from "./service" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" export default Module("my-event", { service: MyEventService, @@ -108,7 +108,7 @@ To use your Event Module, add it to the `modules` object exported as part of the For example: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/app/architectural-modules/event/local/page.mdx b/www/apps/resources/app/architectural-modules/event/local/page.mdx index dd60b75c93acf..5666d240ab483 100644 --- a/www/apps/resources/app/architectural-modules/event/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/local/page.mdx @@ -12,30 +12,18 @@ For production, it’s recommended to use modules like [Redis Event Bus Module]( --- -## Install the Local Event Bus Module +## Register the Local Event Bus Module -The Local Event Bus Module is installed by default in your application. +The Local Event Bus Module is registered by default in your application. -To install Local Event Bus Module, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/event-bus-local@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.js`: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/app/architectural-modules/event/redis/page.mdx b/www/apps/resources/app/architectural-modules/event/redis/page.mdx index 97e0d5b243fc4..98f42af3ce5f2 100644 --- a/www/apps/resources/app/architectural-modules/event/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/event/redis/page.mdx @@ -14,7 +14,7 @@ In production, it's recommended to use this module. --- -## Install the Redis Events Bus Module +## Register the Redis Events Bus Module -To install Redis Event Bus Module, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/event-bus-redis@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.js`: export const highlights = [ ["11", "redisUrl", "The Redis connection URL."] ] ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -50,7 +38,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.EVENT_BUS]: { - resolve: "@medusajs/event-bus-redis", + resolve: "@medusajs/medusa/event-bus-redis", options: { redisUrl: process.env.EVENTS_REDIS_URL, }, diff --git a/www/apps/resources/app/architectural-modules/file/local/page.mdx b/www/apps/resources/app/architectural-modules/file/local/page.mdx index c6d1b25154c72..fddb55762276d 100644 --- a/www/apps/resources/app/architectural-modules/file/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/file/local/page.mdx @@ -16,27 +16,15 @@ The Local File Module Provider is only for development purposes. Use the [S3 Fil --- -## Install the Local File Module +## Register the Local File Module -The Local File Module is installed by default in your application. +The Local File Module Provider is registered by default in your application. -To install the Local File Module Provider, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/file-local-next@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `providers` array of the File Module: +Add the module into the `providers` array of the File Module: @@ -45,7 +33,7 @@ The File Module accepts one provider only. ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -53,11 +41,11 @@ module.exports = { // ... modules: { [Modules.FILE]: { - resolve: "@medusajs/file", + resolve: "@medusajs/medusa/file", options: { providers: [ { - resolve: "@medusajs/file-local-next", + resolve: "@medusajs/medusa/file-local-next", id: "local", options: { // provider options... diff --git a/www/apps/resources/app/architectural-modules/file/s3/page.mdx b/www/apps/resources/app/architectural-modules/file/s3/page.mdx index 9108e6179e26f..359c0a145e1d1 100644 --- a/www/apps/resources/app/architectural-modules/file/s3/page.mdx +++ b/www/apps/resources/app/architectural-modules/file/s3/page.mdx @@ -102,15 +102,9 @@ The S3 File Module Provider integrates Amazon S3 and services following a compat --- -## Install the S3 File Module +## Register the S3 File Module -To install the S3 File Module Provider, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/file-s3@preview -``` - -Next, add the module into the `providers` array of the File Module: +Add the module into the `providers` array of the File Module: @@ -119,7 +113,7 @@ The File Module accepts one provider only. ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -128,11 +122,11 @@ module.exports = { modules: { // ... [Modules.FILE]: { - resolve: "@medusajs/file", + resolve: "@medusajs/medusa/file", options: { providers: [ { - resolve: "@medusajs/file-s3", + resolve: "@medusajs/medusa/file-s3", id: "s3", options: { file_url: process.env.S3_FILE_URL, @@ -360,11 +354,11 @@ module.exports = defineConfig({ // ... modules: { [Modules.FILE]: { - resolve: "@medusajs/file", + resolve: "@medusajs/medusa/file", options: { providers: [ { - resolve: "@medusajs/file-s3", + resolve: "@medusajs/medusa/file-s3", id: "s3", options: { // ... diff --git a/www/apps/resources/app/architectural-modules/notification/local/page.mdx b/www/apps/resources/app/architectural-modules/notification/local/page.mdx index 507732fb9bf32..33d3a51efae3f 100644 --- a/www/apps/resources/app/architectural-modules/notification/local/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/local/page.mdx @@ -10,27 +10,15 @@ The Local Notification Module Provider simulates sending a notification, but onl --- -## Install the Local Notification Module +## Register the Local Notification Module -The Local Notification Module Provider is installed by default in your application. +The Local Notification Module Provider is registered by default in your application. It's configured to run on the `feed` channel. -To install the Local Notification Module Provider, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/notification-local@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `providers` array of the Notification Module: +Add the module into the `providers` array of the Notification Module: @@ -39,7 +27,7 @@ Only one provider can be defined for a channel. ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -47,12 +35,12 @@ module.exports = defineConfig({ // ... modules: { [Modules.NOTIFICATION]: { - resolve: "@medusajs/notification", + resolve: "@medusajs/medusa/notification", options: { providers: [ // ... { - resolve: "@medusajs/notification-local", + resolve: "@medusajs/medusa/notification-local", id: "local", options: { channels: ["email"], diff --git a/www/apps/resources/app/architectural-modules/notification/page.mdx b/www/apps/resources/app/architectural-modules/notification/page.mdx index 22ae8ccd639d7..2f1436ed6b02d 100644 --- a/www/apps/resources/app/architectural-modules/notification/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/page.mdx @@ -31,7 +31,7 @@ When you send a notification, you specify the channel to send it through, such a For example: ```js title="medusa-config.js" highlights={[["19"]]} -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -40,12 +40,12 @@ module.exports = { modules: { // ... [Modules.NOTIFICATION]: { - resolve: "@medusajs/notification", + resolve: "@medusajs/medusa/notification", options: { providers: [ // ... { - resolve: "@medusajs/notification-local", + resolve: "@medusajs/medusa/notification-local", id: "notification", options: { channels: ["email"], diff --git a/www/apps/resources/app/architectural-modules/notification/send-notification/page.mdx b/www/apps/resources/app/architectural-modules/notification/send-notification/page.mdx index 54f7ba6a7507d..16e7cc286b29d 100644 --- a/www/apps/resources/app/architectural-modules/notification/send-notification/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/send-notification/page.mdx @@ -37,8 +37,8 @@ import type { SubscriberArgs, SubscriberConfig, } from "@medusajs/medusa" -import { Modules } from "@medusajs/utils" -import { INotificationModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/framework/utils" +import { INotificationModuleService } from "@medusajs/framework/types" export default async function productCreateHandler({ event: { data }, diff --git a/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx b/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx index d10c3eae1c504..6be6db58fbf1e 100644 --- a/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx @@ -10,7 +10,7 @@ The SendGrid Notification Module Provider integrates [SendGrid](https://sendgrid --- -## Install the SendGrid Notification Module +## Register the SendGrid Notification Module -To install the SendGrid Notification Module Provider, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/notification-sendgrid@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `providers` array of the Notification Module: +Add the module into the `providers` array of the Notification Module: @@ -50,7 +38,7 @@ Only one provider can be defined for a channel. ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -58,12 +46,12 @@ module.exports = defineConfig({ // ... modules: { [Modules.NOTIFICATION]: { - resolve: "@medusajs/notification", + resolve: "@medusajs/medusa/notification", options: { providers: [ // ... { - resolve: "@medusajs/notification-sendgrid", + resolve: "@medusajs/medusa/notification-sendgrid", id: "sendgrid", options: { channels: ["email"], @@ -144,8 +132,8 @@ import type { SubscriberArgs, SubscriberConfig, } from "@medusajs/medusa" -import { Modules } from "@medusajs/utils" -import { INotificationModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/framework/utils" +import { INotificationModuleService } from "@medusajs/framework/types" export default async function productCreateHandler({ event: { data }, diff --git a/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx b/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx index fd8978b3846b1..dc25afe86a030 100644 --- a/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx +++ b/www/apps/resources/app/architectural-modules/workflow-engine/in-memory/page.mdx @@ -14,30 +14,18 @@ For production, it’s recommended to use modules like [Redis Workflow Engine Mo --- -## Install the In-Memory Workflow Engine Module +## Register the In-Memory Workflow Engine Module -The In-Memory Workflow Engine Module is installed by default in your application. +The In-Memory Workflow Engine Module is registered by default in your application. -To install the In-Memory Workflow Engine Module, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/workflow-engine-inmemory@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.js`: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx b/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx index 710e9d6b5e507..a13295a7f220c 100644 --- a/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx +++ b/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx @@ -10,7 +10,7 @@ The Redis Workflow Engine Module uses Redis to track workflow executions and han --- -## Install the Redis Workflow Engine Module +## Register the Redis Workflow Engine Module -To install Redis Workflow Engine Module, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/workflow-engine-redis@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module into the `modules` property of the exported object in `medusa-config.js`: +Add the module into the `modules` property of the exported object in `medusa-config.js`: export const highlights = [ ["12", "url", "The Redis connection URL."] ] ```js title="medusa-config.js" highlights={highlights} -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/app/commerce-modules/api-key/examples/page.mdx b/www/apps/resources/app/commerce-modules/api-key/examples/page.mdx index 7334ec2a64395..392201c1af798 100644 --- a/www/apps/resources/app/commerce-modules/api-key/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/api-key/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the API Key Modu ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IApiKeyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IApiKeyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve( @@ -41,7 +41,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeApiKeyModule } from "@medusajs/api-key" +import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key" export async function POST(request: Request) { const apiKeyModuleService = await initializeApiKeyModule() @@ -70,8 +70,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IApiKeyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IApiKeyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET(request: MedusaRequest, res: MedusaResponse) { const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve( @@ -90,7 +90,7 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeApiKeyModule } from "@medusajs/api-key" +import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key" export async function GET(request: Request) { const apiKeyModuleService = await initializeApiKeyModule() @@ -113,8 +113,8 @@ export async function GET(request: Request) { ```ts collapsibleLines="1-9" expandButtonLabel="Show Imports" import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { IApiKeyModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +import { IApiKeyModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export async function POST( request: AuthenticatedMedusaRequest, @@ -140,7 +140,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeApiKeyModule } from "@medusajs/api-key" +import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key" type ContextType = { params: { @@ -174,8 +174,8 @@ export async function POST(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IApiKeyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IApiKeyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const apiKeyModuleService: IApiKeyModuleService = request.scope.resolve( @@ -198,7 +198,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeApiKeyModule } from "@medusajs/api-key" +import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key" type ContextType = { params: { @@ -234,8 +234,8 @@ export async function POST(request: Request, { params }: ContextType) { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" - import { IApiKeyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IApiKeyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: AuthenticatedMedusaRequest, @@ -267,7 +267,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeApiKeyModule } from "@medusajs/api-key" +import { initialize as initializeApiKeyModule } from "@medusajs/medusa/api-key" type ContextType = { params: { diff --git a/www/apps/resources/app/commerce-modules/api-key/page.mdx b/www/apps/resources/app/commerce-modules/api-key/page.mdx index 3913de5744140..d69b7af4bca73 100644 --- a/www/apps/resources/app/commerce-modules/api-key/page.mdx +++ b/www/apps/resources/app/commerce-modules/api-key/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The API Key Module is the `@medusajs/api-key` NPM package that provides API-key-related features in your Medusa and Node.js applications. +The API Key Module is the `@medusajs/medusa/api-key` NPM package that provides API-key-related features in your Medusa and Node.js applications. ## How to Use API Key Module's Service -You can use the API Key Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/utils`. +You can use the API Key Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IApiKeyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IApiKeyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IApiKeyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IApiKeyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const apiKeyModuleService: IApiKeyModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IApiKeyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IApiKeyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const apiKeyModuleService: IApiKeyModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx index 2ca08e718842a..4a0cef2c82cf3 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx @@ -12,26 +12,26 @@ Using the Emailpass auth module provider, you allow users to register and login --- -## Install the Emailpass Auth Module Provider +## Register the Emailpass Auth Module Provider The Emailpass auth provider is registered by default with the Auth Module. If you want to pass options to the provider, add the provider to the `providers` option of the Auth Module: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... const modules = { // ... [Modules.AUTH]: { - resolve: "@medusajs/auth", + resolve: "@medusajs/medusa/auth", options: { providers: [ // other providers... { - resolve: "@medusajs/auth-emailpass", + resolve: "@medusajs/medusa/auth-emailpass", id: "emailpass", options: { // options... diff --git a/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx index f5cea508c392d..24e3f02632baf 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-providers/github/page.mdx @@ -18,7 +18,7 @@ Learn about the authentication flow in [this guide](../../authentication-route/p --- -## Install the Github Auth Module Provider +## Register the Github Auth Module Provider -To install the GitHub auth module provider, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/auth-github@preview -``` - -Next, add the module to the array of providers passed to the Auth Module: +Add the module to the array of providers passed to the Auth Module: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... const modules = { // ... [Modules.AUTH]: { - resolve: "@medusajs/auth", + resolve: "@medusajs/medusa/auth", options: { providers: [ // other providers... { - resolve: "@medusajs/auth-github", + resolve: "@medusajs/medusa/auth-github", id: "github", options: { clientId: process.env.GITHUB_CLIENT_ID, diff --git a/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx b/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx index 7c9c0da8a6c9b..ee7df1eb9bc83 100644 --- a/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/auth-providers/google/page.mdx @@ -18,7 +18,7 @@ Learn about the authentication flow in [this guide](../../authentication-route/p --- -## Install the Google Auth Module Provider +## Register the Google Auth Module Provider -To install the Google auth module provider, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/auth-google@preview -``` - -Next, add the module to the array of providers passed to the Auth Module: +Add the module to the array of providers passed to the Auth Module: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... const modules = { // ... [Modules.AUTH]: { - resolve: "@medusajs/auth", + resolve: "@medusajs/medusa/auth", options: { providers: [ // other providers... { - resolve: "@medusajs/auth-google", + resolve: "@medusajs/medusa/auth-google", id: "google", options: { clientId: process.env.GOOGLE_CLIENT_ID, diff --git a/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx b/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx index 084a6c8c00e89..88c6a6c8e6cf8 100644 --- a/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx @@ -13,7 +13,7 @@ Before creating an actor type, you must define a data model the actor type belon The rest of this guide uses this `Manager` data model as an example: ```ts title="src/modules/manager/models/manager.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const Manager = model.define("manager", { id: model.id().primaryKey(), @@ -49,10 +49,10 @@ import { createStep, StepResponse, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { setAuthAppMetadataStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import ManagerModuleService from "../modules/manager/service" type CreateManagerWorkflowInput = { @@ -106,7 +106,7 @@ This workflow accepts the manager’s data and the associated auth identity’s The workflow has two steps: 1. Create the manager using the `createManagerStep`. -2. Set the `app_metadata` property of the associated auth identity using the `setAuthAppMetadataStep` step imported from `@medusajs/core-flows`. You specify the actor type `manager` in the `actorType` property of the step’s input. +2. Set the `app_metadata` property of the associated auth identity using the `setAuthAppMetadataStep` step imported from `@medusajs/medusa/core-flows`. You specify the actor type `manager` in the `actorType` property of the step’s input. --- @@ -127,7 +127,7 @@ import type { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import createManagerWorkflow from "../../workflows/create-manager" type RequestBody = { @@ -308,7 +308,7 @@ For example, create the following workflow that deletes a manager and updates it import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import ManagerModuleService from "../modules/manager/service" export type DeleteManagerWorkflow = { @@ -348,17 +348,17 @@ export const deleteHighlights = [ ```ts title="src/workflows/delete-manager.ts" collapsibleLines="1-15" expandButtonLabel="Show Imports" highlights={deleteHighlights} // other imports -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { WorkflowData, WorkflowResponse, createWorkflow, transform, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { setAuthAppMetadataStep, useRemoteQueryStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" // ... diff --git a/www/apps/resources/app/commerce-modules/auth/examples/page.mdx b/www/apps/resources/app/commerce-modules/auth/examples/page.mdx index dc8a402ec1a28..4cd080b0d9aa8 100644 --- a/www/apps/resources/app/commerce-modules/auth/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/examples/page.mdx @@ -24,9 +24,9 @@ This example uses the [jsonwebtoken NPM package](https://www.npmjs.com/package/j import { IAuthModuleService, AuthenticationInput, - } from "@medusajs/types" - import { Modules } from "@medusajs/utils" - import { MedusaError } from "@medusajs/utils" + } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" + import { MedusaError } from "@medusajs/framework/utils" import jwt from "jsonwebtoken" export async function POST( @@ -69,7 +69,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeAuthModule } from "@medusajs/auth" +import { initialize as initializeAuthModule } from "@medusajs/medusa/auth" export async function POST(request: Request) { const authModuleService = await initializeAuthModule() @@ -127,9 +127,9 @@ This example uses the [jsonwebtoken NPM package](https://www.npmjs.com/package/j import { IAuthModuleService, AuthenticationInput, - } from "@medusajs/types" - import { Modules } from "@medusajs/utils" - import { MedusaError } from "@medusajs/utils" + } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" + import { MedusaError } from "@medusajs/framework/utils" import jwt from "jsonwebtoken" export async function POST( @@ -174,7 +174,7 @@ export async function POST( ```ts collapsibleLines="1-7" expandButtonLabel="Show Imports" import { NextResponse } from "next/server" -import { initialize as initializeAuthModule } from "@medusajs/auth" +import { initialize as initializeAuthModule } from "@medusajs/medusa/auth" export async function POST(request: Request) { const authModuleService = await initializeAuthModule() @@ -226,8 +226,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IAuthModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IAuthModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -253,7 +253,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeAuthModule } from "@medusajs/auth" +import { initialize as initializeAuthModule } from "@medusajs/medusa/auth" export async function POST(request: Request) { const authModuleService = await initializeAuthModule() @@ -282,8 +282,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IAuthModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IAuthModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -305,7 +305,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeAuthModule } from "@medusajs/auth" +import { initialize as initializeAuthModule } from "@medusajs/medusa/auth" export async function GET(request: Request) { const authModuleService = await initializeAuthModule() @@ -328,8 +328,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IAuthModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IAuthModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -358,7 +358,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeAuthModule } from "@medusajs/auth" +import { initialize as initializeAuthModule } from "@medusajs/medusa/auth" type ContextType = { params: { @@ -394,8 +394,8 @@ export async function POST(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IAuthModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IAuthModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( req: MedusaRequest, @@ -417,7 +417,7 @@ export async function DELETE( ```ts import { NextResponse } from "next/server" -import { initialize as initializeAuthModule } from "@medusajs/auth" +import { initialize as initializeAuthModule } from "@medusajs/medusa/auth" type ContextType = { params: { diff --git a/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx b/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx index 4e5cc3a0f55bd..bb1cb412119a3 100644 --- a/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/module-options/page.mdx @@ -21,18 +21,18 @@ When the Medusa application starts, these providers are registered and can be us For example: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... module.exports = defineConfig({ // ... modules: { - resolve: "@medusajs/auth", + resolve: "@medusajs/medusa/auth", options: { providers: [ { - resolve: "@medusajs/auth-emailpass", + resolve: "@medusajs/medusa/auth-emailpass", id: "emailpass", options: { // provider options... diff --git a/www/apps/resources/app/commerce-modules/auth/page.mdx b/www/apps/resources/app/commerce-modules/auth/page.mdx index 0392cf615c165..dbc46547aeae5 100644 --- a/www/apps/resources/app/commerce-modules/auth/page.mdx +++ b/www/apps/resources/app/commerce-modules/auth/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Auth Module is the `@medusajs/auth` NPM package that provides authentication-related features in your Medusa and Node.js applications. +The Auth Module is the `@medusajs/medusa/auth` NPM package that provides authentication-related features in your Medusa and Node.js applications. ## How to Use Auth Module's Service -You can use the Auth Module's main service by resolving from the Medusa container the resource `Modules.AUTH` imported from `@medusajs/utils`. +You can use the Auth Module's main service by resolving from the Medusa container the resource `Modules.AUTH` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { IAuthModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +import { IAuthModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" -import { IAuthModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +import { IAuthModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const authModuleService: IAuthModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" -import { createStep } from "@medusajs/workflows-sdk" -import { IAuthModuleService } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +import { createStep } from "@medusajs/framework/workflows-sdk" +import { IAuthModuleService } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const authModuleService: IAuthModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/cart/examples/page.mdx b/www/apps/resources/app/commerce-modules/cart/examples/page.mdx index 646c13b76f48d..49fe34410e413 100644 --- a/www/apps/resources/app/commerce-modules/cart/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/cart/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Cart Module ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -51,7 +51,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCartModule } from "@medusajs/cart" +import { initialize as initializeCartModule } from "@medusajs/medusa/cart" export async function POST(request: Request) { const cartModuleService = await initializeCartModule() @@ -89,8 +89,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -112,7 +112,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCartModule } from "@medusajs/cart" +import { initialize as initializeCartModule } from "@medusajs/medusa/cart" export async function GET(request: Request) { const cartModuleService = await initializeCartModule() @@ -137,8 +137,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -167,7 +167,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCartModule } from "@medusajs/cart" +import { initialize as initializeCartModule } from "@medusajs/medusa/cart" export async function POST(request: Request) { const cartModuleService = await initializeCartModule() @@ -197,8 +197,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -226,7 +226,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCartModule } from "@medusajs/cart" +import { initialize as initializeCartModule } from "@medusajs/medusa/cart" export async function POST(request: Request) { const cartModuleService = await initializeCartModule() @@ -255,8 +255,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -284,7 +284,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCartModule } from "@medusajs/cart" +import { initialize as initializeCartModule } from "@medusajs/medusa/cart" export async function POST(request: Request) { const cartModuleService = await initializeCartModule() @@ -313,8 +313,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -343,7 +343,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCartModule } from "@medusajs/cart" +import { initialize as initializeCartModule } from "@medusajs/medusa/cart" export async function POST(request: Request) { const cartModuleService = await initializeCartModule() @@ -373,8 +373,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( req: MedusaRequest, @@ -396,7 +396,7 @@ export async function DELETE( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCartModule } from "@medusajs/cart" +import { initialize as initializeCartModule } from "@medusajs/medusa/cart" export async function DELETE(request: Request) { const cartModuleService = await initializeCartModule() @@ -417,8 +417,8 @@ export async function DELETE(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( req: MedusaRequest, @@ -439,8 +439,8 @@ export async function DELETE( ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( req: MedusaRequest, diff --git a/www/apps/resources/app/commerce-modules/cart/page.mdx b/www/apps/resources/app/commerce-modules/cart/page.mdx index e4a331a8e94f9..6192ee98ef0c6 100644 --- a/www/apps/resources/app/commerce-modules/cart/page.mdx +++ b/www/apps/resources/app/commerce-modules/cart/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Cart Module is the `@medusajs/cart` NPM package that provides cart-related features in your Medusa and Node.js applications. +The Cart Module is the `@medusajs/medusa/cart` NPM package that provides cart-related features in your Medusa and Node.js applications. ## How to Use Cart Module's Service -You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART` imported from `@medusajs/utils`. +You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const cartModuleService: ICartModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { ICartModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { ICartModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const cartModuleService: ICartModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/cart/promotions/page.mdx b/www/apps/resources/app/commerce-modules/cart/promotions/page.mdx index 3e8228f0bc02c..f7bd4e50236c7 100644 --- a/www/apps/resources/app/commerce-modules/cart/promotions/page.mdx +++ b/www/apps/resources/app/commerce-modules/cart/promotions/page.mdx @@ -47,7 +47,7 @@ import { ComputeActionItemLine, ComputeActionShippingLine, // ... -} from "@medusajs/types" +} from "@medusajs/framework/types" // retrieve the cart const cart = await cartModuleService.retrieveCart("cart_123", { @@ -106,7 +106,7 @@ import { AddItemAdjustmentAction, AddShippingMethodAdjustment, // ... -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... diff --git a/www/apps/resources/app/commerce-modules/currency/examples/page.mdx b/www/apps/resources/app/commerce-modules/currency/examples/page.mdx index 87b13dddb882d..468b0d0e63ff3 100644 --- a/www/apps/resources/app/commerce-modules/currency/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/currency/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Currency Mod ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICurrencyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICurrencyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -38,7 +38,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCurrencyModule } from "@medusajs/currency" +import { initialize as initializeCurrencyModule } from "@medusajs/medusa/currency" export async function GET(request: Request) { const currencyModuleService = await initializeCurrencyModule() @@ -61,8 +61,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICurrencyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICurrencyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -86,7 +86,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeCurrencyModule } from "@medusajs/currency" +import { initialize as initializeCurrencyModule } from "@medusajs/medusa/currency" export async function GET(request: Request) { const currencyModuleService = await initializeCurrencyModule() diff --git a/www/apps/resources/app/commerce-modules/currency/page.mdx b/www/apps/resources/app/commerce-modules/currency/page.mdx index d96f19bcd0712..159ee2ff7c865 100644 --- a/www/apps/resources/app/commerce-modules/currency/page.mdx +++ b/www/apps/resources/app/commerce-modules/currency/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Currency Module is the `@medusajs/currency` NPM package that provides currency-related features in your Medusa and Node.js applications. +The Currency Module is the `@medusajs/medusa/currency` NPM package that provides currency-related features in your Medusa and Node.js applications. ## How to Use Currency Module's Service -You can use the Currency Module's main service by resolving from the Medusa container the resource `Modules.CURRENCY` imported from `@medusajs/utils`. +You can use the Currency Module's main service by resolving from the Medusa container the resource `Modules.CURRENCY` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICurrencyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICurrencyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { ICurrencyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICurrencyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const currencyModuleService: ICurrencyModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { ICurrencyModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { ICurrencyModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const currencyModuleService: ICurrencyModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/customer/examples/page.mdx b/www/apps/resources/app/commerce-modules/customer/examples/page.mdx index 333642908e52f..102350af9c938 100644 --- a/www/apps/resources/app/commerce-modules/customer/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/customer/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Customer Mod ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICustomerModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICustomerModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const customerModuleService: ICustomerModuleService = request.scope.resolve( @@ -41,7 +41,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeCustomerModule } from "@medusajs/customer" +import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer" export async function POST(request: Request) { const customerModuleService = await initializeCustomerModule() @@ -70,8 +70,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICustomerModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICustomerModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const customerModuleService: ICustomerModuleService = request.scope.resolve( @@ -94,7 +94,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeCustomerModule } from "@medusajs/customer" +import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer" export async function POST(request: Request) { const customerModuleService = await initializeCustomerModule() @@ -121,8 +121,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICustomerModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICustomerModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const customerModuleService: ICustomerModuleService = request.scope.resolve( @@ -144,7 +144,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeCustomerModule } from "@medusajs/customer" +import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer" export async function POST(request: Request) { const customerModuleService = await initializeCustomerModule() @@ -170,8 +170,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICustomerModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICustomerModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const customerModuleService: ICustomerModuleService = request.scope.resolve( @@ -194,7 +194,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { import { NextResponse } from "next/server" // eslint-disable-next-line prettier/prettier -import { initialize as initializeCustomerModule } from "@medusajs/customer" +import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer" export async function POST(request: Request) { const customerModuleService = await initializeCustomerModule() diff --git a/www/apps/resources/app/commerce-modules/customer/page.mdx b/www/apps/resources/app/commerce-modules/customer/page.mdx index 783b009c0db78..422389bab504f 100644 --- a/www/apps/resources/app/commerce-modules/customer/page.mdx +++ b/www/apps/resources/app/commerce-modules/customer/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Customer Module is the `@medusajs/customer` NPM package that provides customer-related features in your Medusa and Node.js applications. +The Customer Module is the `@medusajs/medusa/customer` NPM package that provides customer-related features in your Medusa and Node.js applications. ## How to Use Customer Module's Service -You can use the Customer Module's main service by resolving from the Medusa container the resource `Modules.CUSTOMER` imported from `@medusajs/utils`. +You can use the Customer Module's main service by resolving from the Medusa container the resource `Modules.CUSTOMER` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ICustomerModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICustomerModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET(request: MedusaRequest, res: MedusaResponse) { const customerModuleService: ICustomerModuleService = request.scope.resolve( @@ -38,8 +38,8 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) { ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { ICustomerModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ICustomerModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const customerModuleService: ICustomerModuleService = container.resolve( @@ -54,9 +54,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { ICustomerModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { ICustomerModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const customerModuleService: ICustomerModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx b/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx index 54862384e423c..570a48615a331 100644 --- a/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/fulfillment/module-options/page.mdx @@ -21,7 +21,7 @@ When the Medusa application starts, these providers are registered and can be us For example: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -29,11 +29,11 @@ module.exports = defineConfig({ // ... modules: { [Modules.FULFILLMENT]: { - resolve: "@medusajs/fulfillment", + resolve: "@medusajs/medusa/fulfillment", options: { providers: [ { - resolve: `@medusajs/fulfillment-manual`, + resolve: `@medusajs/medusa/fulfillment-manual`, id: "manual", options: { // provider options... diff --git a/www/apps/resources/app/commerce-modules/fulfillment/page.mdx b/www/apps/resources/app/commerce-modules/fulfillment/page.mdx index 4e6a3620ef5f9..798ae19a8dd37 100644 --- a/www/apps/resources/app/commerce-modules/fulfillment/page.mdx +++ b/www/apps/resources/app/commerce-modules/fulfillment/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Fulfillment Module is the `@medusajs/fulfillment` NPM package that provides fulfillment-related features in your Medusa and Node.js applications. +The Fulfillment Module is the `@medusajs/medusa/fulfillment` NPM package that provides fulfillment-related features in your Medusa and Node.js applications. ## How to Use Fulfillment Module's Service -You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/utils`. +You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `Modules.API_KEY` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IFulfillmentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IFulfillmentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IFulfillmentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IFulfillmentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const fulfillmentModuleService: IFulfillmentModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IFulfillmentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IFulfillmentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const fulfillmentModuleService: IFulfillmentModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/inventory/examples/page.mdx b/www/apps/resources/app/commerce-modules/inventory/examples/page.mdx index 9eb1b8ade5dde..92dcd78544238 100644 --- a/www/apps/resources/app/commerce-modules/inventory/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/inventory/examples/page.mdx @@ -15,8 +15,8 @@ In this document, you’ll find common examples of how you can use the Inventory ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -42,7 +42,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" export async function POST(request: Request) { const inventoryModuleService = await initializeInventoryModule({}) @@ -70,8 +70,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -93,7 +93,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" export async function GET(request: Request) { const inventoryModuleService = await initializeInventoryModule({}) @@ -116,8 +116,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -141,7 +141,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" type ContextType = { params: { @@ -172,8 +172,8 @@ export async function GET(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -199,7 +199,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" export async function POST(request: Request) { const inventoryModuleService = await initializeInventoryModule({}) @@ -227,8 +227,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -254,7 +254,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" export async function POST(request: Request) { const inventoryModuleService = await initializeInventoryModule({}) @@ -282,8 +282,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -309,7 +309,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" export async function POST(request: Request) { const inventoryModuleService = await initializeInventoryModule({}) @@ -337,8 +337,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -364,7 +364,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" export async function POST(request: Request) { const inventoryModuleService = await initializeInventoryModule({}) @@ -394,8 +394,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -434,7 +434,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" type ContextType = { params: { @@ -481,8 +481,8 @@ export async function POST(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( request: MedusaRequest, @@ -504,7 +504,7 @@ export async function DELETE( ```ts -import { initialize as initializeInventoryModule } from "@medusajs/inventory-next" +import { initialize as initializeInventoryModule } from "@medusajs/medusa/inventory-next" type ContextType = { params: { diff --git a/www/apps/resources/app/commerce-modules/inventory/page.mdx b/www/apps/resources/app/commerce-modules/inventory/page.mdx index 8ac1e4d14a10b..5e261b07b9ea0 100644 --- a/www/apps/resources/app/commerce-modules/inventory/page.mdx +++ b/www/apps/resources/app/commerce-modules/inventory/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Inventory Module is the `@medusajs/inventory-next` NPM package that provides inventory-related features in your Medusa and Node.js applications. +The Inventory Module is the `@medusajs/medusa/inventory-next` NPM package that provides inventory-related features in your Medusa and Node.js applications. ## How to Use Inventory Module's Service -You can use the Inventory Module's main service by resolving from the Medusa container the resource `Modules.INVENTORY` imported from `@medusajs/utils`. +You can use the Inventory Module's main service by resolving from the Medusa container the resource `Modules.INVENTORY` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const inventoryModuleService: IInventoryService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IInventoryService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IInventoryService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const inventoryModuleService: IInventoryService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/order/page.mdx b/www/apps/resources/app/commerce-modules/order/page.mdx index 50318def02b72..350d07220ebf6 100644 --- a/www/apps/resources/app/commerce-modules/order/page.mdx +++ b/www/apps/resources/app/commerce-modules/order/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Order Module is the `@medusajs/order` NPM package that provides order-related features in your Medusa and Node.js applications. +The Order Module is the `@medusajs/medusa/order` NPM package that provides order-related features in your Medusa and Node.js applications. ## How to Use Order Module's Service -You can use the Order Module's main service by resolving from the Medusa container the resource `Modules.ORDER` imported from `@medusajs/utils`. +You can use the Order Module's main service by resolving from the Medusa container the resource `Modules.ORDER` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IOrderModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IOrderModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IOrderModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IOrderModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const orderModuleService: IOrderModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IOrderModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IOrderModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const orderModuleService: IOrderModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/order/promotion-adjustments/page.mdx b/www/apps/resources/app/commerce-modules/order/promotion-adjustments/page.mdx index be72e65dd0dc7..f7ccc4fdbcf32 100644 --- a/www/apps/resources/app/commerce-modules/order/promotion-adjustments/page.mdx +++ b/www/apps/resources/app/commerce-modules/order/promotion-adjustments/page.mdx @@ -53,7 +53,7 @@ import { ComputeActionItemLine, ComputeActionShippingLine, // ... -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... @@ -116,7 +116,7 @@ import { AddItemAdjustmentAction, AddShippingMethodAdjustment, // ... -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... diff --git a/www/apps/resources/app/commerce-modules/payment/examples/page.mdx b/www/apps/resources/app/commerce-modules/payment/examples/page.mdx index 6a9167a3426f8..ef04b477aee58 100644 --- a/www/apps/resources/app/commerce-modules/payment/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Payment Modu ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -46,7 +46,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePaymentModule } from "@medusajs/payment" +import { initialize as initializePaymentModule } from "@medusajs/medusa/payment" export async function POST(request: Request) { const paymentModuleService = await initializePaymentModule() @@ -77,8 +77,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -110,7 +110,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePaymentModule } from "@medusajs/payment" +import { initialize as initializePaymentModule } from "@medusajs/medusa/payment" export async function POST(request: Request) { const paymentModuleService = await initializePaymentModule() @@ -143,8 +143,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -170,7 +170,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializePaymentModule } from "@medusajs/payment" +import { initialize as initializePaymentModule } from "@medusajs/medusa/payment" export async function POST(request: Request) { const paymentModuleService = await initializePaymentModule() @@ -197,8 +197,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -225,7 +225,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePaymentModule } from "@medusajs/payment" +import { initialize as initializePaymentModule } from "@medusajs/medusa/payment" export async function POST(request: Request) { const paymentModuleService = await initializePaymentModule() @@ -253,8 +253,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -280,7 +280,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializePaymentModule } from "@medusajs/payment" +import { initialize as initializePaymentModule } from "@medusajs/medusa/payment" export async function GET(request: Request) { const paymentModuleService = await initializePaymentModule() @@ -307,8 +307,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -334,7 +334,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePaymentModule } from "@medusajs/payment" +import { initialize as initializePaymentModule } from "@medusajs/medusa/payment" export async function POST(request: Request) { const paymentModuleService = await initializePaymentModule() diff --git a/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx b/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx index 3e8af8b055c4c..21fc5aa2eb6b3 100644 --- a/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/module-options/page.mdx @@ -102,7 +102,7 @@ When the Medusa application starts, these providers are registered and can be us For example: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -110,11 +110,11 @@ module.exports = defineConfig({ // ... modules: { [Modules.PAYMENT]: { - resolve: "@medusajs/payment", + resolve: "@medusajs/medusa/payment", options: { providers: [ { - resolve: "@medusajs/payment-stripe", + resolve: "@medusajs/medusa/payment-stripe", id: "stripe", options: { // ... diff --git a/www/apps/resources/app/commerce-modules/payment/page.mdx b/www/apps/resources/app/commerce-modules/payment/page.mdx index 56e69bda51fb0..5a21929f144e9 100644 --- a/www/apps/resources/app/commerce-modules/payment/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/page.mdx @@ -7,11 +7,11 @@ export const metadata = { # {metadata.title} -The Payment Module is the `@medusajs/payment` NPM package that provides payment-related features in your Medusa and Node.js applications. +The Payment Module is the `@medusajs/medusa/payment` NPM package that provides payment-related features in your Medusa and Node.js applications. ## How to Use Payment Module's Service -You can use the Payment Module's main service by resolving from the Medusa container the resource `Modules.PAYMENT` imported from `@medusajs/utils`. +You can use the Payment Module's main service by resolving from the Medusa container the resource `Modules.PAYMENT` imported from `@medusajs/framework/utils`. For example: @@ -20,8 +20,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -42,8 +42,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const paymentModuleService: IPaymentModuleService = container.resolve( @@ -59,9 +59,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IPaymentModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IPaymentModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const paymentModuleService: IPaymentModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/payment/payment-provider/page.mdx b/www/apps/resources/app/commerce-modules/payment/payment-provider/page.mdx index 41879f08db016..431c248b053a7 100644 --- a/www/apps/resources/app/commerce-modules/payment/payment-provider/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/payment-provider/page.mdx @@ -30,7 +30,7 @@ The Payment Module provides a `system` payment provider that acts as a placehold ## How are Payment Providers Created? -A payment provider is a TypeScript or JavaScript class that extends the `AbstractPaymentProvider` imported from `@medusajs/utils`. It can then be exported as the main service of a module. +A payment provider is a TypeScript or JavaScript class that extends the `AbstractPaymentProvider` imported from `@medusajs/framework/utils`. It can then be exported as the main service of a module. diff --git a/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx b/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx index 80881645d217c..e01581b7bc6f5 100644 --- a/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/payment-provider/stripe/page.mdx @@ -20,7 +20,7 @@ These features are also available in a safe test environment, allowing for a con --- -## Install the Stripe Module Provider +## Register the Stripe Module Provider -To install the Stripe Module Provider, run the following command in the directory of your Medusa application: - -```bash npm2yarn -npm install @medusajs/payment-stripe@preview -``` - - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - -Next, add the module to the array of providers passed to the Payment Module: +Add the module to the array of providers passed to the Payment Module: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -60,11 +48,11 @@ module.exports = defineConfig({ // ... modules: { [Modules.PAYMENT]: { - resolve: "@medusajs/payment", + resolve: "@medusajs/medusa/payment", options: { providers: [ { - resolve: "@medusajs/payment-stripe", + resolve: "@medusajs/medusa/payment-stripe", id: "stripe", options: { apiKey: process.env.STRIPE_API_KEY, diff --git a/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx b/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx index 7275c1d478952..c83cdde18b691 100644 --- a/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx @@ -15,8 +15,8 @@ In this document, you’ll find common examples of how you can use the Pricing M ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -50,7 +50,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePricingModule } from "@medusajs/pricing" +import { initialize as initializePricingModule } from "@medusajs/medusa/pricing" export async function POST(request: Request) { const pricingModuleService = await initializePricingModule() @@ -86,8 +86,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -109,7 +109,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializePricingModule } from "@medusajs/pricing" +import { initialize as initializePricingModule } from "@medusajs/medusa/pricing" export async function GET(request: Request) { const pricingModuleService = await initializePricingModule() @@ -132,8 +132,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -155,7 +155,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializePricingModule } from "@medusajs/pricing" +import { initialize as initializePricingModule } from "@medusajs/medusa/pricing" export async function GET(request: Request) { const pricingModuleService = await initializePricingModule() @@ -178,8 +178,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -212,7 +212,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePricingModule } from "@medusajs/pricing" +import { initialize as initializePricingModule } from "@medusajs/medusa/pricing" export async function POST(request: Request) { const pricingModuleService = await initializePricingModule() @@ -247,9 +247,9 @@ export async function POST(request: Request) { ```ts collapsibleLines="1-8" expandButtonLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { PriceListType } from "@medusajs/utils" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { PriceListType } from "@medusajs/framework/utils" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -290,8 +290,8 @@ export async function POST( import { NextResponse } from "next/server" import { PriceListType } from "@medusajs/medusa" -import { initialize as initializePricingModule } from "@medusajs/pricing" -import { PriceListType } from "@medusajs/utils" +import { initialize as initializePricingModule } from "@medusajs/medusa/pricing" +import { PriceListType } from "@medusajs/framework/utils" export async function POST(request: Request) { const pricingModuleService = await initializePricingModule() @@ -332,8 +332,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -364,7 +364,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePricingModule } from "@medusajs/pricing" +import { initialize as initializePricingModule } from "@medusajs/medusa/pricing" export async function GET(request: Request) { const pricingModuleService = await initializePricingModule() diff --git a/www/apps/resources/app/commerce-modules/pricing/page.mdx b/www/apps/resources/app/commerce-modules/pricing/page.mdx index d05e3813ac74d..a704257822228 100644 --- a/www/apps/resources/app/commerce-modules/pricing/page.mdx +++ b/www/apps/resources/app/commerce-modules/pricing/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Pricing Module is the `@medusajs/pricing` NPM package that provides pricing-related features in your Medusa and Node.js applications. +The Pricing Module is the `@medusajs/medusa/pricing` NPM package that provides pricing-related features in your Medusa and Node.js applications. ## How to Use Pricing Module's Service -You can use the Pricing Module's main service by resolving from the Medusa container the resource `Modules.PRICING` imported from `@medusajs/utils`. +You can use the Pricing Module's main service by resolving from the Medusa container the resource `Modules.PRICING` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const pricingModuleService: IPricingModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IPricingModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IPricingModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const pricingModuleService: IPricingModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/product/examples/page.mdx b/www/apps/resources/app/commerce-modules/product/examples/page.mdx index 2a5f8b5ec28a8..c446b308e2dc0 100644 --- a/www/apps/resources/app/commerce-modules/product/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/product/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Product Modu ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const productModuleService: IProductModuleService = request.scope.resolve( @@ -54,7 +54,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeProductModule } from "@medusajs/product" +import { initialize as initializeProductModule } from "@medusajs/medusa/product" export async function POST(request: Request) { const productModuleService = await initializeProductModule() @@ -96,8 +96,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET(request: MedusaRequest, res: MedusaResponse) { const productModuleService: IProductModuleService = request.scope.resolve( @@ -116,7 +116,7 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeProductModule } from "@medusajs/product" +import { initialize as initializeProductModule } from "@medusajs/medusa/product" export async function GET(request: Request) { const productModuleService = await initializeProductModule() @@ -139,8 +139,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET(request: MedusaRequest, res: MedusaResponse) { const productModuleService: IProductModuleService = request.scope.resolve( @@ -159,7 +159,7 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeProductModule } from "@medusajs/product" +import { initialize as initializeProductModule } from "@medusajs/medusa/product" export async function GET( request: Request, @@ -186,8 +186,8 @@ export async function GET( ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET(request: MedusaRequest, res: MedusaResponse) { const productModuleService: IProductModuleService = request.scope.resolve( @@ -208,7 +208,7 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeProductModule } from "@medusajs/product" +import { initialize as initializeProductModule } from "@medusajs/medusa/product" export async function GET(request: Request) { const productModuleService = await initializeProductModule() @@ -233,8 +233,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const productModuleService: IProductModuleService = request.scope.resolve( @@ -253,7 +253,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeProductModule } from "@medusajs/product" +import { initialize as initializeProductModule } from "@medusajs/medusa/product" export async function GET(request: Request) { const productModuleService = await initializeProductModule() @@ -276,8 +276,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST(request: MedusaRequest, res: MedusaResponse) { const productModuleService: IProductModuleService = request.scope.resolve( @@ -298,7 +298,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) { ```ts import { NextResponse } from "next/server" -import { initialize as initializeProductModule } from "@medusajs/product" +import { initialize as initializeProductModule } from "@medusajs/medusa/product" export async function GET( request: Request, diff --git a/www/apps/resources/app/commerce-modules/product/guides/price-with-taxes/page.mdx b/www/apps/resources/app/commerce-modules/product/guides/price-with-taxes/page.mdx index 3918f3441e3a0..a1e91676a57bf 100644 --- a/www/apps/resources/app/commerce-modules/product/guides/price-with-taxes/page.mdx +++ b/www/apps/resources/app/commerce-modules/product/guides/price-with-taxes/page.mdx @@ -22,7 +22,7 @@ You'll need the following resources for the taxes calculation: import { Modules, ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" // In an API route, workflow step, etc... const query = container.resolve(ContainerRegistrationKeys.QUERY) @@ -38,7 +38,7 @@ const taxModuleService = container.resolve( After resolving the resources, use Query to retrieve the products with the variants' prices for a context: ```ts -import { QueryContext } from "@medusajs/utils" +import { QueryContext } from "@medusajs/framework/utils" // ... @@ -80,7 +80,7 @@ To retrieve the tax line of each product, first, add the following utility metho import { HttpTypes, TaxableItemDTO, -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... const asTaxItem = (product: HttpTypes.StoreProduct): TaxableItemDTO[] => { @@ -116,7 +116,7 @@ Then, use it when retrieving the tax lines of the products retrieved earlier: // other imports... import { ItemTaxLineDTO, -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... const taxLines = (await taxModuleService.getTaxLines( @@ -179,7 +179,7 @@ export const calculateTaxHighlights = [ // other imports... import { calculateAmountsWithTax, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" // ... products.forEach((product) => { @@ -204,7 +204,7 @@ products.forEach((product) => { For each product variant, you: 1. Retrieve its tax lines from the `taxLinesMap`. -2. Calculate its prices with and without taxes using the `calculateAmountsWithTax` function imported from `@medusajs/utils`. +2. Calculate its prices with and without taxes using the `calculateAmountsWithTax` function imported from `@medusajs/framework/utils`. 3. The `calculateAmountsWithTax` function returns an object having two properties: - `priceWithTax`: The variant's price with the taxes applied. - `priceWithoutTax`: The variant's price without taxes applied. diff --git a/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx b/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx index e5b5988627ad5..aecc1c9f5a8af 100644 --- a/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx +++ b/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx @@ -62,7 +62,7 @@ To retrieve calculated prices of variants based on a context, retrieve the produ For example: ```ts highlights={[["6"], ["12"], ["13"], ["14"], ["15"], ["16"], ["17"]]} -import { QueryContext } from "@medusajs/utils" +import { QueryContext } from "@medusajs/framework/utils" // ... diff --git a/www/apps/resources/app/commerce-modules/product/page.mdx b/www/apps/resources/app/commerce-modules/product/page.mdx index 44aa43ac37658..4d1146660f083 100644 --- a/www/apps/resources/app/commerce-modules/product/page.mdx +++ b/www/apps/resources/app/commerce-modules/product/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Product Module is the `@medusajs/product` NPM package that provides product-related features in your Medusa and Node.js applications. +The Product Module is the `@medusajs/medusa/product` NPM package that provides product-related features in your Medusa and Node.js applications. ## How to Use Product Module's Service -You can use the Product Module's main service by resolving from the Medusa container the resource `Modules.PRODUCT` imported from `@medusajs/utils`. +You can use the Product Module's main service by resolving from the Medusa container the resource `Modules.PRODUCT` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET(request: MedusaRequest, res: MedusaResponse) { const productModuleService: IProductModuleService = request.scope.resolve( @@ -38,8 +38,8 @@ export async function GET(request: MedusaRequest, res: MedusaResponse) { ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const productModuleService: IProductModuleService = container.resolve( @@ -54,9 +54,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const productModuleService: IProductModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/promotion/examples/page.mdx b/www/apps/resources/app/commerce-modules/promotion/examples/page.mdx index dcad198ab904f..503beb8cc250a 100644 --- a/www/apps/resources/app/commerce-modules/promotion/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/promotion/examples/page.mdx @@ -15,8 +15,8 @@ In this document, you’ll find common examples of how you can use the Promotion ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPromotionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPromotionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -47,7 +47,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePromotionModule } from "@medusajs/promotion" +import { initialize as initializePromotionModule } from "@medusajs/medusa/promotion" export async function POST(request: Request) { const promotionModuleService = await initializePromotionModule() @@ -80,8 +80,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPromotionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPromotionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -108,7 +108,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePromotionModule } from "@medusajs/promotion" +import { initialize as initializePromotionModule } from "@medusajs/medusa/promotion" export async function POST(request: Request) { const promotionModuleService = await initializePromotionModule() @@ -137,8 +137,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPromotionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPromotionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -176,7 +176,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializePromotionModule } from "@medusajs/promotion" +import { initialize as initializePromotionModule } from "@medusajs/medusa/promotion" export async function POST(request: Request) { const promotionModuleService = await initializePromotionModule() @@ -215,8 +215,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPromotionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPromotionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -238,7 +238,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializePromotionModule } from "@medusajs/promotion" +import { initialize as initializePromotionModule } from "@medusajs/medusa/promotion" export async function GET(request: Request) { const promotionModuleService = await initializePromotionModule() diff --git a/www/apps/resources/app/commerce-modules/promotion/page.mdx b/www/apps/resources/app/commerce-modules/promotion/page.mdx index 95afe2bd79c71..e154b7d5c6eba 100644 --- a/www/apps/resources/app/commerce-modules/promotion/page.mdx +++ b/www/apps/resources/app/commerce-modules/promotion/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Promotion Module is the `@medusajs/promotion` NPM package that provides promotion-related features in your Medusa and Node.js applications. +The Promotion Module is the `@medusajs/medusa/promotion` NPM package that provides promotion-related features in your Medusa and Node.js applications. ## How to Use the Promotion Module's Service -You can use the Promotion Module's main service by resolving from the Medusa container the resource `Modules.PROMOTION` imported from `@medusajs/utils`. +You can use the Promotion Module's main service by resolving from the Medusa container the resource `Modules.PROMOTION` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IPromotionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPromotionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IPromotionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IPromotionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const promotionModuleService: IPromotionModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IPromotionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IPromotionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const promotionModuleService: IPromotionModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/region/examples/page.mdx b/www/apps/resources/app/commerce-modules/region/examples/page.mdx index 53fb219285628..6ae287bb90bbe 100644 --- a/www/apps/resources/app/commerce-modules/region/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/region/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Region Modul ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -43,7 +43,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeRegionModule } from "@medusajs/region" +import { initialize as initializeRegionModule } from "@medusajs/medusa/region" export async function POST(request: Request) { const regionModuleService = await initializeRegionModule() @@ -71,8 +71,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -94,7 +94,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeRegionModule } from "@medusajs/region" +import { initialize as initializeRegionModule } from "@medusajs/medusa/region" export async function GET(request: Request) { const regionModuleService = await initializeRegionModule() @@ -117,8 +117,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -140,7 +140,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeRegionModule } from "@medusajs/region" +import { initialize as initializeRegionModule } from "@medusajs/medusa/region" export async function GET(request: Request) { const regionModuleService = await initializeRegionModule() @@ -163,8 +163,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -188,7 +188,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeRegionModule } from "@medusajs/region" +import { initialize as initializeRegionModule } from "@medusajs/medusa/region" export async function POST(request: Request) { const regionModuleService = await initializeRegionModule() @@ -213,8 +213,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( req: MedusaRequest, @@ -236,7 +236,7 @@ export async function DELETE( ```ts import { NextResponse } from "next/server" -import { initialize as initializeRegionModule } from "@medusajs/region" +import { initialize as initializeRegionModule } from "@medusajs/medusa/region" export async function DELETE(request: Request) { const regionModuleService = await initializeRegionModule() diff --git a/www/apps/resources/app/commerce-modules/region/page.mdx b/www/apps/resources/app/commerce-modules/region/page.mdx index 0e77c8363a696..08145bde63f7c 100644 --- a/www/apps/resources/app/commerce-modules/region/page.mdx +++ b/www/apps/resources/app/commerce-modules/region/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Region Module is the `@medusajs/region` NPM package that provides region-related features in your Medusa and Node.js applications. +The Region Module is the `@medusajs/medusa/region` NPM package that provides region-related features in your Medusa and Node.js applications. ## How to Use Region Module's Service -You can use the Region Module's main service by resolving from the Medusa container the resource `Modules.REGION` imported from `@medusajs/utils`. +You can use the Region Module's main service by resolving from the Medusa container the resource `Modules.REGION` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const regionModuleService: IRegionModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IRegionModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IRegionModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const regionModuleService: IRegionModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/sales-channel/examples/page.mdx b/www/apps/resources/app/commerce-modules/sales-channel/examples/page.mdx index 488c4e1e5780f..df2e4c248b3ef 100644 --- a/www/apps/resources/app/commerce-modules/sales-channel/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/sales-channel/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Sales Channe ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -41,7 +41,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeSalesChannelModule } from "@medusajs/sales-channel" +import { initialize as initializeSalesChannelModule } from "@medusajs/medusa/sales-channel" export async function POST(request: Request) { const salesChannelModuleService = await initializeSalesChannelModule() @@ -66,8 +66,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -88,7 +88,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeSalesChannelModule } from "@medusajs/sales-channel" +import { initialize as initializeSalesChannelModule } from "@medusajs/medusa/sales-channel" export async function GET(request: Request) { const salesChannelModuleService = await initializeSalesChannelModule() @@ -111,8 +111,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -137,7 +137,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeSalesChannelModule } from "@medusajs/sales-channel" +import { initialize as initializeSalesChannelModule } from "@medusajs/medusa/sales-channel" export async function GET(request: Request) { const salesChannelModuleService = await initializeSalesChannelModule() @@ -162,8 +162,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -189,7 +189,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeSalesChannelModule } from "@medusajs/sales-channel" +import { initialize as initializeSalesChannelModule } from "@medusajs/medusa/sales-channel" export async function POST(request: Request) { const salesChannelModuleService = await initializeSalesChannelModule() @@ -215,8 +215,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( request: MedusaRequest, @@ -237,7 +237,7 @@ export async function DELETE( ```ts import { NextResponse } from "next/server" -import { initialize as initializeSalesChannelModule } from "@medusajs/sales-channel" +import { initialize as initializeSalesChannelModule } from "@medusajs/medusa/sales-channel" export async function DELETE(request: Request) { const salesChannelModuleService = await initializeSalesChannelModule() diff --git a/www/apps/resources/app/commerce-modules/sales-channel/page.mdx b/www/apps/resources/app/commerce-modules/sales-channel/page.mdx index 97357e1e753d2..9ebb0d2fb60c0 100644 --- a/www/apps/resources/app/commerce-modules/sales-channel/page.mdx +++ b/www/apps/resources/app/commerce-modules/sales-channel/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Sales Channel Module is the `@medusajs/sales-channel` NPM package that provides sales-channel-related features in your Medusa and Node.js applications. +The Sales Channel Module is the `@medusajs/medusa/sales-channel` NPM package that provides sales-channel-related features in your Medusa and Node.js applications. ## How to Use Sales Channel Module's Service -You can use the Sales Channel Module's main service by resolving from the Medusa container the resource `Modules.SALES_CHANNEL` imported from `@medusajs/utils`. +You can use the Sales Channel Module's main service by resolving from the Medusa container the resource `Modules.SALES_CHANNEL` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -40,8 +40,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const salesChannelModuleService: ISalesChannelModuleService = @@ -55,9 +55,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { ISalesChannelModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { ISalesChannelModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const salesChannelModuleService: ISalesChannelModuleService = diff --git a/www/apps/resources/app/commerce-modules/stock-location/examples/page.mdx b/www/apps/resources/app/commerce-modules/stock-location/examples/page.mdx index dc97842260b62..e6539e98908b8 100644 --- a/www/apps/resources/app/commerce-modules/stock-location/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/stock-location/examples/page.mdx @@ -15,8 +15,8 @@ In this document, you’ll find common examples of how you can use the Stock Loc ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStockLocationService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStockLocationService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -41,7 +41,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStockLocationModule } from "@medusajs/stock-location-next" +import { initialize as initializeStockLocationModule } from "@medusajs/medusa/stock-location-next" export async function POST(request: Request) { const stockLocationModuleService = await initializeStockLocationModule({}) @@ -66,8 +66,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStockLocationService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStockLocationService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -88,7 +88,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStockLocationModule } from "@medusajs/stock-location-next" +import { initialize as initializeStockLocationModule } from "@medusajs/medusa/stock-location-next" export async function GET(request: Request) { const stockLocationModuleService = await initializeStockLocationModule({}) @@ -111,8 +111,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStockLocationService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStockLocationService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -143,7 +143,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStockLocationModule } from "@medusajs/stock-location-next" +import { initialize as initializeStockLocationModule } from "@medusajs/medusa/stock-location-next" export async function POST(request: Request) { const stockLocationModuleService = await initializeStockLocationModule({}) @@ -176,8 +176,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStockLocationService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStockLocationService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( request: MedusaRequest, @@ -198,7 +198,7 @@ export async function DELETE( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStockLocationModule } from "@medusajs/stock-location-next" +import { initialize as initializeStockLocationModule } from "@medusajs/medusa/stock-location-next" export async function DELETE(request: Request) { const stockLocationModuleService = await initializeStockLocationModule({}) diff --git a/www/apps/resources/app/commerce-modules/stock-location/page.mdx b/www/apps/resources/app/commerce-modules/stock-location/page.mdx index 7f797747e1ba2..982a7afbc8de8 100644 --- a/www/apps/resources/app/commerce-modules/stock-location/page.mdx +++ b/www/apps/resources/app/commerce-modules/stock-location/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Stock Location Module is the `@medusajs/stock-location-next` NPM package that provides stock-location-related features in your Medusa and Node.js applications. +The Stock Location Module is the `@medusajs/medusa/stock-location-next` NPM package that provides stock-location-related features in your Medusa and Node.js applications. ## How to Use Stock Location Module's Service -You can use the Stock Location Module's main service by resolving from the Medusa container the resource `Modules.STOCK_LOCATION` imported from `@medusajs/utils`. +You can use the Stock Location Module's main service by resolving from the Medusa container the resource `Modules.STOCK_LOCATION` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStockLocationService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStockLocationService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -40,8 +40,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IStockLocationService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStockLocationService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const stockLocationModuleService: IStockLocationService = container.resolve( @@ -56,9 +56,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IStockLocationService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IStockLocationService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const stockLocationModuleService: IStockLocationService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/store/examples/page.mdx b/www/apps/resources/app/commerce-modules/store/examples/page.mdx index b97fc5d40bd1c..8a706681c356e 100644 --- a/www/apps/resources/app/commerce-modules/store/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/store/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Store Module ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -48,7 +48,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStoreModule } from "@medusajs/store" +import { initialize as initializeStoreModule } from "@medusajs/medusa/store" export async function POST(request: Request) { const storeModuleService = await initializeStoreModule() @@ -81,8 +81,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -104,7 +104,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStoreModule } from "@medusajs/store" +import { initialize as initializeStoreModule } from "@medusajs/medusa/store" export async function GET(request: Request) { const storeModuleService = await initializeStoreModule() @@ -129,8 +129,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -154,7 +154,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStoreModule } from "@medusajs/store" +import { initialize as initializeStoreModule } from "@medusajs/medusa/store" export async function GET(request: Request, { params }: ContextType) { const storeModuleService = await initializeStoreModule() @@ -177,8 +177,8 @@ export async function GET(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( request: MedusaRequest, @@ -204,7 +204,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStoreModule } from "@medusajs/store" +import { initialize as initializeStoreModule } from "@medusajs/medusa/store" export async function POST(request: Request, { params }: ContextType) { const storeModuleService = await initializeStoreModule() @@ -229,8 +229,8 @@ export async function POST(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( request: MedusaRequest, @@ -252,7 +252,7 @@ export async function DELETE( ```ts import { NextResponse } from "next/server" -import { initialize as initializeStoreModule } from "@medusajs/store" +import { initialize as initializeStoreModule } from "@medusajs/medusa/store" export async function DELETE(request: Request, { params }: ContextType) { const storeModuleService = await initializeStoreModule() diff --git a/www/apps/resources/app/commerce-modules/store/page.mdx b/www/apps/resources/app/commerce-modules/store/page.mdx index 7fb4aeed901a6..607b263742f3a 100644 --- a/www/apps/resources/app/commerce-modules/store/page.mdx +++ b/www/apps/resources/app/commerce-modules/store/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Store Module is the `@medusajs/store` NPM package that provides store-related features in your Medusa and Node.js applications. +The Store Module is the `@medusajs/medusa/store` NPM package that provides store-related features in your Medusa and Node.js applications. ## How to Use Store Module's Service -You can use the Store Module's main service by resolving from the Medusa container the resource `Modules.STORE` imported from `@medusajs/utils`. +You can use the Store Module's main service by resolving from the Medusa container the resource `Modules.STORE` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( request: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const storeModuleService: IStoreModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IStoreModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IStoreModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const storeModuleService: IStoreModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/tax/examples/page.mdx b/www/apps/resources/app/commerce-modules/tax/examples/page.mdx index 56642c53161d0..5b8e4e9b7dcec 100644 --- a/www/apps/resources/app/commerce-modules/tax/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/tax/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Tax Module i ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -46,7 +46,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeTaxModule } from "@medusajs/tax" +import { initialize as initializeTaxModule } from "@medusajs/medusa/tax" export async function POST(request: Request) { const taxModuleService = await initializeTaxModule() @@ -77,8 +77,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -100,7 +100,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeTaxModule } from "@medusajs/tax" +import { initialize as initializeTaxModule } from "@medusajs/medusa/tax" export async function GET(request: Request) { const taxModuleService = await initializeTaxModule() @@ -123,8 +123,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -162,7 +162,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeTaxModule } from "@medusajs/tax" +import { initialize as initializeTaxModule } from "@medusajs/medusa/tax" export async function POST(request: Request) { const taxModuleService = await initializeTaxModule() @@ -201,8 +201,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -224,7 +224,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeTaxModule } from "@medusajs/tax" +import { initialize as initializeTaxModule } from "@medusajs/medusa/tax" export async function GET(request: Request) { const taxModuleService = await initializeTaxModule() @@ -247,8 +247,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -296,7 +296,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeTaxModule } from "@medusajs/tax" +import { initialize as initializeTaxModule } from "@medusajs/medusa/tax" export async function GET(request: Request) { const taxModuleService = await initializeTaxModule() diff --git a/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx b/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx index 6f58db2e3e33e..b983ba5f71e8d 100644 --- a/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/tax/module-options/page.mdx @@ -19,7 +19,7 @@ The `providers` option is an array of either tax module providers, tax plugins, When the Medusa application starts, these providers are registered and can be used to retrieve tax lines. ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -27,7 +27,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.TAX]: { - resolve: "@medusajs/tax", + resolve: "@medusajs/medusa/tax", options: { providers: [ { diff --git a/www/apps/resources/app/commerce-modules/tax/page.mdx b/www/apps/resources/app/commerce-modules/tax/page.mdx index 8a42beb45cadf..a592c6193fee4 100644 --- a/www/apps/resources/app/commerce-modules/tax/page.mdx +++ b/www/apps/resources/app/commerce-modules/tax/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The Tax Module is the `@medusajs/tax` NPM package that provides tax-related features in your Medusa and Node.js applications. +The Tax Module is the `@medusajs/medusa/tax` NPM package that provides tax-related features in your Medusa and Node.js applications. ## How to Use Tax Module's Service -You can use the Tax Module's main service by resolving from the Medusa container the resource `Modules.TAX` imported from `@medusajs/utils`. +You can use the Tax Module's main service by resolving from the Medusa container the resource `Modules.TAX` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const taxModuleService: ITaxModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { ITaxModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { ITaxModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const taxModuleService: ITaxModuleService = container.resolve( diff --git a/www/apps/resources/app/commerce-modules/user/examples/page.mdx b/www/apps/resources/app/commerce-modules/user/examples/page.mdx index 475a804777a55..75ebe6b083155 100644 --- a/www/apps/resources/app/commerce-modules/user/examples/page.mdx +++ b/www/apps/resources/app/commerce-modules/user/examples/page.mdx @@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the User Module ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -42,7 +42,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeUserModule } from "@medusajs/user" +import { initialize as initializeUserModule } from "@medusajs/medusa/user" export async function POST(request: Request) { const userModuleService = await initializeUserModule() @@ -71,8 +71,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -94,7 +94,7 @@ export async function GET( ```ts import { NextResponse } from "next/server" -import { initialize as initializeUserModule } from "@medusajs/user" +import { initialize as initializeUserModule } from "@medusajs/medusa/user" export async function GET(request: Request) { const userModuleService = await initializeUserModule() @@ -117,8 +117,8 @@ export async function GET(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -143,7 +143,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeUserModule } from "@medusajs/user" +import { initialize as initializeUserModule } from "@medusajs/medusa/user" export async function POST(request: Request) { const userModuleService = await initializeUserModule() @@ -171,8 +171,8 @@ export async function POST(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function DELETE( req: MedusaRequest, @@ -192,7 +192,7 @@ export async function DELETE( ```ts import { NextResponse } from "next/server" -import { initialize as initializeUserModule } from "@medusajs/user" +import { initialize as initializeUserModule } from "@medusajs/medusa/user" export async function DELETE(request: Request) { const userModuleService = await initializeUserModule() @@ -213,8 +213,8 @@ export async function DELETE(request: Request) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -240,7 +240,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeUserModule } from "@medusajs/user" +import { initialize as initializeUserModule } from "@medusajs/medusa/user" export async function POST(request: Request, { params }: ContextType) { const userModuleService = await initializeUserModule() @@ -267,8 +267,8 @@ export async function POST(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -302,7 +302,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeUserModule } from "@medusajs/user" +import { initialize as initializeUserModule } from "@medusajs/medusa/user" export async function POST(request: Request, { params }: ContextType) { const userModuleService = await initializeUserModule() @@ -337,8 +337,8 @@ export async function POST(request: Request, { params }: ContextType) { ```ts import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function POST( req: MedusaRequest, @@ -362,7 +362,7 @@ export async function POST( ```ts import { NextResponse } from "next/server" -import { initialize as initializeUserModule } from "@medusajs/user" +import { initialize as initializeUserModule } from "@medusajs/medusa/user" export async function POST(request: Request, { params }: ContextType) { const userModuleService = await initializeUserModule() diff --git a/www/apps/resources/app/commerce-modules/user/module-options/page.mdx b/www/apps/resources/app/commerce-modules/user/module-options/page.mdx index ed62b29149fcd..0f9cf0268fcde 100644 --- a/www/apps/resources/app/commerce-modules/user/module-options/page.mdx +++ b/www/apps/resources/app/commerce-modules/user/module-options/page.mdx @@ -15,7 +15,7 @@ In this document, you'll learn about the options of the User Module. ## Module Options ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -23,7 +23,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.USER]: { - resolve: "@medusajs/user", + resolve: "@medusajs/medusa/user", options: { jwt_secret: process.env.JWT_SECRET, }, diff --git a/www/apps/resources/app/commerce-modules/user/page.mdx b/www/apps/resources/app/commerce-modules/user/page.mdx index 1ea3daf98e514..df6c8f5acf5fb 100644 --- a/www/apps/resources/app/commerce-modules/user/page.mdx +++ b/www/apps/resources/app/commerce-modules/user/page.mdx @@ -6,11 +6,11 @@ export const metadata = { # {metadata.title} -The User Module is the `@medusajs/user` NPM package that provides user-related features in your Medusa and Node.js applications. +The User Module is the `@medusajs/medusa/user` NPM package that provides user-related features in your Medusa and Node.js applications. ## How to Use User Module's Service -You can use the User Module's main service by resolving from the Medusa container the resource `Modules.USER` imported from `@medusajs/utils`. +You can use the User Module's main service by resolving from the Medusa container the resource `Modules.USER` imported from `@medusajs/framework/utils`. For example: @@ -19,8 +19,8 @@ For example: ```ts title="src/api/store/custom/route.ts" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export async function GET( req: MedusaRequest, @@ -41,8 +41,8 @@ export async function GET( ```ts title="src/subscribers/custom-handler.ts" import { SubscriberArgs } from "@medusajs/medusa" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" export default async function subscriberHandler({ container }: SubscriberArgs) { const userModuleService: IUserModuleService = container.resolve( @@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) { ```ts title="src/workflows/hello-world/step1.ts" - import { createStep } from "@medusajs/workflows-sdk" - import { IUserModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + import { createStep } from "@medusajs/framework/workflows-sdk" + import { IUserModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" const step1 = createStep("step-1", async (_, { container }) => { const userModuleService: IUserModuleService = container.resolve( diff --git a/www/apps/resources/app/deployment/medusa-application/railway/page.mdx b/www/apps/resources/app/deployment/medusa-application/railway/page.mdx index 29f67c591b51d..f3b3d339737f2 100644 --- a/www/apps/resources/app/deployment/medusa-application/railway/page.mdx +++ b/www/apps/resources/app/deployment/medusa-application/railway/page.mdx @@ -134,29 +134,29 @@ For example, add the following dependencies in `package.json` for the Cache, Eve ```json "dependencies": { // ... - "@medusajs/cache-redis": "preview", - "@medusajs/event-bus-redis": "preview", - "@medusajs/workflow-engine-redis": "preview" + "@medusajs/medusa/cache-redis": "rc", + "@medusajs/medusa/event-bus-redis": "rc", + "@medusajs/workflow-engine-redis": "rc" } ``` Then, add these modules in `medusa-config.js`: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") module.exports = defineConfig({ // ... modules: { // ... [Modules.CACHE]: { - resolve: "@medusajs/cache-redis", + resolve: "@medusajs/medusa/cache-redis", options: { redisUrl: process.env.REDIS_URL, }, }, [Modules.EVENT_BUS]: { - resolve: "@medusajs/event-bus-redis", + resolve: "@medusajs/medusa/event-bus-redis", options: { redisUrl: process.env.REDIS_URL, }, diff --git a/www/apps/resources/app/medusa-container-resources/page.mdx b/www/apps/resources/app/medusa-container-resources/page.mdx index b5f8c36ddeb8f..0b62afbe8ea07 100644 --- a/www/apps/resources/app/medusa-container-resources/page.mdx +++ b/www/apps/resources/app/medusa-container-resources/page.mdx @@ -10,7 +10,7 @@ This documentation page includes the list of resources registered in the Medusa -Use the `ContainerRegistrationKeys` enum imported from `@medusajs/utils` to resolve these resources' names. +Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/utils` to resolve these resources' names. @@ -122,7 +122,7 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/utils` to reso - For custom modules, the registration name is the key of the module in the `modules` configuration. - - For Medusa's commerce modules, you can use the `Modules` enum imported from `@medusajs/utils`. + - For Medusa's commerce modules, you can use the `Modules` enum imported from `@medusajs/framework/utils`. diff --git a/www/apps/resources/app/medusa-workflows-reference/page.mdx b/www/apps/resources/app/medusa-workflows-reference/page.mdx index 90f5208a2ea7e..731b4615b0064 100644 --- a/www/apps/resources/app/medusa-workflows-reference/page.mdx +++ b/www/apps/resources/app/medusa-workflows-reference/page.mdx @@ -8,6 +8,6 @@ export const metadata = { This section of the documentation provides a reference to the workflows created by Medusa. These workflows are used in the Store and Admin API routes. -You can use these workflows in your customizations as well. They're available in the `@medusajs/core-flows` package. +You can use these workflows in your customizations as well. They're available in the `@medusajs/medusa/core-flows` package. diff --git a/www/apps/resources/app/recipes/b2b/page.mdx b/www/apps/resources/app/recipes/b2b/page.mdx index c0aa8a2c14a06..42b8f49d27ef9 100644 --- a/www/apps/resources/app/recipes/b2b/page.mdx +++ b/www/apps/resources/app/recipes/b2b/page.mdx @@ -202,7 +202,7 @@ You can create a B2B module that adds necessary data models to represent a B2B c Then, create the file `src/modules/b2b/models/company.ts` with the following content: ```ts title="src/modules/b2b/models/company.ts" highlights={[["8", "", "The property will be used to create a relationship to customer groups."]]} - import { model } from "@medusajs/utils" + import { model } from "@medusajs/framework/utils" const Company = model.define("company", { id: model.id().primaryKey(), @@ -239,7 +239,7 @@ You can create a B2B module that adds necessary data models to represent a B2B c Then, create the module's main service at `src/modules/b2b/service.ts` with the following content: ```ts title="src/modules/b2b/service.ts" - import { MedusaService } from "@medusajs/utils" + import { MedusaService } from "@medusajs/framework/utils" import Company from "./models/company" class B2bModuleService extends MedusaService({ @@ -257,7 +257,7 @@ You can create a B2B module that adds necessary data models to represent a B2B c ```ts title="src/modules/b2b/index.ts" import B2bModuleService from "./service" - import { Module } from "@medusajs/utils" + import { Module } from "@medusajs/framework/utils" export default Module("b2b", { service: B2bModuleService, @@ -293,7 +293,7 @@ You can create a B2B module that adds necessary data models to represent a B2B c Start by creating the file `src/types/b2b/index.ts` with some helper types: ```ts title="src/types/b2b/index.ts" - import { CustomerGroupDTO } from "@medusajs/types" + import { CustomerGroupDTO } from "@medusajs/framework/types" export type CompanyDTO = { id: string @@ -327,11 +327,11 @@ export const workflowHighlights = [ StepResponse, createStep, createWorkflow, - } from "@medusajs/workflows-sdk" + } from "@medusajs/framework/workflows-sdk" import { createCustomerGroupsWorkflow, - } from "@medusajs/core-flows" - import { CreateCustomerGroupDTO } from "@medusajs/types" + } from "@medusajs/medusa/core-flows" + import { CreateCustomerGroupDTO } from "@medusajs/framework/types" import { CompanyDTO, CreateCompanyDTO } from "../types/b2b" import B2bModuleService from "../modules/b2b/service" @@ -609,8 +609,8 @@ export const checkCustomerHighlights = [ AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" - import { Modules } from "@medusajs/utils" - import { ICustomerModuleService } from "@medusajs/types" + import { Modules } from "@medusajs/framework/utils" + import { ICustomerModuleService } from "@medusajs/framework/types" import B2bModuleService from "../../../../modules/b2b/service" export async function GET( diff --git a/www/apps/resources/app/recipes/commerce-automation/page.mdx b/www/apps/resources/app/recipes/commerce-automation/page.mdx index f22a4b9e5b097..2d08da1052f26 100644 --- a/www/apps/resources/app/recipes/commerce-automation/page.mdx +++ b/www/apps/resources/app/recipes/commerce-automation/page.mdx @@ -81,7 +81,7 @@ export const restockModelHighlights = [ ] ```ts title="src/modules/restock-notification/models/restock-notification.ts" highlights={restockModelHighlights} - import { model } from "@medusajs/utils" + import { model } from "@medusajs/framework/utils" const RestockNotification = model.define("restock_notification", { id: model.id().primaryKey(), @@ -125,7 +125,7 @@ export const restockModelHighlights = [ Then, create the module's main service at `src/modules/restock-notification/service.ts` with the following content: ```ts title="src/modules/restock-notification/service.ts" - import { MedusaService } from "@medusajs/utils" + import { MedusaService } from "@medusajs/framework/utils" import RestockNotification from "./models/restock-notification" class RestockNotificationModuleService extends MedusaService({ @@ -143,7 +143,7 @@ export const restockModelHighlights = [ ```ts title="src/modules/restock-notification/index.ts" import RestockNotificationModuleService from "./service" - import { Module } from "@medusajs/utils" + import { Module } from "@medusajs/framework/utils" export default Module("restock-notification", { service: RestockNotificationModuleService, @@ -247,15 +247,15 @@ export const subscriberHighlights = [ IInventoryService, INotificationModuleService, RemoteQueryFunction, - } from "@medusajs/types" + } from "@medusajs/framework/types" import { ContainerRegistrationKeys, Modules, remoteQueryObjectFromString, - } from "@medusajs/utils" + } from "@medusajs/framework/utils" import { RemoteLink, - } from "@medusajs/modules-sdk" + } from "@medusajs/framework/modules-sdk" import RestockNotificationModuleService from "../modules/restock-notification/service" @@ -462,18 +462,18 @@ export const syncProductsWorkflowHighlight = [ ```ts title="src/workflows/sync-products.ts" highlights={syncProductsWorkflowHighlight} collapsibleLines="1-16" expandButtonLabel="Show Imports" import { Modules - } from "@medusajs/utils" + } from "@medusajs/framework/utils" import { IProductModuleService, IStoreModuleService, ProductDTO, StoreDTO - } from "@medusajs/types" + } from "@medusajs/framework/types" import { StepResponse, createStep, createWorkflow, - } from "@medusajs/workflows-sdk" + } from "@medusajs/framework/workflows-sdk" type RetrieveStoreStepInput = { id: string @@ -616,7 +616,7 @@ export const syncProductsWorkflowHighlight = [ Then, create a scheduled job at `src/jobs/sync-products.ts` that executes the workflow at the specified interval: ```ts - import { MedusaContainer } from "@medusajs/types" + import { MedusaContainer } from "@medusajs/framework/types" import { syncProductsWorkflow, } from "../workflows/sync-products" @@ -765,11 +765,11 @@ The `order.placed` event is currently not emitted. } from "@medusajs/medusa" import { Modules, - } from "@medusajs/utils" + } from "@medusajs/framework/utils" import { ICustomerModuleService, IOrderModuleService, - } from "@medusajs/types" + } from "@medusajs/framework/types" export default async function orderCreatedHandler({ event: { data }, @@ -879,13 +879,13 @@ export const newsletterHighlights = [ } from "@medusajs/medusa" import { Modules, - } from "@medusajs/utils" + } from "@medusajs/framework/utils" import { ICustomerModuleService, IProductModuleService, IStoreModuleService, INotificationModuleService, - } from "@medusajs/types" + } from "@medusajs/framework/types" export default async function productCreateHandler({ container, diff --git a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx index bc623e0a6ec87..ebae4b215e492 100644 --- a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx @@ -60,7 +60,7 @@ Create the directory `src/modules/digital-product`. Create the file `src/modules/digital-product/models/digital-product.ts` with the following content: ```ts title="src/modules/digital-product/models/digital-product.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import DigitalProductMedia from "./digital-product-media" import DigitalProductOrder from "./digital-product-order" @@ -90,7 +90,7 @@ export const dpmModelHighlights = [ ] ```ts title="src/modules/digital-product/models/digital-product-media.ts" highlights={dpmModelHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import { MediaType } from "../types" import DigitalProduct from "./digital-product" @@ -123,7 +123,7 @@ This enum indicates that a digital product media can either be used to preview t Next, create the file `src/modules/digital-product/models/digital-product-order.ts` with the following content: ```ts title="src/modules/digital-product/models/digital-product-order.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import { OrderStatus } from "../types" import DigitalProduct from "./digital-product" @@ -154,7 +154,7 @@ export enum OrderStatus { Next, create the main service of the module at `src/modules/digital-product/service.ts` with the following content: ```ts title="src/modules/digital-product/service.ts" -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import DigitalProduct from "./models/digital-product" import DigitalProductOrder from "./models/digital-product-order" import DigitalProductMedia from "./models/digital-product-media" @@ -178,7 +178,7 @@ After that, create the module definition at `src/modules/digital-product/index.t ```ts title="src/modules/digital-product/index.ts" import DigitalProductModuleService from "./service" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" export const DIGITAL_PRODUCT_MODULE = "digitalProductModuleService" @@ -217,8 +217,8 @@ Start by creating the file `src/links/digital-product-variant.ts` with the follo ```ts title="src/links/digital-product-variant.ts" import DigitalProductModule from "../modules/digital-product" -import ProductModule from "@medusajs/product" -import { defineLink } from "@medusajs/utils" +import ProductModule from "@medusajs/medusa/product" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( DigitalProductModule.linkable.digitalProduct, @@ -236,8 +236,8 @@ export const orderLinkHighlights = [ ```ts title="src/links/digital-product-order.ts" import DigitalProductModule from "../modules/digital-product" -import OrderModule from "@medusajs/order" -import { defineLink } from "@medusajs/utils" +import OrderModule from "@medusajs/medusa/order" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( { @@ -288,7 +288,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" export const GET = async ( req: AuthenticatedMedusaRequest, @@ -379,10 +379,10 @@ graph TD createDigitalProductMediasStep --> createRemoteLinkStep["createRemoteLinkStep (Medusa)"] ``` -1. `createProductsWorkflow`: Create the Medusa product that the digital product is associated with its variant. Medusa provides this workflow through the `@medusajs/core-flows` package, which you can use as a step. +1. `createProductsWorkflow`: Create the Medusa product that the digital product is associated with its variant. Medusa provides this workflow through the `@medusajs/medusa/core-flows` package, which you can use as a step. 2. `createDigitalProductStep`: Create the digital product. 3. `createDigitalProductMediasStep`: Create the medias associated with the digital product. -4. `createRemoteLinkStep`: Create the link between the digital product and the product variant. Medusa provides this step through the `@medusajs/core-flows` package. +4. `createRemoteLinkStep`: Create the link between the digital product and the product variant. Medusa provides this step through the `@medusajs/medusa/core-flows` package. You’ll implement the second and third steps. @@ -400,7 +400,7 @@ export const createDpHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import DigitalProductModuleService from "../../../modules/digital-product/service" import { DIGITAL_PRODUCT_MODULE } from "../../../modules/digital-product" @@ -454,7 +454,7 @@ export const createDigitalProductMediaHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import DigitalProductModuleService from "../../../modules/digital-product/service" import { DIGITAL_PRODUCT_MODULE } from "../../../modules/digital-product" import { MediaType } from "../../../modules/digital-product/types" @@ -520,17 +520,17 @@ import { createWorkflow, transform, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { CreateProductWorkflowInputDTO, -} from "@medusajs/types" +} from "@medusajs/framework/types" import { createProductsWorkflow, createRemoteLinkStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import { Modules, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import createDigitalProductStep, { CreateDigitalProductStepInput, } from "./steps/create-digital-product" @@ -744,8 +744,8 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { uploadFilesWorkflow } from "@medusajs/core-flows" -import { MedusaError } from "@medusajs/utils" +import { uploadFilesWorkflow } from "@medusajs/medusa/core-flows" +import { MedusaError } from "@medusajs/framework/utils" export const POST = async ( req: AuthenticatedMedusaRequest, @@ -779,7 +779,7 @@ export const POST = async ( This adds a `POST` API route at `/admin/digital-products/upload/[type]` where `[type]` is either `preview` or `main`. -In the route handler, you use the `uploadFilesWorkflow` imported from `@medusajs/core-flows` to upload the file. If the file type is `main`, it’s uploaded with private access, as only customers who purchased it can download it. Otherwise, it’s uploaded with `public` access. +In the route handler, you use the `uploadFilesWorkflow` imported from `@medusajs/medusa/core-flows` to upload the file. If the file type is `main`, it’s uploaded with private access, as only customers who purchased it can download it. Otherwise, it’s uploaded with `public` access. Next, add to the file `src/api/middlewares.ts` the `multer` middleware on this API route: @@ -814,7 +814,7 @@ In this step, you’ll add a UI route to the Medusa Admin that displays a list o Before you create the UI route, create the file `src/admin/types/index.ts` that holds the following types: ```ts title="src/admin/types/index.ts" -import { ProductVariantDTO } from "@medusajs/types" +import { ProductVariantDTO } from "@medusajs/framework/types" export enum MediaType { MAIN = "main", @@ -1435,7 +1435,7 @@ Start by creating the `src/modules/digital-product-fulfillment` directory. Then, create the file `src/modules/digital-product-fulfillment/service.ts` with the following content: ```ts title="src/modules/digital-product-fulfillment/service.ts" -import { AbstractFulfillmentProviderService } from "@medusajs/utils" +import { AbstractFulfillmentProviderService } from "@medusajs/framework/utils" class DigitalProductFulfillmentService extends AbstractFulfillmentProviderService { static identifier = "digital" @@ -1488,7 +1488,7 @@ The fulfillment provider registers one fulfillment option, and doesn't perform a Then, create the module provider's definition in the file `src/modules/digital-product-fulfillment/index.ts`: ```ts title="src/modules/digital-product-fulfillment/index.ts" -import { ModuleProviderExports } from "@medusajs/types" +import { ModuleProviderExports } from "@medusajs/framework/types" import DigitalProductFulfillmentService from "./service" const services = [DigitalProductFulfillmentService] @@ -1506,17 +1506,17 @@ Finally, register the module provider in `medusa-config.js`: ```js title="medusa-config.js" // other imports... -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") module.exports = defineConfig({ modules: { // ... [Modules.FULFILLMENT]: { - resolve: "@medusajs/fulfillment", + resolve: "@medusajs/medusa/fulfillment", options: { providers: [ { - resolve: "@medusajs/fulfillment-manual", + resolve: "@medusajs/medusa/fulfillment-manual", id: "manual", }, { @@ -1560,13 +1560,13 @@ graph TD The workflow has the following steps: -1. `completeCartWorkflow` to create a Medusa order from the cart. Medusa provides this workflow through the `@medusajs/core-flows` package and you can use it as a step. -2. `useRemoteQueryStep` to retrieve the order’s items with the digital products associated with the purchased product variants. Medusa provides this step through the `@medusajs/core-flows` package. +1. `completeCartWorkflow` to create a Medusa order from the cart. Medusa provides this workflow through the `@medusajs/medusa/core-flows` package and you can use it as a step. +2. `useRemoteQueryStep` to retrieve the order’s items with the digital products associated with the purchased product variants. Medusa provides this step through the `@medusajs/medusa/core-flows` package. 3. If the order has digital products, you: 1. create the digital product order. - 2. link the digital product order with the Medusa order. Medusa provides a `createRemoteLinkStep` in the `@medusajs/core-flows` package that can be used here. - 3. Create a fulfillment for the digital products in the order. Medusa provides a `createOrderFulfillmentWorkflow` in the `@medusajs/core-flows` package that you can use as a step here. - 4. Emit the `digital_product_order.created` custom event to handle it later in a subscriber and send the customer an email. Medusa provides a `emitEventStep` in the `@medusajs/core-flows` that you can use as a step here. + 2. link the digital product order with the Medusa order. Medusa provides a `createRemoteLinkStep` in the `@medusajs/medusa/core-flows` package that can be used here. + 3. Create a fulfillment for the digital products in the order. Medusa provides a `createOrderFulfillmentWorkflow` in the `@medusajs/medusa/core-flows` package that you can use as a step here. + 4. Emit the `digital_product_order.created` custom event to handle it later in a subscriber and send the customer an email. Medusa provides a `emitEventStep` in the `@medusajs/medusa/core-flows` that you can use as a step here. You’ll only implement the `3.a` step of the workflow. @@ -1585,12 +1585,12 @@ export const createDpoHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { OrderLineItemDTO, ProductVariantDTO, InferTypeOf, -} from "@medusajs/types" +} from "@medusajs/framework/types" import { OrderStatus } from "../../../modules/digital-product/types" import DigitalProductModuleService from "../../../modules/digital-product/service" import { DIGITAL_PRODUCT_MODULE } from "../../../modules/digital-product" @@ -1662,15 +1662,15 @@ import { transform, when, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { completeCartWorkflow, useRemoteQueryStep, createRemoteLinkStep, createOrderFulfillmentWorkflow, emitEventStep, -} from "@medusajs/core-flows" -import { Modules } from "@medusajs/utils" +} from "@medusajs/medusa/core-flows" +import { Modules } from "@medusajs/framework/utils" import createDigitalProductOrderStep from "./steps/create-digital-product-order" import { DIGITAL_PRODUCT_MODULE } from "../../modules/digital-product" @@ -1823,7 +1823,7 @@ In this step, you'll create a workflow that fulfills a digital order by sending The workflow has the following steps: -1. Retrieve the digital product order's details. For this, you'll use the `useRemoteQueryStep` imported from `@medusajs/core-flows`. +1. Retrieve the digital product order's details. For this, you'll use the `useRemoteQueryStep` imported from `@medusajs/medusa/core-flows`. 2. Send a notification to the customer with the digital products to download. So, you only need to implement the second step. @@ -1833,7 +1833,7 @@ So, you only need to implement the second step. Before creating the step, add to `src/modules/digital-product/types/index.ts` the following: ```ts -import { OrderDTO, InferTypeOf } from "@medusajs/types" +import { OrderDTO, InferTypeOf } from "@medusajs/framework/types" import DigitalProductOrder from "../models/digital-product-order" // ... @@ -1856,12 +1856,12 @@ To create the step, create the file `src/workflows/fulfill-digital-order/steps/s import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { INotificationModuleService, IFileModuleService, -} from "@medusajs/types" -import { ModuleRegistrationName } from "@medusajs/utils" +} from "@medusajs/framework/types" +import { ModuleRegistrationName } from "@medusajs/framework/utils" import { DigitalProductOrder, MediaType } from "../../../modules/digital-product/types" type SendDigitalOrderNotificationStepInput = { @@ -1948,10 +1948,10 @@ export const fulfillWorkflowHighlights = [ import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import { sendDigitalOrderNotificationStep } from "./steps/send-digital-order-notification" type FulfillDigitalOrderWorkflowInput = { @@ -1991,7 +1991,7 @@ export const fulfillDigitalOrderWorkflow = createWorkflow( In the workflow, you: -1. Retrieve the digital product order's details using the `useRemoteQueryStep` imported from `@medusajs/core-flows`. +1. Retrieve the digital product order's details using the `useRemoteQueryStep` imported from `@medusajs/medusa/core-flows`. 2. Send a notification to the customer with the digital product download links using the `sendDigitalOrderNotificationStep`. ### Configure Notification Module Provider @@ -2008,11 +2008,11 @@ module.exports = defineConfig({ modules: { // ... [Modules.NOTIFICATION]: { - resolve: "@medusajs/notification", + resolve: "@medusajs/medusa/notification", options: { providers: [ { - resolve: "@medusajs/notification-local", + resolve: "@medusajs/medusa/notification-local", id: "local", options: { name: "Local Notification Provider", @@ -2094,7 +2094,7 @@ import { } from "@medusajs/medusa" import { Modules, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { DIGITAL_PRODUCT_MODULE, } from "../../../../../modules/digital-product" @@ -2160,7 +2160,7 @@ import { } from "@medusajs/medusa" import { ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" export const GET = async ( req: AuthenticatedMedusaRequest, @@ -2218,7 +2218,7 @@ import { Modules, ContainerRegistrationKeys, MedusaError, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" export const POST = async ( req: AuthenticatedMedusaRequest, @@ -2312,7 +2312,7 @@ In this section, you’ll customize the [Next.js Starter storefront](../../../.. In `src/types/global.ts`, add the following types that you’ll use in your customizations: ```ts title="src/types/global.ts" -import { BaseProductVariant } from "@medusajs/types/dist/http/product/common" +import { BaseProductVariant } from "@medusajs/framework/types/dist/http/product/common" // ... diff --git a/www/apps/resources/app/recipes/ecommerce/page.mdx b/www/apps/resources/app/recipes/ecommerce/page.mdx index 86e5fdb8df477..eaadb0653eab9 100644 --- a/www/apps/resources/app/recipes/ecommerce/page.mdx +++ b/www/apps/resources/app/recipes/ecommerce/page.mdx @@ -32,7 +32,7 @@ Medusa provides all essential commerce features out-of-the-box. Businesses can g Use the following command to install an ecommerce store with Medusa: ```bash -npx create-medusa-app@preview --with-nextjs-starter +npx create-medusa-app@rc --with-nextjs-starter ``` This installs: diff --git a/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx b/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx index 311add2a8e0ee..7c170cf9c1f2c 100644 --- a/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx +++ b/www/apps/resources/app/recipes/integrate-ecommerce-stack/page.mdx @@ -53,7 +53,7 @@ export const serviceHighlights = [ ```ts title="src/modules/erp/service.ts" highlights={serviceHighlights} import axios, { AxiosInstance } from "axios" - import { ProductDTO } from "@medusajs/types" + import { ProductDTO } from "@medusajs/framework/types" type ErpModuleOptions = { apiKey: string @@ -109,7 +109,7 @@ export const serviceHighlights = [ ```ts title="src/modules/erp/index.ts" import ErpModuleService from "./service" - import { Module } from "@medusajs/utils" + import { Module } from "@medusajs/framework/utils" export default Module("erp", { service: ErpModuleService, @@ -180,9 +180,9 @@ export const workflowHighlights = [ StepResponse, createWorkflow, WorkflowResponse, - } from "@medusajs/workflows-sdk" - import { IProductModuleService } from "@medusajs/types" - import { Modules } from "@medusajs/utils" + } from "@medusajs/framework/workflows-sdk" + import { IProductModuleService } from "@medusajs/framework/types" + import { Modules } from "@medusajs/framework/utils" import ErpModuleService from "../modules/erp/service" type WorkflowInput = { @@ -313,10 +313,10 @@ For example, suppose an administrator changes the product data in the ERP system import { IProductModuleService, UpdateProductDTO - } from "@medusajs/types" + } from "@medusajs/framework/types" import { Modules - } from "@medusajs/utils" + } from "@medusajs/framework/utils" type WebhookReq = { id: string diff --git a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx index 77ec3c2a96bc8..5ad8e5bd8bb84 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx @@ -74,7 +74,7 @@ Create the directory `src/modules/restaurant`. Create the file `src/modules/restaurant/models/restaurant.ts` with the following content: ```ts title="src/modules/restaurant/models/restaurant.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import { RestaurantAdmin } from "./restaurant-admin" export const Restaurant = model.define("restaurant", { @@ -100,7 +100,7 @@ It also has a relation to the `RestaurantAdmin` data model that you’ll define Create the file `src/modules/restaurant/models/restaurant-admin.ts` with the following content: ```ts title="src/modules/restaurant/models/restaurant-admin.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import { Restaurant } from "./restaurant" export const RestaurantAdmin = model.define("restaurant_admin", { @@ -124,7 +124,7 @@ This defines a `RestaurantAdmin` data model, which belongs to a restaurant. It r Next, create the main service of the module at `src/modules/restaurant/service.ts` with the following content: ```ts title="src/modules/restaurant/service.ts" -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import { Restaurant } from "./models/restaurant" import { RestaurantAdmin } from "./models/restaurant-admin" @@ -144,7 +144,7 @@ Then, create the file `src/modules/restaurant/index.ts` that holds the module de ```ts title="src/modules/restaurant/index.ts" import Service from "./service" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" export const RESTAURANT_MODULE = "restaurantModuleService" @@ -197,7 +197,7 @@ export enum DeliveryStatus { DELIVERED = "delivered", } -declare module "@medusajs/types" { +declare module "@medusajs/framework/types" { export interface ModuleImplementations { deliveryModuleService: DeliveryModuleService; } @@ -211,7 +211,7 @@ This adds an enum that is used by the data models. It also adds a type for `deli Create the file `src/modules/delivery/models/driver.ts` with the following content: ```ts title="src/modules/delivery/models/driver.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import { Delivery } from "./delivery" export const Driver = model.define("driver", { @@ -237,7 +237,7 @@ It has a relation to a `Delivery` data model that you’ll create next. Create the file `src/modules/delivery/models/delivery.ts` with the following content: ```ts title="src/modules/delivery/models/delivery.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import { DeliveryStatus } from "../types/common" import { Driver } from "./driver" @@ -268,7 +268,7 @@ It also has a relation to the `Driver` data model, indicating the driver handlin Then, create the main service of the Delivery Module at `src/modules/delivery/service.ts` with the following content: ```ts title="src/modules/delivery/service.ts" -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import { Delivery } from "./models/delivery" import { Driver } from "./models/driver" @@ -288,7 +288,7 @@ Next, create the file `src/modules/delivery/index.ts` holding the module’s def ```ts title="src/modules/delivery/index.ts" import Service from "./service" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" export const DELIVERY_MODULE = "deliveryModuleService" @@ -326,8 +326,8 @@ Create the file `src/links/restaurant-products.ts` with the following content: ```ts title="src/links/restaurant-products.ts" import RestaurantModule from "../modules/restaurant" -import ProductModule from "@medusajs/product" -import { defineLink } from "@medusajs/utils" +import ProductModule from "@medusajs/medusa/product" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( RestaurantModule.linkable.restaurant, @@ -349,7 +349,7 @@ Create the file `src/links/restaurant-delivery.ts` with the following content: ```ts title="src/links/restaurant-delivery.ts" import RestaurantModule from "../modules/restaurant" import DeliveryModule from "../modules/delivery" -import { defineLink } from "@medusajs/utils" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( RestaurantModule.linkable.restaurant, @@ -371,8 +371,8 @@ Create the file `src/links/delivery-cart.ts` with the following content: ```ts title="src/links/delivery-cart.ts" import DeliveryModule from "../modules/delivery" -import CartModule from "@medusajs/cart" -import { defineLink } from "@medusajs/utils" +import CartModule from "@medusajs/medusa/cart" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( DeliveryModule.linkable.delivery, @@ -388,8 +388,8 @@ Create the file `src/links/delivery-order.ts` with the following content: ```ts title="src/links/delivery-order.ts" import DeliveryModule from "../modules/delivery" -import OrderModule from "@medusajs/order" -import { defineLink } from "@medusajs/utils" +import OrderModule from "@medusajs/medusa/order" +import { defineLink } from "@medusajs/framework/utils" export default defineLink( DeliveryModule.linkable.delivery, @@ -435,7 +435,7 @@ Before implementing the functionalities, you’ll create type files in the Resta Create the file `src/modules/restaurant/types/index.ts` with the following content: ```ts title="src/modules/restaurant/types/index.ts" -import { InferTypeOf } from "@medusajs/types" +import { InferTypeOf } from "@medusajs/framework/types" import RestaurantModuleService from "../service" import { Restaurant } from "../models/restaurant" @@ -443,7 +443,7 @@ export type CreateRestaurant = Omit< InferTypeOf, "id" | "admins" > -declare module "@medusajs/types" { +declare module "@medusajs/framework/types" { export interface ModuleImplementations { restaurantModuleService: RestaurantModuleService; } @@ -454,7 +454,7 @@ This adds a type used for inputs in creating a restaurant. It also adds a type f -Since the `Restaurant` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/types` to infer its type. +Since the `Restaurant` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type. @@ -472,7 +472,7 @@ export const createRestaurantHighlight = [ ] ```ts title="src/workflows/restaurant/steps/create-restaurant.ts" highlights={createRestaurantHighlight} collapsibleLines="1-6" expandMoreLabel="Show Imports" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" import { CreateRestaurantDTO, } from "../../../modules/restaurant/types/mutations" @@ -507,7 +507,7 @@ Next, create the workflow at `src/workflows/restaurant/workflows/create-restaura import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createRestaurantStep } from "../steps/create-restaurant" import { CreateRestaurant } from "../../../modules/restaurant/types" @@ -554,7 +554,7 @@ export const createRestaurantRouteHighlights = [ ```ts title="src/api/restaurants/route.ts" highlights={createRestaurantRouteHighlights} collapsibleLines="1-10" expandMoreLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { CreateRestaurantDTO, } from "../../modules/restaurant/types/mutations" @@ -633,7 +633,7 @@ import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { ContainerRegistrationKeys, QueryContext, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" // ... @@ -708,13 +708,13 @@ Medusa provides an authentication flow that allows you to authenticate custom us Start by implementing the functionality to create a user in a workflow. The workflow has two steps: 1. Create the user in the database. -2. Set the actor type of the user’s authentication identity (created by the `/auth/{actor_type}/{provider}/register` API route). For this step, you’ll use the `setAuthAppMetadataStep` step imported from the `@medusajs/core-flows` package. +2. Set the actor type of the user’s authentication identity (created by the `/auth/{actor_type}/{provider}/register` API route). For this step, you’ll use the `setAuthAppMetadataStep` step imported from the `@medusajs/medusa/core-flows` package. To implement the first step, create the file `src/workflows/user/steps/create-user.ts` with the following content: ```ts title="src/workflows/user/steps/create-user.ts" collapsibleLines="1-9" expandButtonLabel="Show Imports" -import { MedusaError } from "@medusajs/utils" -import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { MedusaError } from "@medusajs/framework/utils" +import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk" import { CreateDriverInput, CreateRestaurantAdminInput, @@ -814,12 +814,12 @@ In the compensation function, if the `actor_type` is a restaurant, you delete th Next, create the workflow in the file `src/workflows/user/workflows/create-user.ts`: ```ts title="src/workflows/user/workflows/create-user.ts" collapsibleLines="1-12" expandButtonLabel="Show Imports" -import { setAuthAppMetadataStep } from "@medusajs/core-flows" +import { setAuthAppMetadataStep } from "@medusajs/medusa/core-flows" import { createWorkflow, transform, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { CreateDriverInput, CreateRestaurantAdminInput, @@ -878,7 +878,7 @@ In the workflow, you: 1. Use the `createUserStep` to create the user. 2. Use the `transform` utility function to create the input to be passed to the next step. -3. Use the `setAuthAppMetadataStep` imported from `@medusajs/core-flows` to update the authentication identity and associate it with the new user. +3. Use the `setAuthAppMetadataStep` imported from `@medusajs/medusa/core-flows` to update the authentication identity and associate it with the new user. 4. Return the created user. ### Create API Route @@ -1056,7 +1056,7 @@ First, create the step that deletes the restaurant admin at `restaurant-marketpl import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { RESTAURANT_MODULE } from "../../../modules/restaurant" import { DeleteRestaurantAdminWorkflow } from "../workflows/delete-restaurant-admin" @@ -1090,17 +1090,17 @@ In this step, you resolve the Restaurant Module's service and delete the admin. Then, create the workflow that deletes the restaurant admin at `restaurant-marketplace/src/workflows/restaurant/workflows/delete-restaurant-admin.ts`: ```ts title="restaurant-marketplace/src/workflows/restaurant/workflows/delete-restaurant-admin.ts" collapsibleLines="1-13" expandButtonLabel="Show Imports" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { WorkflowData, WorkflowResponse, createWorkflow, transform, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { setAuthAppMetadataStep, useRemoteQueryStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import { deleteRestaurantAdminStep } from "../steps/delete-restaurant-admin" export type DeleteRestaurantAdminWorkflow = { @@ -1165,7 +1165,7 @@ After deleting the restaurant admin, you: 1. Retrieve its auth identity using Query. To do that, you filter its `app_metadata` property by checking that its `restaurant_id` property's value is the admin's ID. For drivers, you replace `restaurant_id` with `driver_id`. 2. Check that the auth identity exists using the `transform` utility. Otherwise, throw an error. -3. Unset the association between the auth identity and the restaurant admin using the `setAuthAppMetadataStep` imported from `@medusajs/core-flows`. +3. Unset the association between the auth identity and the restaurant admin using the `setAuthAppMetadataStep` imported from `@medusajs/medusa/core-flows`. ### Create API Route @@ -1240,8 +1240,8 @@ In this step, you’ll create the API route that creates a product for a restaur You’ll start by creating a workflow that creates the restaurant’s products. It has two steps: -1. Create the product using Medusa’s `createProductsWorkflow` as a step. It’s imported from the `@medusajs/core-flows` package. -2. Create a link between the restaurant and the products using the `createRemoateLinkStep` imported from the `@medusajs/core-flows` package. +1. Create the product using Medusa’s `createProductsWorkflow` as a step. It’s imported from the `@medusajs/medusa/core-flows` package. +2. Create a link between the restaurant and the products using the `createRemoateLinkStep` imported from the `@medusajs/medusa/core-flows` package. So, create the workflow in the file `src/workflows/restaurant/workflows/create-restaurant-products.ts` with the following content: @@ -1255,14 +1255,14 @@ export const createProductHighlights = [ import { createProductsWorkflow, createRemoteLinkStep, -} from "@medusajs/core-flows" -import { CreateProductDTO } from "@medusajs/types" -import { Modules } from "@medusajs/utils" +} from "@medusajs/medusa/core-flows" +import { CreateProductDTO } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" import { WorkflowResponse, createWorkflow, transform, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { RESTAURANT_MODULE } from "../../../modules/restaurant" type WorkflowInput = { @@ -1392,7 +1392,7 @@ The workflow to create a delivery has three steps: 1. `validateRestaurantStep` that checks whether a restaurant with the specified ID exists. 2. `createDeliveryStep` that creates the delivery. -3. `createRemoteLinkStep` that creates links between the different data model records. This step is imported from `@medusajs/core-flows`. +3. `createRemoteLinkStep` that creates links between the different data model records. This step is imported from `@medusajs/medusa/core-flows`. ### Create validateRestaurantStep @@ -1401,7 +1401,7 @@ To create the first step, create the file `src/workflows/delivery/steps/validate ```ts title="src/workflows/delivery/steps/validate-restaurant.ts" import { createStep, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { RESTAURANT_MODULE } from "../../../modules/restaurant" type ValidateRestaurantStepInput = { @@ -1435,7 +1435,7 @@ export const createDeliveryStepHighlights = [ ] ```ts title="src/workflows/delivery/steps/create-delivery.ts" highlights={createDeliveryStepHighlights} -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" import { DELIVERY_MODULE } from "../../../modules/delivery" export const createDeliveryStep = createStep( @@ -1476,9 +1476,9 @@ import { WorkflowResponse, createWorkflow, transform, -} from "@medusajs/workflows-sdk" -import { Modules } from "@medusajs/utils" -import { createRemoteLinkStep } from "@medusajs/core-flows" +} from "@medusajs/framework/workflows-sdk" +import { Modules } from "@medusajs/framework/utils" +import { createRemoteLinkStep } from "@medusajs/medusa/core-flows" import { DELIVERY_MODULE } from "../../../modules/delivery" import { RESTAURANT_MODULE } from "../../../modules/restaurant" import { validateRestaurantStep } from "../steps/validate-restaurant" @@ -1589,7 +1589,7 @@ Steps that have a `*` next to their names are async steps. { type: "step", name: "createRemoteLinkStep", - description: "Creates the links returned by the previous step between the order and delivery. This is imported from `@medusajs/core-flows`.", + description: "Creates the links returned by the previous step between the order and delivery. This is imported from `@medusajs/medusa/core-flows`.", link: "/references/helper-steps/createRemoteLinkStep" }, { @@ -1638,7 +1638,7 @@ export const setTransactionIdStepHighlights = [ ] ```ts title="src/workflows/delivery/steps/set-transaction-id.ts" highlights={setTransactionIdStepHighlights} -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" import { DELIVERY_MODULE } from "../../../modules/delivery" export const setTransactionIdStep = createStep( @@ -1683,8 +1683,8 @@ export const notifyRestaurantStepHighlights = [ import { Modules, ContainerRegistrationKeys, -} from "@medusajs/utils" -import { createStep } from "@medusajs/workflows-sdk" +} from "@medusajs/framework/utils" +import { createStep } from "@medusajs/framework/workflows-sdk" export const notifyRestaurantStepId = "notify-restaurant-step" export const notifyRestaurantStep = createStep( @@ -1736,7 +1736,7 @@ A step is async if the `async` option is specified in the first object parameter Create the file `src/workflows/delivery/steps/await-driver-claim.ts` with the following content: ```ts title="src/workflows/delivery/steps/await-driver-claim.ts" -import { createStep } from "@medusajs/workflows-sdk" +import { createStep } from "@medusajs/framework/workflows-sdk" export const awaitDriverClaimStepId = "await-driver-claim-step" export const awaitDriverClaimStep = createStep( @@ -1764,12 +1764,12 @@ export const createOrderStepHighlights1 = [ ] ```ts title="src/workflows/delivery/steps/create-order.ts" highlights={createOrderStepHighlights1} collapsibleLines="1-9" expandButtonLabel="Show Imports" -import { CreateOrderShippingMethodDTO } from "@medusajs/types" +import { CreateOrderShippingMethodDTO } from "@medusajs/framework/types" import { Modules, ContainerRegistrationKeys, -} from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +} from "@medusajs/framework/utils" +import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" import { DELIVERY_MODULE } from "../../../modules/delivery" export const createOrderStep = createStep( @@ -1862,7 +1862,7 @@ You delete the order in the compensation function. Create the file `src/workflows/delivery/steps/await-start-preparation.ts` with the following content: ```ts title="src/workflows/delivery/steps/await-start-preparation.ts" -import { createStep } from "@medusajs/workflows-sdk" +import { createStep } from "@medusajs/framework/workflows-sdk" export const awaitStartPreparationStepId = "await-start-preparation-step" export const awaitStartPreparationStep = createStep( @@ -1881,7 +1881,7 @@ This step is async and its only purpose is to wait until it’s marked as succes Create the file `src/workflows/delivery/steps/await-preparation.ts` with the following content: ```ts title="src/workflows/delivery/steps/await-preparation.ts" -import { createStep } from "@medusajs/workflows-sdk" +import { createStep } from "@medusajs/framework/workflows-sdk" export const awaitPreparationStepId = "await-preparation-step" export const awaitPreparationStep = createStep( @@ -1905,9 +1905,9 @@ export const createFulfillmentStepHighlights = [ ] ```ts title="src/workflows/delivery/steps/create-fulfillment.ts" highlights={createFulfillmentStepHighlights} -import { OrderDTO } from "@medusajs/types" -import { Modules } from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +import { OrderDTO } from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" +import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" export const createFulfillmentStep = createStep( "create-fulfillment-step", @@ -1954,7 +1954,7 @@ In the compensation function, you cancel the fulfillment. Create the file `src/workflows/delivery/steps/await-pick-up.ts` with the following content: ```ts title="src/workflows/delivery/steps/await-pick-up.ts" -import { createStep } from "@medusajs/workflows-sdk" +import { createStep } from "@medusajs/framework/workflows-sdk" export const awaitPickUpStepId = "await-pick-up-step" export const awaitPickUpStep = createStep( @@ -1974,7 +1974,7 @@ This step is async and its only purpose is to wait until it’s marked as succes Create the file `src/workflows/delivery/steps/await-delivery.ts` with the following content: ```ts title="src/workflows/delivery/steps/await-delivery.ts" -import { createStep } from "@medusajs/workflows-sdk" +import { createStep } from "@medusajs/framework/workflows-sdk" export const awaitDeliveryStepId = "await-delivery-step" export const awaitDeliveryStep = createStep( @@ -2001,8 +2001,8 @@ export const handleDeliveryWorkflowHighlights = [ import { WorkflowResponse, createWorkflow, -} from "@medusajs/workflows-sdk" -import { createRemoteLinkStep } from "@medusajs/core-flows" +} from "@medusajs/framework/workflows-sdk" +import { createRemoteLinkStep } from "@medusajs/medusa/core-flows" import { setTransactionIdStep } from "../steps/set-transaction-id" import { notifyRestaurantStep } from "../steps/notify-restaurant" import { awaitDriverClaimStep } from "../steps/await-driver-claim" @@ -2081,7 +2081,7 @@ export const createDeliveryRouteHighlights = [ ```ts title="src/api/store/deliveries/route.ts" highlights={createDeliveryRouteHighlights} collapsibleLines="1-7" expandButtonLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import zod from "zod" import { DELIVERY_MODULE } from "../../../modules/delivery" import { createDeliveryWorkflow } from "../../../workflows/delivery/workflows/create-delivery" @@ -2261,7 +2261,7 @@ Before implementing the necessary functionalities, add the following types to `s ```ts title="src/modules/delivery/types/index.ts" // other imports... -import { InferTypeOf } from "@medusajs/types" +import { InferTypeOf } from "@medusajs/framework/types" import { Delivery } from "../models/delivery" // ... @@ -2277,7 +2277,7 @@ These types are useful in the upcoming implementation steps. -Since the `Delivery` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/types` to infer its type. +Since the `Delivery` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type. @@ -2300,7 +2300,7 @@ export const updateDeliveryStepHighlights = [ ] ```ts title="src/workflows/delivery/steps/update-delivery.ts" highlights={updateDeliveryStepHighlights} -import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk" import { DELIVERY_MODULE } from "../../../modules/delivery" import { UpdateDelivery } from "../../../modules/delivery/types" @@ -2343,8 +2343,8 @@ export const setStepSuccessStepHighlights = [ import { Modules, TransactionHandlerType, -} from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +} from "@medusajs/framework/utils" +import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" import { Delivery } from "../../../modules/delivery/types" import { handleDeliveryWorkflowId } from "../workflows/handle-delivery" @@ -2394,8 +2394,8 @@ export const setStepFailedStepHighlights = [ import { Modules, TransactionHandlerType, -} from "@medusajs/utils" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" +} from "@medusajs/framework/utils" +import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" import { Delivery } from "../../../modules/delivery/types" import { handleDeliveryWorkflowId } from "../../delivery/workflows/handle-delivery" @@ -2447,7 +2447,7 @@ import { createWorkflow, WorkflowResponse, when, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { setStepSuccessStep } from "../steps/set-step-success" import { setStepFailedStep } from "../steps/set-step-failed" import { updateDeliveryStep } from "../steps/update-delivery" @@ -2510,7 +2510,7 @@ export const acceptRouteHighlights = [ ```ts title="src/api/deliveries/[id]/accept/route.ts" highlights={acceptRouteHighlights} collapsibleLines="1-6" expandButtonLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { DeliveryStatus } from "../../../../modules/delivery/types" import { notifyRestaurantStepId } from "../../../../workflows/delivery/steps/notify-restaurant" import { updateDeliveryWorkflow } from "../../../../workflows/delivery/workflows/update-delivery" @@ -2577,7 +2577,7 @@ import { } from "@medusajs/medusa" import { ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { RESTAURANT_MODULE } from "../../modules/restaurant" export const isDeliveryRestaurant = async ( @@ -2709,7 +2709,7 @@ export const claimDeliveryWorkflowHighlights = [ import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { DeliveryStatus } from "../../../modules/delivery/types" import { awaitDriverClaimStepId } from "../steps/await-driver-claim" import { setStepSuccessStep } from "../steps/set-step-success" @@ -2844,7 +2844,7 @@ export const prepareRouteHighlights = [ ```ts title="src/api/deliveries/[id]/prepare/route.ts" highlights={prepareRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { DeliveryStatus } from "../../../../modules/delivery/types" import { updateDeliveryWorkflow, @@ -2934,7 +2934,7 @@ export const readyRouteHighlights = [ ```ts title="src/api/deliveries/[id]/ready/route.ts" highlights={readyRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { DeliveryStatus } from "../../../../modules/delivery/types" import { updateDeliveryWorkflow, @@ -3026,7 +3026,7 @@ export const pickUpRouteHighlights = [ ```ts title="src/api/deliveries/[id]/pick-up/route.ts" highlights={pickUpRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { DeliveryStatus } from "../../../../modules/delivery/types" import { updateDeliveryWorkflow, @@ -3166,7 +3166,7 @@ export const completeRouteHighlights = [ ```ts title="src/api/deliveries/[id]/complete/route.ts" highlights={completeRouteHighlights} collapsibleLines="1-10" expandButtonLabel="Show Imports" import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { DeliveryStatus } from "../../../../modules/delivery/types" import { updateDeliveryWorkflow, @@ -3261,7 +3261,7 @@ import { } from "@medusajs/medusa" import { Modules, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { handleDeliveryWorkflowId, } from "../../../../../workflows/delivery/workflows/handle-delivery" diff --git a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx index dc3c9752f4535..519334c72eba3 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx @@ -59,7 +59,7 @@ Create the directory `src/modules/marketplace`. Create the file `src/modules/marketplace/models/vendor.ts` with the following content: ```ts title="src/modules/marketplace/models/vendor.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import VendorAdmin from "./vendor-admin" const Vendor = model.define("vendor", { @@ -80,7 +80,7 @@ Notice that the `Vendor` has many admins whose data model you’ll create next. Create the file `src/modules/marketplace/models/vendor-admin.ts` with the following content: ```ts title="src/modules/marketplace/models/vendor-admin.ts" -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import Vendor from "./vendor" const VendorAdmin = model.define("vendor_admin", { @@ -103,7 +103,7 @@ This creates a `VendorAdmin` data model, which represents an admin of a vendor. Next, create the main service of the module at `src/modules/marketplace/service.ts` with the following content: ```ts title="src/modules/marketplace/service.ts" -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import Vendor from "./models/vendor" import VendorAdmin from "./models/vendor-admin" @@ -123,7 +123,7 @@ The service extends the [service factory](!docs!/advanced-development/modules/se After that, create the module definition at `src/modules/marketplace/index.ts` with the following content: ```ts title="src/modules/marketplace/index.ts" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" import MarketplaceModuleService from "./service" export const MARKETPLACE_MODULE = "marketplaceModuleService" @@ -168,9 +168,9 @@ If your use case requires linking the vendor to other data models, such as `Sale Create the file `src/links/vendor-product.ts` with the following content: ```ts title="src/links/vendor-product.ts" -import { defineLink } from "@medusajs/utils" +import { defineLink } from "@medusajs/framework/utils" import MarketplaceModule from "../modules/marketplace" -import ProductModule from "@medusajs/product" +import ProductModule from "@medusajs/medusa/product" export default defineLink( MarketplaceModule.linkable.vendor, @@ -186,9 +186,9 @@ This adds a list link between the `Vendor` and `Product` data models, indicating Then, create the file `src/links/vendor-order.ts` with the following content: ```ts title="src/links/vendor-order.ts" -import { defineLink } from "@medusajs/utils" +import { defineLink } from "@medusajs/framework/utils" import MarketplaceModule from "../modules/marketplace" -import OrderModule from "@medusajs/order" +import OrderModule from "@medusajs/medusa/order" export default defineLink( MarketplaceModule.linkable.vendor, @@ -244,7 +244,7 @@ export const createVendorAdminStepHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { CreateVendorAdminWorkflowInput } from ".." import MarketplaceModuleService from "../../../../modules/marketplace/service" import { MARKETPLACE_MODULE } from "../../../../modules/marketplace" @@ -286,17 +286,17 @@ Then, create the workflow at `src/workflows/marketplace/create-vendor-admin/inde export const vendorAdminWorkflowHighlights = [ ["23", "createVendorAdminStep", "Create the vendor admin."], - ["27", "setAuthAppMetadataStep", "Step is imported from `@medusajs/core-flows`."] + ["27", "setAuthAppMetadataStep", "Step is imported from `@medusajs/medusa/core-flows`."] ] ```ts title="src/workflows/marketplace/create-vendor-admin/index.ts" highlights={vendorAdminWorkflowHighlights} import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { setAuthAppMetadataStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import createVendorAdminStep from "./steps/create-vendor-admin" export type CreateVendorAdminWorkflowInput = { @@ -332,7 +332,7 @@ export default createVendorAdminWorkflow In this workflow, you run the following steps: 1. `createVendorAdminStep` to create the vendor admin. -2. `setAuthAppMetadataStep` to create the `vendor` actor type. This step is provided by Medusa in the `@medusajs/core-flows` package. +2. `setAuthAppMetadataStep` to create the `vendor` actor type. This step is provided by Medusa in the `@medusajs/medusa/core-flows` package. You return the created vendor admin. @@ -360,7 +360,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { MedusaError } from "@medusajs/utils" +import { MedusaError } from "@medusajs/framework/utils" import { z } from "zod" import MarketplaceModuleService from "../../modules/marketplace/service" import createVendorAdminWorkflow from "../../workflows/marketplace/create-vendor-admin" @@ -570,7 +570,7 @@ export const retrieveProductHighlights = [ import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/medusa" import { ContainerRegistrationKeys, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import MarketplaceModuleService from "../../../modules/marketplace/service" import { MARKETPLACE_MODULE } from "../../../modules/marketplace" @@ -614,16 +614,16 @@ export const createProducts1Highlights = [ ```ts title="src/api/vendors/products/route.ts" highlights={createProducts1Highlights} // other imports... -import { createProductsWorkflow } from "@medusajs/core-flows" +import { createProductsWorkflow } from "@medusajs/medusa/core-flows" import { CreateProductWorkflowInputDTO, IProductModuleService, ISalesChannelModuleService, -} from "@medusajs/types" +} from "@medusajs/framework/types" import { Modules, Modules, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" // GET method... @@ -795,11 +795,11 @@ graph TD createVendorOrdersStep --> createRemoteLinkStep["Create Links (createRemoteLinkStep from Medusa)"] ``` -1. Retrieve the cart using its ID. Medusa provides a `useRemoteQueryStep` in the `@medusajs/core-flows` package that you can use. -2. Create a parent order for the cart and its items. Medusa also has a `completeCartWorkflow` in the `@medusajs/core-flows` package that you can use as a step. +1. Retrieve the cart using its ID. Medusa provides a `useRemoteQueryStep` in the `@medusajs/medusa/core-flows` package that you can use. +2. Create a parent order for the cart and its items. Medusa also has a `completeCartWorkflow` in the `@medusajs/medusa/core-flows` package that you can use as a step. 3. Group the cart items by their product’s associated vendor. 4. For each vendor, create a child order with the cart items of their products, and return the orders with the links to be created. -5. Create the links created by the previous step. Medusa provides a `createRemoteLinkStep` in the `@medusajs/core-flows` package that you can use. +5. Create the links created by the previous step. Medusa provides a `createRemoteLinkStep` in the `@medusajs/medusa/core-flows` package that you can use. You'll implement the third and fourth steps. @@ -811,9 +811,9 @@ Create the third step in the file `src/workflows/marketplace/create-vendor-order import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" -import { CartDTO, CartLineItemDTO } from "@medusajs/types" -import { ContainerRegistrationKeys } from "@medusajs/utils" +} from "@medusajs/framework/workflows-sdk" +import { CartDTO, CartLineItemDTO } from "@medusajs/framework/types" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" type StepInput = { cart: CartDTO @@ -870,18 +870,18 @@ export const vendorOrder1Highlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { CartLineItemDTO, OrderDTO, LinkDefinition, InferTypeOf, -} from "@medusajs/types" -import { Modules } from "@medusajs/utils" +} from "@medusajs/framework/types" +import { Modules } from "@medusajs/framework/utils" import { createOrdersWorkflow, cancelOrderWorkflow, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import MarketplaceModuleService from "../../../../modules/marketplace/service" import { MARKETPLACE_MODULE } from "../../../../modules/marketplace" import Vendor from "../../../../modules/marketplace/models/vendor" @@ -1036,7 +1036,7 @@ try { In this snippet, you create multiple child orders for each vendor and link the orders to the vendors. -If an error occurs, the created orders in the `createdOrders` array are canceled using Medusa's `cancelOrderWorkflow` from the `@medusajs/core-flows` package. +If an error occurs, the created orders in the `createdOrders` array are canceled using Medusa's `cancelOrderWorkflow` from the `@medusajs/medusa/core-flows` package. The order's data is formatted using the `prepareOrderData` function. Replace its definition with the following: @@ -1112,7 +1112,7 @@ await Promise.all(created_orders.map((createdOrder) => { })) ``` -The compensation function cancels all child orders received from the step. It uses the `cancelOrderWorkflow` that Medusa provides in the `@medusajs/core-flows` package. +The compensation function cancels all child orders received from the step. It uses the `cancelOrderWorkflow` that Medusa provides in the `@medusajs/medusa/core-flows` package. ### Create Workflow @@ -1130,13 +1130,13 @@ export const createVendorOrdersWorkflowHighlights = [ import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep, createRemoteLinkStep, completeCartWorkflow, -} from "@medusajs/core-flows" -import { CartDTO } from "@medusajs/types" +} from "@medusajs/medusa/core-flows" +import { CartDTO } from "@medusajs/framework/types" import groupVendorItemsStep from "./steps/group-vendor-items" import createVendorOrdersStep from "./steps/create-vendor-orders" @@ -1250,8 +1250,8 @@ export const getOrderHighlights = [ ```ts title="src/api/vendors/orders/route.ts" highlights={getOrderHighlights} collapsibleLines="1-6" expandMoreLabel="Show Imports" import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/medusa" -import { ContainerRegistrationKeys } from "@medusajs/utils" -import { getOrdersListWorkflow } from "@medusajs/core-flows" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" +import { getOrdersListWorkflow } from "@medusajs/medusa/core-flows" import MarketplaceModuleService from "../../../modules/marketplace/service" import { MARKETPLACE_MODULE } from "../../../modules/marketplace" diff --git a/www/apps/resources/app/recipes/pos/page.mdx b/www/apps/resources/app/recipes/pos/page.mdx index 60e462be9a0dc..691d3790ea02f 100644 --- a/www/apps/resources/app/recipes/pos/page.mdx +++ b/www/apps/resources/app/recipes/pos/page.mdx @@ -77,9 +77,9 @@ Here’s an example of creating a custom API Route at `/store/pos/search-barcode MedusaRequest, MedusaResponse, } from "@medusajs/medusa" - import { MedusaError } from "@medusajs/utils" - import { Modules } from "@medusajs/utils" - import { IProductModuleService } from "@medusajs/types" + import { MedusaError } from "@medusajs/framework/utils" + import { Modules } from "@medusajs/framework/utils" + import { IProductModuleService } from "@medusajs/framework/types" export const GET = async (req: MedusaRequest, res: MedusaResponse) => { const barcode = (req.query.barcode as string) || "" diff --git a/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx b/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx index 34209e537a180..6d1feaeeb0b67 100644 --- a/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx @@ -71,7 +71,7 @@ export const subscriptionHighlights = [ ] ```ts title="src/modules/subscription/models/subscription.ts" highlights={subscriptionHighlights} -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" import { SubscriptionInterval, SubscriptionStatus } from "../types" const Subscription = model.define("subscription", { @@ -121,7 +121,7 @@ export enum SubscriptionInterval { Create the module’s main service in the file `src/modules/subscription/service.ts` with the following content: ```ts title="src/modules/subscription/service.ts" -import { MedusaService } from "@medusajs/utils" +import { MedusaService } from "@medusajs/framework/utils" import Subscription from "./models/subscription" class SubscriptionModuleService extends MedusaService({ @@ -139,7 +139,7 @@ The main service extends the service factory to provide data-management features Create the file `src/modules/subscription/index.ts` that holds the module’s definition: ```ts title="src/modules/subscription/index.ts" -import { Module } from "@medusajs/utils" +import { Module } from "@medusajs/framework/utils" import SubscriptionModuleService from "./service" export const SUBSCRIPTION_MODULE = "subscriptionModuleService" @@ -183,9 +183,9 @@ In this step, you’ll define links between the Subscription Module’s `Subscri To link a subscription to the cart used to make the purchase, create the file `src/links/subscription-cart.ts` with the following content: ```ts title="src/links/subscription-cart.ts" -import { defineLink } from "@medusajs/utils" +import { defineLink } from "@medusajs/framework/utils" import SubscriptionModule from "../modules/subscription" -import CartModule from "@medusajs/cart" +import CartModule from "@medusajs/medusa/cart" export default defineLink( SubscriptionModule.linkable.subscription, @@ -206,9 +206,9 @@ When you create a new order for the subscription, you’ll retrieve the linked c To link a subscription to the customer who purchased it, create the file `src/links/subscription-customer.ts` with the following content: ```ts title="src/links/subscription-customer.ts" -import { defineLink } from "@medusajs/utils" +import { defineLink } from "@medusajs/framework/utils" import SubscriptionModule from "../modules/subscription" -import CustomerModule from "@medusajs/customer" +import CustomerModule from "@medusajs/medusa/customer" export default defineLink( { @@ -226,9 +226,9 @@ This defines a list link to the `Subscription` data model, since a customer may To link a subscription to the orders created for it, create the file `src/links/subscription-order.ts` with the following content: ```ts title="src/links/subscription-order.ts" -import { defineLink } from "@medusajs/utils" +import { defineLink } from "@medusajs/framework/utils" import SubscriptionModule from "../modules/subscription" -import OrderModule from "@medusajs/order" +import OrderModule from "@medusajs/medusa/order" export default defineLink( SubscriptionModule.linkable.subscription, @@ -363,7 +363,7 @@ The `getExpirationDate` method accepts a subscription’s date, interval, and pe Before overriding the `createSubscriptions` method, add the following types to `src/modules/subscription/types/index.ts`: ```ts title="src/modules/subscription/types/index.ts" -import { InferTypeOf } from "@medusajs/types" +import { InferTypeOf } from "@medusajs/framework/types" import Subscription from "../models/subscription" // ... @@ -381,7 +381,7 @@ export type SubscriptionData = InferTypeOf -Since the `Subscription` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/types` to infer its type. +Since the `Subscription` data model is a variable, use the `InferTypeOf` utility imported from `@medusajs/framework/types` to infer its type. @@ -444,7 +444,7 @@ The workflow accepts a cart’s ID, and it has three steps: 2. Create a subscription. 3. Link the subscription to the order, cart, and customer. -Medusa provides the first and last steps in the `@medusajs/core-flows` package, so you only need to implement the second step. +Medusa provides the first and last steps in the `@medusajs/medusa/core-flows` package, so you only need to implement the second step. ### Create a Subscription Step (Second Step) @@ -458,9 +458,9 @@ export const createSubscriptionsHighlights = [ ] ```ts title="src/workflows/create-subscription/steps/create-subscription.ts" highlights={createSubscriptionsHighlights} collapsibleLines="1-7" expandMoreLabel="Show Imports" -import { createStep, StepResponse } from "@medusajs/workflows-sdk" -import { Modules } from "@medusajs/utils" -import { LinkDefinition } from "@medusajs/types" +import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk" +import { Modules } from "@medusajs/framework/utils" +import { LinkDefinition } from "@medusajs/framework/types" import { SubscriptionInterval } from "../../../modules/subscription/types" import SubscriptionModuleService from "../../../modules/subscription/service" import { SUBSCRIPTION_MODULE } from "../../../modules/subscription" @@ -584,11 +584,11 @@ export const createSubscriptionWorkflowHighlights = [ import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createRemoteLinkStep, completeCartWorkflow, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import { SubscriptionInterval, } from "../../modules/subscription/types" @@ -632,9 +632,9 @@ export default createSubscriptionWorkflow This workflow accepts the cart’s ID, along with the subscription details. It executes the following steps: -1. `completeCartWorkflow` from `@medusajs/core-flows` that completes a cart and creates an order. +1. `completeCartWorkflow` from `@medusajs/medusa/core-flows` that completes a cart and creates an order. 2. `createSubscriptionStep`, which is the step you created previously. -3. `createRemoteLinkStep` from `@medusajs/core-flows`, which accepts links to create. These links are in the `linkDefs` array returned by the previous step. +3. `createRemoteLinkStep` from `@medusajs/medusa/core-flows`, which accepts links to create. These links are in the `linkDefs` array returned by the previous step. The workflow returns the created subscription and order. @@ -666,7 +666,7 @@ import { import { ContainerRegistrationKeys, MedusaError, -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import createSubscriptionWorkflow from "../../../../../workflows/create-subscription" export const POST = async ( @@ -728,7 +728,7 @@ After installation, create the file `src/modules/checkout/components/subscriptio ```tsx title="src/modules/checkout/components/subscriptions/index.tsx" badgeLabel="Storefront" badgeColor="orange" collapsibleLines="1-13" expandMoreLabel="Show Imports" "use client" -import { StoreCart } from "@medusajs/types" +import { StoreCart } from "@medusajs/framework/types" import { Button, clx, Heading, Text } from "@medusajs/ui" import { CheckCircleSolid } from "@medusajs/icons" import { usePathname, useRouter, useSearchParams } from "next/navigation" @@ -978,7 +978,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" export const GET = async ( req: AuthenticatedMedusaRequest, @@ -1039,7 +1039,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" export const GET = async ( req: AuthenticatedMedusaRequest, @@ -1089,7 +1089,7 @@ Before creating the UI routes, create the file `src/admin/types/index.ts` that h import { OrderDTO, CustomerDTO, -} from "@medusajs/types" +} from "@medusajs/framework/types" export enum SubscriptionStatus { ACTIVE = "active", @@ -1452,13 +1452,13 @@ graph TD capturePaymentStep["capturePaymentStep (Medusa)"] --> updateSubscriptionStep ``` -1. Retrieve the subscription’s linked cart. Medusa provides a `useRemoteQueryStep` in the `@medusajs/core-flows` package that can be used as a step. -2. Create a payment collection for the new order. Medusa provides a `createPaymentCollectionsStep` in the `@medusajs/core-flows` package that you can use. -3. Create payment sessions in the payment collection. Medusa provides a `createPaymentSessionsWorkflow` in the `@medusajs/core-flows` package that can be used as a step. -4. Authorize the payment session. Medusa also provides the `authorizePaymentSessionStep` in the `@medusajs/core-flows` package, which can be used. +1. Retrieve the subscription’s linked cart. Medusa provides a `useRemoteQueryStep` in the `@medusajs/medusa/core-flows` package that can be used as a step. +2. Create a payment collection for the new order. Medusa provides a `createPaymentCollectionsStep` in the `@medusajs/medusa/core-flows` package that you can use. +3. Create payment sessions in the payment collection. Medusa provides a `createPaymentSessionsWorkflow` in the `@medusajs/medusa/core-flows` package that can be used as a step. +4. Authorize the payment session. Medusa also provides the `authorizePaymentSessionStep` in the `@medusajs/medusa/core-flows` package, which can be used. 5. Create the subscription’s new order. -6. Create links between the subscription and the order using the `createRemoteLinkStep` provided in the `@medusajs/core-flows` package. -7. Capture the order’s payment using the `capturePaymentStep` provided by Medusa in the `@medusajs/core-flows` package. +6. Create links between the subscription and the order using the `createRemoteLinkStep` provided in the `@medusajs/medusa/core-flows` package. +7. Capture the order’s payment using the `capturePaymentStep` provided by Medusa in the `@medusajs/medusa/core-flows` package. 8. Update the subscription’s `last_order_date` and `next_order_date` properties. You’ll only implement the fifth and eighth steps. @@ -1481,17 +1481,17 @@ export const createSubscriptionOrderStep1Highlights = [ ] ```ts title="src/workflows/create-subscription-order/steps/create-subscription-order.ts" highlights={createSubscriptionOrderStep1Highlights} collapsibleLines="1-15" expandMoreLabel="Show Imports" -import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk" import { CartWorkflowDTO, PaymentCollectionDTO, IOrderModuleService, LinkDefinition, -} from "@medusajs/types" +} from "@medusajs/framework/types" import { Modules, -} from "@medusajs/utils" -import { createOrdersWorkflow } from "@medusajs/core-flows" +} from "@medusajs/framework/utils" +import { createOrdersWorkflow } from "@medusajs/medusa/core-flows" import { SubscriptionData } from "../../../modules/subscription/types" import { SUBSCRIPTION_MODULE } from "../../../modules/subscription" @@ -1536,7 +1536,7 @@ const createSubscriptionOrderStep = createStep( export default createSubscriptionOrderStep ``` -This creates a `createSubscriptionOrderStep` that uses the `createOrdersWorkflow`, which Medusa provides in the `@medusajs/core-flows` package. The step returns the created order and an array of links to be created. +This creates a `createSubscriptionOrderStep` that uses the `createOrdersWorkflow`, which Medusa provides in the `@medusajs/medusa/core-flows` package. The step returns the created order and an array of links to be created. In this step, you use a `getOrderData` function to format the order’s input data. @@ -1666,7 +1666,7 @@ export const updateSubscriptionStepHighlights = [ import { createStep, StepResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { SUBSCRIPTION_MODULE, } from "../../../modules/subscription" @@ -1750,25 +1750,25 @@ export const createSubscriptionOrderWorkflowHighlights = [ import { createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep, createPaymentSessionsWorkflow, createRemoteLinkStep, capturePaymentStep, -} from "@medusajs/core-flows" +} from "@medusajs/medusa/core-flows" import { CartWorkflowDTO, -} from "@medusajs/types" +} from "@medusajs/framework/types" import { SubscriptionData, } from "../../modules/subscription/types" import { authorizePaymentSessionStep, -} from "@medusajs/core-flows/dist/payment/steps/authorize-payment-session" +} from "@medusajs/medusa/core-flows/dist/payment/steps/authorize-payment-session" import { createPaymentCollectionsStep, -} from "@medusajs/core-flows/dist/definition/cart/steps/create-payment-collection" +} from "@medusajs/medusa/core-flows/dist/cart/steps/create-payment-collection" import createSubscriptionOrderStep from "./steps/create-subscription-order" import updateSubscriptionStep from "./steps/update-subscription" @@ -1889,7 +1889,7 @@ export const createSubscriptionOrdersJob1Highlights = [ ] ```ts title="src/jobs/create-subscription-orders.ts" highlights={createSubscriptionOrdersJob1Highlights} collapsibleLines="1-7" expandMoreLabel="Show Imports" -import { MedusaContainer } from "@medusajs/types" +import { MedusaContainer } from "@medusajs/framework/types" import SubscriptionModuleService from "../modules/subscription/service" import { SUBSCRIPTION_MODULE } from "../modules/subscription" import moment from "moment" @@ -2033,7 +2033,7 @@ export const expireSubscriptionOrdersJobHighlights = [ ] ```ts title="src/jobs/expire-subscription-orders.ts" highlights={expireSubscriptionOrdersJobHighlights} collapsibleLines="1-6" expandMoreLabel="Show Imports" -import { MedusaContainer } from "@medusajs/types" +import { MedusaContainer } from "@medusajs/framework/types" import SubscriptionModuleService from "../modules/subscription/service" import { SUBSCRIPTION_MODULE } from "../modules/subscription" import moment from "moment" @@ -2120,7 +2120,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/medusa" -import { ContainerRegistrationKeys } from "@medusajs/utils" +import { ContainerRegistrationKeys } from "@medusajs/framework/utils" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/www/apps/resources/app/storefront-development/tips/page.mdx b/www/apps/resources/app/storefront-development/tips/page.mdx index b7342cdea8321..9a7f78a488547 100644 --- a/www/apps/resources/app/storefront-development/tips/page.mdx +++ b/www/apps/resources/app/storefront-development/tips/page.mdx @@ -29,7 +29,7 @@ The `@medusajs/types` package provide API routes' request and response types. If you're not using the JS Client or Medusa React, install `@medusajs/types` to use the correct request and response types: ```bash npm2yarn -npm install @medusajs/types@preview +npm install @medusajs/types@rc ``` --- diff --git a/www/apps/resources/app/troubleshooting/_sections/common-installation-errors/outdated-preview.mdx b/www/apps/resources/app/troubleshooting/_sections/common-installation-errors/outdated-preview.mdx index fd6034e7f093e..e78821b2c45a0 100644 --- a/www/apps/resources/app/troubleshooting/_sections/common-installation-errors/outdated-preview.mdx +++ b/www/apps/resources/app/troubleshooting/_sections/common-installation-errors/outdated-preview.mdx @@ -1,9 +1,9 @@ -If you've installed a preview version of a package, such as `@medusajs/file-s3`, make sure its version in `package.json` is set to `preview`: +If you've installed an `rc` version of a package, such as `@medusajs/medusa/file-s3`, make sure its version in `package.json` is set to `rc`: ```json title="package.json" "dependencies": { // ... - "@medusajs/file-s3": "preview" + "@medusajs/medusa/file-s3": "rc" } ``` diff --git a/www/apps/resources/app/troubleshooting/page.mdx b/www/apps/resources/app/troubleshooting/page.mdx index 51500ec43c575..6f94588722364 100644 --- a/www/apps/resources/app/troubleshooting/page.mdx +++ b/www/apps/resources/app/troubleshooting/page.mdx @@ -8,7 +8,7 @@ export const metadata = { ## Update Medusa Version -While Medusa v2 is still in active development, a version is released every three hours under the `preview` tag. +While Medusa v2 is still in active development, a version is released every three hours under the `rc` tag. If you run into issues during your development, try first to remove the `node_modules` directory and `yarn.lock` file (or `package-lock.json`) and re-install the dependencies: @@ -18,7 +18,7 @@ rm yarn.lock # or package-lock.json yarn install # or npm install ``` -This updates the Medusa v2 dependencies to the latest `preview` version, which may have resolved your issue. +This updates the Medusa v2 dependencies to the latest `rc` version, which may have resolved your issue. If your issue still persists, check out the troubleshooting guides below or [create a GitHub issue](https://github.com/medusajs/medusa/issues/new?assignees=&labels=status:+needs+triaging,+version:+2.0&projects=&template=bug_report_v2.md&title=). diff --git a/www/apps/resources/generated/edit-dates.mjs b/www/apps/resources/generated/edit-dates.mjs index 70f44b00f3f4d..e09760ac62e3e 100644 --- a/www/apps/resources/generated/edit-dates.mjs +++ b/www/apps/resources/generated/edit-dates.mjs @@ -1,158 +1,158 @@ export const generatedEditDates = { - "app/commerce-modules/auth/auth-providers/emailpass/page.mdx": "2024-09-05T12:08:19.945Z", + "app/commerce-modules/auth/auth-providers/emailpass/page.mdx": "2024-09-30T08:43:53.153Z", "app/commerce-modules/auth/auth-providers/page.mdx": "2024-09-05T12:15:19.491Z", "app/commerce-modules/auth/authentication-route/page.mdx": "2024-09-05T12:06:38.155Z", - "app/commerce-modules/auth/examples/page.mdx": "2024-09-05T08:09:32.466Z", - "app/commerce-modules/auth/module-options/page.mdx": "2024-07-04T17:26:03+03:00", - "app/commerce-modules/auth/page.mdx": "2024-09-05T14:59:56.146Z", + "app/commerce-modules/auth/examples/page.mdx": "2024-09-30T08:43:53.154Z", + "app/commerce-modules/auth/module-options/page.mdx": "2024-09-30T08:43:53.156Z", + "app/commerce-modules/auth/page.mdx": "2024-09-30T08:43:53.156Z", "app/commerce-modules/cart/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/cart/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/cart/concepts/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/cart/examples/page.mdx": "2024-07-04T17:26:03+03:00", - "app/commerce-modules/cart/promotions/page.mdx": "2024-06-26T07:55:59+00:00", + "app/commerce-modules/cart/examples/page.mdx": "2024-09-30T08:43:53.157Z", + "app/commerce-modules/cart/promotions/page.mdx": "2024-09-30T08:43:53.158Z", "app/commerce-modules/cart/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/cart/tax-lines/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/cart/page.mdx": "2024-09-05T15:00:13.786Z", + "app/commerce-modules/cart/page.mdx": "2024-09-30T08:43:53.157Z", "app/commerce-modules/currency/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/currency/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/currency/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/currency/examples/page.mdx": "2024-09-30T08:43:53.158Z", "app/commerce-modules/currency/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/currency/page.mdx": "2024-09-05T15:00:24.903Z", + "app/commerce-modules/currency/page.mdx": "2024-09-30T08:43:53.159Z", "app/commerce-modules/customer/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/customer/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/customer/customer-accounts/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/customer/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/customer/examples/page.mdx": "2024-09-30T08:43:53.159Z", "app/commerce-modules/customer/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/customer/page.mdx": "2024-09-05T15:00:39.831Z", + "app/commerce-modules/customer/page.mdx": "2024-09-30T08:43:53.160Z", "app/commerce-modules/fulfillment/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/fulfillment/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/fulfillment/concepts/page.mdx": "2024-06-19T13:02:16+00:00", "app/commerce-modules/fulfillment/fulfillment-provider/page.mdx": "2024-07-01T10:21:19+03:00", "app/commerce-modules/fulfillment/item-fulfillment/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/fulfillment/module-options/page.mdx": "2024-07-22T07:17:15+00:00", + "app/commerce-modules/fulfillment/module-options/page.mdx": "2024-09-30T08:43:53.160Z", "app/commerce-modules/fulfillment/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/fulfillment/shipping-option/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/fulfillment/page.mdx": "2024-09-05T15:00:57.269Z", + "app/commerce-modules/fulfillment/page.mdx": "2024-09-30T08:43:53.160Z", "app/commerce-modules/inventory/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/inventory/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/inventory/concepts/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/inventory/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/inventory/examples/page.mdx": "2024-09-30T08:43:53.161Z", "app/commerce-modules/inventory/inventory-in-flows/page.mdx": "2024-06-26T07:55:59+00:00", "app/commerce-modules/inventory/relations-to-other-modules/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/inventory/page.mdx": "2024-09-05T15:01:10.522Z", + "app/commerce-modules/inventory/page.mdx": "2024-09-30T08:43:53.161Z", "app/commerce-modules/order/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/order/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/order/claim/page.mdx": "2024-07-09T18:14:30+03:00", "app/commerce-modules/order/concepts/page.mdx": "2024-07-09T18:14:30+03:00", "app/commerce-modules/order/exchange/page.mdx": "2024-07-09T18:14:30+03:00", "app/commerce-modules/order/order-versioning/page.mdx": "2024-07-09T18:14:30+03:00", - "app/commerce-modules/order/promotion-adjustments/page.mdx": "2024-07-15T17:46:10+02:00", + "app/commerce-modules/order/promotion-adjustments/page.mdx": "2024-09-30T08:43:53.161Z", "app/commerce-modules/order/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/order/return/page.mdx": "2024-07-09T18:14:30+03:00", "app/commerce-modules/order/tax-lines/page.mdx": "2024-07-09T18:14:30+03:00", "app/commerce-modules/order/transactions/page.mdx": "2024-07-09T18:14:30+03:00", - "app/commerce-modules/order/page.mdx": "2024-09-05T15:01:23.809Z", + "app/commerce-modules/order/page.mdx": "2024-09-30T08:43:53.161Z", "app/commerce-modules/payment/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/payment/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/payment/examples/page.mdx": "2024-07-04T17:26:03+03:00", - "app/commerce-modules/payment/module-options/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/payment/examples/page.mdx": "2024-09-30T08:43:53.162Z", + "app/commerce-modules/payment/module-options/page.mdx": "2024-09-30T08:43:53.162Z", "app/commerce-modules/payment/payment/page.mdx": "2024-06-26T07:55:59+00:00", "app/commerce-modules/payment/payment-collection/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/payment/payment-flow/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/payment/payment-provider/stripe/page.mdx": "2024-07-18T13:04:29+02:00", - "app/commerce-modules/payment/payment-provider/page.mdx": "2024-07-01T10:21:19+03:00", + "app/commerce-modules/payment/payment-provider/stripe/page.mdx": "2024-09-30T08:43:53.163Z", + "app/commerce-modules/payment/payment-provider/page.mdx": "2024-09-30T08:43:53.163Z", "app/commerce-modules/payment/payment-session/page.mdx": "2024-06-26T07:55:59+00:00", "app/commerce-modules/payment/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/payment/webhook-events/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/payment/page.mdx": "2024-09-05T15:01:36.073Z", + "app/commerce-modules/payment/page.mdx": "2024-09-30T08:43:53.162Z", "app/commerce-modules/pricing/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/pricing/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/pricing/concepts/page.mdx": "2024-07-01T16:34:13+00:00", - "app/commerce-modules/pricing/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/pricing/examples/page.mdx": "2024-09-30T08:43:53.164Z", "app/commerce-modules/pricing/price-calculation/page.mdx": "2024-07-26T10:09:41+03:00", "app/commerce-modules/pricing/price-rules/page.mdx": "2024-07-01T16:34:13+00:00", "app/commerce-modules/pricing/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/pricing/tax-inclusive-pricing/page.mdx": "2024-07-18T19:03:37+02:00", - "app/commerce-modules/pricing/page.mdx": "2024-09-05T15:01:47.750Z", + "app/commerce-modules/pricing/page.mdx": "2024-09-30T08:43:53.164Z", "app/commerce-modules/product/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/product/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/product/examples/page.mdx": "2024-07-04T17:26:03+03:00", - "app/commerce-modules/product/guides/price/page.mdx": "2024-07-31T17:01:33+03:00", - "app/commerce-modules/product/guides/price-with-taxes/page.mdx": "2024-08-01T15:32:54+00:00", + "app/commerce-modules/product/examples/page.mdx": "2024-09-30T08:43:53.164Z", + "app/commerce-modules/product/guides/price/page.mdx": "2024-09-30T08:43:53.165Z", + "app/commerce-modules/product/guides/price-with-taxes/page.mdx": "2024-09-30T08:43:53.165Z", "app/commerce-modules/product/relations-to-other-modules/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/product/page.mdx": "2024-09-05T15:02:02.758Z", + "app/commerce-modules/product/page.mdx": "2024-09-30T08:43:53.165Z", "app/commerce-modules/promotion/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/promotion/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/promotion/actions/page.mdx": "2024-06-26T07:55:59+00:00", "app/commerce-modules/promotion/application-method/page.mdx": "2024-06-26T07:55:59+00:00", "app/commerce-modules/promotion/campaign/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/promotion/concepts/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/promotion/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/promotion/examples/page.mdx": "2024-09-30T08:43:53.166Z", "app/commerce-modules/promotion/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/promotion/page.mdx": "2024-09-05T15:02:15.009Z", + "app/commerce-modules/promotion/page.mdx": "2024-09-30T08:43:53.166Z", "app/commerce-modules/region/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/region/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/region/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/region/examples/page.mdx": "2024-09-30T08:43:53.166Z", "app/commerce-modules/region/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/region/page.mdx": "2024-09-05T15:02:29.153Z", + "app/commerce-modules/region/page.mdx": "2024-09-30T08:43:53.167Z", "app/commerce-modules/sales-channel/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/sales-channel/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/sales-channel/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/sales-channel/examples/page.mdx": "2024-09-30T08:43:53.167Z", "app/commerce-modules/sales-channel/publishable-api-keys/page.mdx": "2024-05-29T11:08:06+00:00", "app/commerce-modules/sales-channel/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/sales-channel/page.mdx": "2024-09-05T15:02:40.658Z", + "app/commerce-modules/sales-channel/page.mdx": "2024-09-30T08:43:53.167Z", "app/commerce-modules/stock-location/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/stock-location/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/stock-location/concepts/page.mdx": "2024-05-03T17:36:38+03:00", - "app/commerce-modules/stock-location/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/stock-location/examples/page.mdx": "2024-09-30T08:43:53.168Z", "app/commerce-modules/stock-location/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/stock-location/page.mdx": "2024-09-05T15:02:53.237Z", + "app/commerce-modules/stock-location/page.mdx": "2024-09-30T08:43:53.168Z", "app/commerce-modules/store/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/store/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/store/examples/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/store/examples/page.mdx": "2024-09-30T08:43:53.168Z", "app/commerce-modules/store/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/store/page.mdx": "2024-09-05T15:03:06.211Z", + "app/commerce-modules/store/page.mdx": "2024-09-30T08:43:53.169Z", "app/commerce-modules/tax/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/tax/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/tax/examples/page.mdx": "2024-07-04T17:26:03+03:00", - "app/commerce-modules/tax/module-options/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/tax/examples/page.mdx": "2024-09-30T08:43:53.169Z", + "app/commerce-modules/tax/module-options/page.mdx": "2024-09-30T08:43:53.169Z", "app/commerce-modules/tax/tax-calculation-with-provider/page.mdx": "2024-07-01T10:21:19+03:00", "app/commerce-modules/tax/tax-rates-and-rules/page.mdx": "2024-06-26T07:55:59+00:00", "app/commerce-modules/tax/tax-region/page.mdx": "2024-05-29T11:08:06+00:00", - "app/commerce-modules/tax/page.mdx": "2024-09-05T15:03:18.495Z", + "app/commerce-modules/tax/page.mdx": "2024-09-30T08:43:53.170Z", "app/commerce-modules/user/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/user/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/user/examples/page.mdx": "2024-07-04T17:26:03+03:00", - "app/commerce-modules/user/module-options/page.mdx": "2024-07-04T17:26:03+03:00", + "app/commerce-modules/user/examples/page.mdx": "2024-09-30T08:43:53.171Z", + "app/commerce-modules/user/module-options/page.mdx": "2024-09-30T08:43:53.171Z", "app/commerce-modules/user/user-creation-flows/page.mdx": "2024-06-26T07:55:59+00:00", - "app/commerce-modules/user/page.mdx": "2024-09-05T15:03:30.835Z", + "app/commerce-modules/user/page.mdx": "2024-09-30T08:43:53.172Z", "app/commerce-modules/page.mdx": "2024-05-03T17:36:38+03:00", "app/contribution-guidelines/_admin-translations/page.mdx": "2024-05-13T18:55:11+03:00", "app/contribution-guidelines/docs/page.mdx": "2024-05-13T18:55:11+03:00", "app/create-medusa-app/page.mdx": "2024-08-05T11:10:55+03:00", "app/deployment/admin/vercel/page.mdx": "2024-07-31T17:01:33+03:00", - "app/deployment/medusa-application/railway/page.mdx": "2024-08-19T07:19:54.945Z", + "app/deployment/medusa-application/railway/page.mdx": "2024-09-30T08:43:53.172Z", "app/deployment/storefront/vercel/page.mdx": "2024-07-26T07:21:31+00:00", "app/deployment/page.mdx": "2024-07-25T09:55:22+03:00", "app/integrations/page.mdx": "2024-07-19T08:49:08+00:00", "app/medusa-cli/page.mdx": "2024-08-28T11:25:32.382Z", - "app/medusa-container-resources/page.mdx": "2024-08-05T07:24:27+00:00", - "app/medusa-workflows-reference/page.mdx": "2024-08-15T12:13:13+03:00", + "app/medusa-container-resources/page.mdx": "2024-09-30T08:43:53.173Z", + "app/medusa-workflows-reference/page.mdx": "2024-09-30T08:43:53.174Z", "app/nextjs-starter/page.mdx": "2024-07-01T10:21:19+03:00", - "app/recipes/b2b/page.mdx": "2024-08-29T09:23:12.736Z", - "app/recipes/commerce-automation/page.mdx": "2024-08-05T07:24:27+00:00", - "app/recipes/digital-products/examples/standard/page.mdx": "2024-09-26T09:00:12.671Z", + "app/recipes/b2b/page.mdx": "2024-09-30T08:43:53.175Z", + "app/recipes/commerce-automation/page.mdx": "2024-09-30T08:43:53.175Z", + "app/recipes/digital-products/examples/standard/page.mdx": "2024-09-30T08:43:53.176Z", "app/recipes/digital-products/page.mdx": "2024-08-02T13:02:06+00:00", "app/recipes/ecommerce/page.mdx": "2024-06-09T15:18:43+02:00", - "app/recipes/integrate-ecommerce-stack/page.mdx": "2024-08-05T07:24:27+00:00", - "app/recipes/marketplace/examples/vendors/page.mdx": "2024-09-26T09:06:11.833Z", + "app/recipes/integrate-ecommerce-stack/page.mdx": "2024-09-30T08:43:53.177Z", + "app/recipes/marketplace/examples/vendors/page.mdx": "2024-09-30T08:43:53.179Z", "app/recipes/marketplace/page.mdx": "2024-07-11T15:56:41+00:00", "app/recipes/multi-region-store/page.mdx": "2024-07-01T10:21:19+03:00", "app/recipes/omnichannel/page.mdx": "2024-06-09T15:18:43+02:00", "app/recipes/oms/page.mdx": "2024-07-01T10:21:19+03:00", "app/recipes/personalized-products/page.mdx": "2024-09-11T10:53:03.936Z", - "app/recipes/pos/page.mdx": "2024-07-04T17:26:03+03:00", - "app/recipes/subscriptions/examples/standard/page.mdx": "2024-09-26T10:19:57.044Z", + "app/recipes/pos/page.mdx": "2024-09-30T08:43:53.180Z", + "app/recipes/subscriptions/examples/standard/page.mdx": "2024-09-30T08:43:53.180Z", "app/recipes/subscriptions/page.mdx": "2024-08-02T12:40:26+03:00", "app/recipes/page.mdx": "2024-07-11T15:56:41+00:00", "app/service-factory-reference/methods/create/page.mdx": "2024-07-31T17:01:33+03:00", @@ -226,34 +226,34 @@ export const generatedEditDates = { "app/commerce-modules/auth/auth-flows/page.mdx": "2024-09-05T08:50:11.671Z", "app/commerce-modules/auth/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx": "2024-09-05T08:11:28.936Z", - "app/commerce-modules/api-key/page.mdx": "2024-08-05T07:24:27+00:00", - "app/commerce-modules/auth/create-actor-type/page.mdx": "2024-09-11T13:15:34.040Z", + "app/commerce-modules/api-key/page.mdx": "2024-09-30T08:43:53.152Z", + "app/commerce-modules/auth/create-actor-type/page.mdx": "2024-09-30T08:43:53.154Z", "app/architectural-modules/page.mdx": "2024-05-28T13:25:03+03:00", "app/commerce-modules/api-key/relations-to-other-modules/page.mdx": "2024-05-29T11:08:06+00:00", - "app/architectural-modules/workflow-engine/redis/page.mdx": "2024-07-18T13:04:29+02:00", - "app/commerce-modules/api-key/examples/page.mdx": "2024-07-04T17:26:03+03:00", - "app/architectural-modules/notification/sendgrid/page.mdx": "2024-08-05T07:21:11+00:00", + "app/architectural-modules/workflow-engine/redis/page.mdx": "2024-09-30T08:43:53.152Z", + "app/commerce-modules/api-key/examples/page.mdx": "2024-09-30T08:43:53.152Z", + "app/architectural-modules/notification/sendgrid/page.mdx": "2024-09-30T08:43:53.151Z", "app/commerce-modules/api-key/concepts/page.mdx": "2024-06-26T07:55:59+00:00", "app/architectural-modules/workflow-engine/page.mdx": "2024-05-28T13:25:03+03:00", "app/_events-reference/page.mdx": "2024-07-03T19:27:13+03:00", "app/architectural-modules/cache/page.mdx": "2024-05-28T13:25:03+03:00", - "app/architectural-modules/file/s3/page.mdx": "2024-08-06T09:59:46+03:00", + "app/architectural-modules/file/s3/page.mdx": "2024-09-30T08:43:53.150Z", "app/commerce-modules/api-key/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/api-key/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", - "app/architectural-modules/cache/redis/page.mdx": "2024-07-18T13:04:29+02:00", - "app/architectural-modules/event/redis/page.mdx": "2024-07-24T17:07:41+03:00", - "app/architectural-modules/event/local/page.mdx": "2024-07-24T17:07:41+03:00", - "app/architectural-modules/workflow-engine/in-memory/page.mdx": "2024-07-18T13:04:29+02:00", - "app/architectural-modules/cache/in-memory/page.mdx": "2024-07-18T13:04:29+02:00", - "app/architectural-modules/notification/local/page.mdx": "2024-07-18T13:04:29+02:00", - "app/architectural-modules/file/local/page.mdx": "2024-07-18T13:04:29+02:00", - "app/architectural-modules/notification/send-notification/page.mdx": "2024-08-06T09:59:46+03:00", + "app/architectural-modules/cache/redis/page.mdx": "2024-09-30T08:43:53.149Z", + "app/architectural-modules/event/redis/page.mdx": "2024-09-30T08:43:53.149Z", + "app/architectural-modules/event/local/page.mdx": "2024-09-30T08:43:53.149Z", + "app/architectural-modules/workflow-engine/in-memory/page.mdx": "2024-09-30T08:43:53.151Z", + "app/architectural-modules/cache/in-memory/page.mdx": "2024-09-30T08:43:53.148Z", + "app/architectural-modules/notification/local/page.mdx": "2024-09-30T08:43:53.150Z", + "app/architectural-modules/file/local/page.mdx": "2024-09-30T08:43:53.150Z", + "app/architectural-modules/notification/send-notification/page.mdx": "2024-09-30T08:43:53.151Z", "app/architectural-modules/file/page.mdx": "2024-07-01T10:21:19+03:00", "app/architectural-modules/event/page.mdx": "2024-05-28T13:25:03+03:00", - "app/architectural-modules/cache/create/page.mdx": "2024-07-04T17:26:03+03:00", - "app/admin-widget-injection-zones/page.mdx": "2024-05-29T13:50:19+03:00", - "app/architectural-modules/notification/page.mdx": "2024-07-04T17:26:03+03:00", - "app/architectural-modules/event/create/page.mdx": "2024-07-04T17:26:03+03:00", + "app/architectural-modules/cache/create/page.mdx": "2024-09-30T08:43:53.148Z", + "app/admin-widget-injection-zones/page.mdx": "2024-09-30T08:43:53.147Z", + "app/architectural-modules/notification/page.mdx": "2024-09-30T08:43:53.151Z", + "app/architectural-modules/event/create/page.mdx": "2024-09-30T08:43:53.149Z", "app/troubleshooting/deployment/page.mdx": "2024-08-19T07:19:40.924Z", "references/core_flows/Order/functions/core_flows.Order.orderEditUpdateItemQuantityValidationStep/page.mdx": "2024-08-20T00:10:58.913Z", "references/core_flows/Order/functions/core_flows.Order.orderEditUpdateItemQuantityWorkflow/page.mdx": "2024-08-20T00:10:58.949Z", @@ -265,7 +265,7 @@ export const generatedEditDates = { "references/core_flows/Order/functions/core_flows.Order.updateOrderEditAddItemValidationStep/page.mdx": "2024-08-20T00:10:59.065Z", "references/core_flows/Order/functions/core_flows.Order.updateOrderEditAddItemWorkflow/page.mdx": "2024-08-20T00:10:59.105Z", "references/core_flows/core_flows.Order/page.mdx": "2024-08-20T00:10:56.437Z", - "references/modules/core_flows/page.mdx": "2024-09-18T00:11:14.035Z", + "references/modules/core_flows/page.mdx": "2024-09-30T08:43:53.312Z", "references/types/types.HttpTypes/page.mdx": "2024-09-05T00:11:17.026Z", "app/troubleshooting/medusa-admin/no-widget-route/page.mdx": "2024-08-23T11:31:26.346Z", "references/auth/IAuthModuleService/methods/auth.IAuthModuleService.createProviderIdentities/page.mdx": "2024-09-17T00:10:59.695Z", @@ -287,14 +287,14 @@ export const generatedEditDates = { "references/auth/interfaces/auth.IAuthModuleService/page.mdx": "2024-09-06T11:11:37.678Z", "references/core_flows/Cart/Workflows_Cart/functions/core_flows.Cart.Workflows_Cart.completeCartWorkflow/page.mdx": "2024-09-17T00:11:05.639Z", "references/core_flows/Cart/core_flows.Cart.Workflows_Cart/page.mdx": "2024-09-17T00:11:05.591Z", - "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.createRemoteLinkStep/page.mdx": "2024-08-28T00:11:12.742Z", - "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.dismissRemoteLinkStep/page.mdx": "2024-08-28T00:11:12.746Z", + "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.createRemoteLinkStep/page.mdx": "2024-09-30T08:43:53.187Z", + "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.dismissRemoteLinkStep/page.mdx": "2024-09-30T08:43:53.187Z", "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.updateRemoteLinksStep/page.mdx": "2024-08-28T00:11:12.754Z", "references/core_flows/Common/Workflows_Common/functions/core_flows.Common.Workflows_Common.batchLinksWorkflow/page.mdx": "2024-08-28T00:11:12.766Z", "references/core_flows/Common/Workflows_Common/functions/core_flows.Common.Workflows_Common.createLinksWorkflow/page.mdx": "2024-08-28T00:11:12.770Z", "references/core_flows/Common/Workflows_Common/functions/core_flows.Common.Workflows_Common.dismissLinksWorkflow/page.mdx": "2024-08-28T00:11:12.774Z", "references/core_flows/Common/Workflows_Common/functions/core_flows.Common.Workflows_Common.updateLinksWorkflow/page.mdx": "2024-08-28T00:11:12.778Z", - "references/core_flows/Common/core_flows.Common.Steps_Common/page.mdx": "2024-08-30T00:11:09.490Z", + "references/core_flows/Common/core_flows.Common.Steps_Common/page.mdx": "2024-09-30T08:43:53.188Z", "references/core_flows/Common/core_flows.Common.Workflows_Common/page.mdx": "2024-08-28T00:11:12.762Z", "references/core_flows/Fulfillment/Steps_Fulfillment/functions/core_flows.Fulfillment.Steps_Fulfillment.createFulfillmentStep/page.mdx": "2024-09-17T00:11:06.663Z", "references/core_flows/Fulfillment/Steps_Fulfillment/functions/core_flows.Fulfillment.Steps_Fulfillment.createReturnFulfillmentStep/page.mdx": "2024-09-17T00:11:06.691Z", @@ -422,7 +422,7 @@ export const generatedEditDates = { "references/core_flows/Order/core_flows.Order.Workflows_Order/page.mdx": "2024-09-17T00:11:11.223Z", "references/core_flows/Shipping_Options/Steps_Shipping_Options/functions/core_flows.Shipping_Options.Steps_Shipping_Options.listShippingOptionsForContextStep/page.mdx": "2024-08-28T00:11:28.966Z", "references/core_flows/Shipping_Options/core_flows.Shipping_Options.Steps_Shipping_Options/page.mdx": "2024-08-28T00:11:28.958Z", - "references/core_flows/core_flows.Steps_Common/page.mdx": "2024-08-30T00:11:09.542Z", + "references/core_flows/core_flows.Steps_Common/page.mdx": "2024-09-30T08:43:53.189Z", "references/core_flows/core_flows.Steps_Fulfillment/page.mdx": "2024-09-17T00:11:07.059Z", "references/core_flows/core_flows.Steps_Order/page.mdx": "2024-09-17T00:11:15.091Z", "references/core_flows/core_flows.Steps_Shipping_Options/page.mdx": "2024-08-28T00:11:28.974Z", @@ -465,13 +465,13 @@ export const generatedEditDates = { "references/fulfillment_models/classes/fulfillment_models.ShippingOptionRule/page.mdx": "2024-08-29T00:11:41.425Z", "references/fulfillment_models/classes/fulfillment_models.ShippingOptionType/page.mdx": "2024-08-29T00:11:41.433Z", "references/fulfillment_models/classes/fulfillment_models.ShippingProfile/page.mdx": "2024-08-29T00:11:41.457Z", - "references/helper_steps/functions/helper_steps.createRemoteLinkStep/page.mdx": "2024-08-28T00:11:31.038Z", - "references/helper_steps/functions/helper_steps.dismissRemoteLinkStep/page.mdx": "2024-08-28T00:11:31.042Z", - "references/helper_steps/functions/helper_steps.emitEventStep/page.mdx": "2024-08-28T00:11:31.046Z", + "references/helper_steps/functions/helper_steps.createRemoteLinkStep/page.mdx": "2024-09-30T08:43:53.197Z", + "references/helper_steps/functions/helper_steps.dismissRemoteLinkStep/page.mdx": "2024-09-30T08:43:53.197Z", + "references/helper_steps/functions/helper_steps.emitEventStep/page.mdx": "2024-09-30T08:43:53.197Z", "references/helper_steps/functions/helper_steps.updateRemoteLinksStep/page.mdx": "2024-08-28T00:11:31.050Z", "references/helper_steps/types/helper_steps.DismissRemoteLinksStepInput/page.mdx": "2024-08-28T00:11:31.042Z", "references/medusa_config/interfaces/medusa_config.AdminOptions/page.mdx": "2024-09-03T00:11:20.871Z", - "references/medusa_config/interfaces/medusa_config.ConfigModule/page.mdx": "2024-09-03T00:11:20.891Z", + "references/medusa_config/interfaces/medusa_config.ConfigModule/page.mdx": "2024-09-30T08:43:53.199Z", "references/medusa_config/interfaces/medusa_config.ProjectConfigOptions/page.mdx": "2024-08-28T00:11:31.266Z", "references/modules/auth/page.mdx": "2024-08-28T00:11:06.310Z", "references/modules/modules_sdk/page.mdx": "2024-09-24T00:12:08.445Z", @@ -535,7 +535,7 @@ export const generatedEditDates = { "references/stock_location_next/interfaces/stock_location_next.ShippingOptionTypeDTO/page.mdx": "2024-08-28T00:11:34.911Z", "references/stock_location_next/interfaces/stock_location_next.ShippingProfileDTO/page.mdx": "2024-08-28T00:11:34.931Z", "references/types/CommonTypes/interfaces/types.CommonTypes.AdminOptions/page.mdx": "2024-08-28T00:11:04.822Z", - "references/types/CommonTypes/interfaces/types.CommonTypes.ConfigModule/page.mdx": "2024-09-06T00:11:07.142Z", + "references/types/CommonTypes/interfaces/types.CommonTypes.ConfigModule/page.mdx": "2024-09-30T08:43:53.320Z", "references/types/CommonTypes/interfaces/types.CommonTypes.ProjectConfigOptions/page.mdx": "2024-09-06T00:11:07.142Z", "references/types/DmlTypes/interfaces/types.DmlTypes.IDmlEntity/page.mdx": "2024-08-28T00:11:04.918Z", "references/types/DmlTypes/types/types.DmlTypes.InferTypeOf/page.mdx": "2024-08-28T00:11:04.942Z", @@ -620,7 +620,7 @@ export const generatedEditDates = { "references/types/NotificationTypes/interfaces/types.NotificationTypes.Attachment/page.mdx": "2024-08-29T00:11:17.880Z", "references/modules/fulfillment_models/page.mdx": "2024-08-29T00:11:41.369Z", "references/modules/order_models/page.mdx": "2024-08-29T00:11:42.665Z", - "references/notification/classes/notification.AbstractNotificationProviderService/page.mdx": "2024-09-17T00:11:24.847Z", + "references/notification/classes/notification.AbstractNotificationProviderService/page.mdx": "2024-09-30T08:43:53.316Z", "references/order/interfaces/order.IOrderModuleService/page.mdx": "2024-09-17T00:11:25.807Z", "references/order_models/classes/order_models.OrderItem/page.mdx": "2024-09-17T00:11:25.047Z", "references/order_models/classes/order_models.OrderSummary/page.mdx": "2024-09-17T00:11:25.087Z", @@ -643,7 +643,7 @@ export const generatedEditDates = { "app/medusa-cli/commands/start/page.mdx": "2024-08-28T10:44:19.952Z", "app/medusa-cli/commands/telemtry/page.mdx": "2024-08-28T11:25:08.553Z", "app/medusa-cli/commands/user/page.mdx": "2024-08-28T10:44:52.489Z", - "app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2024-09-26T10:12:17.661Z", + "app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2024-09-30T08:43:53.178Z", "references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateCustomerGroup/page.mdx": "2024-08-30T00:11:02.074Z", "references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateReservation/page.mdx": "2024-08-30T00:11:02.342Z", "references/types/HttpTypes/interfaces/types.HttpTypes.AdminCustomerGroup/page.mdx": "2024-08-30T00:11:02.070Z", @@ -714,7 +714,7 @@ export const generatedEditDates = { "references/core_flows/Cart/Workflows_Cart/functions/core_flows.Cart.Workflows_Cart.updateLineItemInCartWorkflow/page.mdx": "2024-09-03T00:11:02.259Z", "references/core_flows/Cart/Workflows_Cart/functions/core_flows.Cart.Workflows_Cart.updateTaxLinesWorkflow/page.mdx": "2024-09-03T00:11:02.275Z", "references/core_flows/Cart/core_flows.Cart.Steps_Cart/page.mdx": "2024-09-17T00:11:05.267Z", - "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx": "2024-08-30T00:11:09.514Z", + "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx": "2024-09-30T08:43:53.188Z", "references/core_flows/Fulfillment/Steps_Fulfillment/functions/core_flows.Fulfillment.Steps_Fulfillment.createShippingOptionRulesStep/page.mdx": "2024-08-30T00:11:10.030Z", "references/core_flows/Fulfillment/Steps_Fulfillment/functions/core_flows.Fulfillment.Steps_Fulfillment.deleteShippingOptionRulesStep/page.mdx": "2024-09-05T00:11:25.714Z", "references/core_flows/Order/Steps_Order/functions/core_flows.Order.Steps_Order.cancelOrderClaimStep/page.mdx": "2024-08-30T00:11:11.010Z", @@ -761,7 +761,7 @@ export const generatedEditDates = { "references/core_flows/types/core_flows.OrderEditRequestWorkflowInput/page.mdx": "2024-08-30T00:11:25.750Z", "references/core_flows/types/core_flows.UpdateOrderTaxLinesWorkflowInput/page.mdx": "2024-08-30T00:11:25.754Z", "references/core_flows/types/core_flows.UpdateTaxLinesWorkflowInput/page.mdx": "2024-09-03T00:11:19.047Z", - "references/helper_steps/functions/helper_steps.useRemoteQueryStep/page.mdx": "2024-08-30T00:11:27.218Z", + "references/helper_steps/functions/helper_steps.useRemoteQueryStep/page.mdx": "2024-09-30T08:43:53.198Z", "references/modules/types/page.mdx": "2024-09-23T00:11:33.472Z", "references/order/IOrderModuleService/methods/order.IOrderModuleService.cancelReturn/page.mdx": "2024-09-17T00:11:26.515Z", "references/order/interfaces/order.CancelOrderClaimDTO/page.mdx": "2024-08-30T00:11:28.474Z", @@ -913,8 +913,8 @@ export const generatedEditDates = { "references/types/HttpTypes/interfaces/types.HttpTypes.AdminClaimPreviewResponse/page.mdx": "2024-09-20T00:12:02.470Z", "references/types/HttpTypes/interfaces/types.HttpTypes.AdminOrderEditPreviewResponse/page.mdx": "2024-09-17T00:10:58.543Z", "references/types/interfaces/types.BaseClaim/page.mdx": "2024-09-20T00:12:02.329Z", - "app/commerce-modules/auth/auth-providers/github/page.mdx": "2024-09-05T12:13:04.991Z", - "app/commerce-modules/auth/auth-providers/google/page.mdx": "2024-09-05T12:12:59.196Z", + "app/commerce-modules/auth/auth-providers/github/page.mdx": "2024-09-30T08:43:53.153Z", + "app/commerce-modules/auth/auth-providers/google/page.mdx": "2024-09-30T08:43:53.153Z", "app/storefront-development/customers/third-party-login/page.mdx": "2024-09-11T09:58:51.801Z", "references/types/HttpTypes/types/types.HttpTypes.AdminWorkflowRunResponse/page.mdx": "2024-09-17T00:10:58.803Z", "references/types/HttpTypes/types/types.HttpTypes.BatchResponse/page.mdx": "2024-09-05T00:11:17.182Z", @@ -922,7 +922,7 @@ export const generatedEditDates = { "references/auth/IAuthModuleService/methods/auth.IAuthModuleService.authenticate/page.mdx": "2024-09-05T00:11:18.402Z", "references/auth/IAuthModuleService/methods/auth.IAuthModuleService.validateCallback/page.mdx": "2024-09-05T00:11:18.406Z", "references/auth/interfaces/auth.AuthenticationResponse/page.mdx": "2024-09-06T11:11:37.674Z", - "references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx": "2024-09-17T00:10:59.623Z", + "references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx": "2024-09-30T08:43:53.186Z", "references/core_flows/Invite/Workflows_Invite/functions/core_flows.Invite.Workflows_Invite.refreshInviteTokensWorkflow/page.mdx": "2024-09-05T00:11:26.266Z", "references/types/CommonTypes/types/types.CommonTypes.BatchMethodResponse/page.mdx": "2024-09-05T00:11:16.710Z", "references/types/HttpTypes/interfaces/types.HttpTypes.AdminAddReturnShipping/page.mdx": "2024-09-05T00:11:17.518Z", @@ -940,7 +940,7 @@ export const generatedEditDates = { "references/types/interfaces/types.AdminClaimUpdateShippingMethod/page.mdx": "2024-09-05T00:11:16.958Z", "references/types/interfaces/types.AdminExchangeAddShippingMethod/page.mdx": "2024-09-05T00:11:16.994Z", "references/types/interfaces/types.AdminExchangeUpdateShippingMethod/page.mdx": "2024-09-05T00:11:16.998Z", - "references/types/interfaces/types.DetailWidgetProps/page.mdx": "2024-09-05T00:11:16.614Z", + "references/types/interfaces/types.DetailWidgetProps/page.mdx": "2024-09-30T08:43:53.320Z", "references/types/types.WorkflowsSdkTypes/page.mdx": "2024-09-05T00:11:18.138Z", "references/product/IProductModuleService/methods/product.IProductModuleService.createProductOptionValues/page.mdx": "2024-09-17T00:11:27.679Z", "references/product/IProductModuleService/methods/product.IProductModuleService.deleteProductOptionValues/page.mdx": "2024-09-17T00:11:27.683Z", @@ -1242,17 +1242,17 @@ export const generatedEditDates = { "references/customer_models/classes/customer_models.Customer/page.mdx": "2024-09-17T00:11:23.259Z", "references/customer_models/classes/customer_models.CustomerGroup/page.mdx": "2024-09-17T00:11:23.251Z", "references/customer_models/classes/customer_models.CustomerGroupCustomer/page.mdx": "2024-09-17T00:11:23.247Z", - "references/dml/Model_Methods/methods/dml.Model_Methods.cascades/page.mdx": "2024-09-17T00:11:23.535Z", - "references/dml/Property_Types/methods/dml.Property_Types.enum/page.mdx": "2024-09-17T00:11:23.523Z", - "references/dml/Property_Types/methods/dml.Property_Types.id/page.mdx": "2024-09-17T00:11:23.515Z", + "references/dml/Model_Methods/methods/dml.Model_Methods.cascades/page.mdx": "2024-09-30T08:43:53.190Z", + "references/dml/Property_Types/methods/dml.Property_Types.enum/page.mdx": "2024-09-30T08:43:53.192Z", + "references/dml/Property_Types/methods/dml.Property_Types.id/page.mdx": "2024-09-30T08:43:53.192Z", "references/dml/Relationship_Methods/methods/dml.Relationship_Methods.belongsTo/page.mdx": "2024-09-17T00:11:23.527Z", - "references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx": "2024-09-17T00:11:23.531Z", - "references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx": "2024-09-17T00:11:23.527Z", - "references/dml/Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx": "2024-09-17T00:11:23.531Z", + "references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx": "2024-09-30T08:43:53.193Z", + "references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx": "2024-09-30T08:43:53.194Z", + "references/dml/Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx": "2024-09-30T08:43:53.194Z", "references/dml/entity/classes/dml.entity.DmlEntity/page.mdx": "2024-09-17T00:11:23.507Z", - "references/dml/entity_builder/EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx": "2024-09-17T00:11:23.503Z", + "references/dml/entity_builder/EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx": "2024-09-30T08:43:53.194Z", "references/dml/entity_builder/types/dml.entity_builder.ManyToManyOptions/page.mdx": "2024-09-17T00:11:23.499Z", - "references/file/classes/file.AbstractFileProviderService/page.mdx": "2024-09-17T00:11:23.551Z", + "references/file/classes/file.AbstractFileProviderService/page.mdx": "2024-09-30T08:43:53.195Z", "references/fulfillment/IFulfillmentModuleService/methods/fulfillment.IFulfillmentModuleService.createFulfillmentSets/page.mdx": "2024-09-17T00:11:23.903Z", "references/fulfillment/IFulfillmentModuleService/methods/fulfillment.IFulfillmentModuleService.createGeoZones/page.mdx": "2024-09-17T00:11:23.975Z", "references/fulfillment/IFulfillmentModuleService/methods/fulfillment.IFulfillmentModuleService.createServiceZones/page.mdx": "2024-09-17T00:11:23.935Z", @@ -1314,7 +1314,7 @@ export const generatedEditDates = { "references/fulfillment/interfaces/fulfillment.OrderLineItemDTO/page.mdx": "2024-09-17T00:11:24.259Z", "references/fulfillment/interfaces/fulfillment.OrderLineItemTaxLineDTO/page.mdx": "2024-09-17T00:11:24.231Z", "references/fulfillment/types/fulfillment.JoinerRelationship/page.mdx": "2024-09-17T00:11:24.183Z", - "references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx": "2024-09-17T00:11:23.639Z", + "references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx": "2024-09-30T08:43:53.195Z", "references/inventory_next/IInventoryService/methods/inventory_next.IInventoryService.adjustInventory/page.mdx": "2024-09-17T00:11:24.695Z", "references/inventory_next/IInventoryService/methods/inventory_next.IInventoryService.confirmInventory/page.mdx": "2024-09-17T00:11:24.699Z", "references/inventory_next/IInventoryService/methods/inventory_next.IInventoryService.createInventoryItems/page.mdx": "2024-09-17T00:11:24.639Z", @@ -1454,7 +1454,7 @@ export const generatedEditDates = { "references/payment/interfaces/payment.JoinerServiceConfig/page.mdx": "2024-09-17T00:11:26.727Z", "references/payment/interfaces/payment.JoinerServiceConfigAlias/page.mdx": "2024-09-17T00:11:26.723Z", "references/payment/types/payment.JoinerRelationship/page.mdx": "2024-09-17T00:11:26.723Z", - "references/payment_provider/classes/payment_provider.AbstractPaymentProvider/page.mdx": "2024-09-24T00:12:10.405Z", + "references/payment_provider/classes/payment_provider.AbstractPaymentProvider/page.mdx": "2024-09-30T08:43:53.316Z", "references/pricing/IPricingModuleService/methods/pricing.IPricingModuleService.addPriceListPrices/page.mdx": "2024-09-17T00:11:27.255Z", "references/pricing/IPricingModuleService/methods/pricing.IPricingModuleService.addPrices/page.mdx": "2024-09-17T00:11:27.199Z", "references/pricing/IPricingModuleService/methods/pricing.IPricingModuleService.calculatePrices/page.mdx": "2024-09-17T00:11:27.171Z", @@ -1688,7 +1688,7 @@ export const generatedEditDates = { "references/tax/interfaces/tax.TaxRateRuleDTO/page.mdx": "2024-09-17T00:11:28.607Z", "references/tax/interfaces/tax.UpdateTaxRateDTO/page.mdx": "2024-09-17T00:11:28.631Z", "references/tax/types/tax.JoinerRelationship/page.mdx": "2024-09-17T00:11:28.567Z", - "references/tax_provider/interfaces/tax_provider.ITaxProvider/page.mdx": "2024-09-17T00:11:28.543Z", + "references/tax_provider/interfaces/tax_provider.ITaxProvider/page.mdx": "2024-09-30T08:43:53.318Z", "references/tax_provider/types/tax_provider.ItemTaxCalculationLine/page.mdx": "2024-09-17T00:11:28.539Z", "references/tax_provider/types/tax_provider.ShippingTaxCalculationLine/page.mdx": "2024-09-17T00:11:28.535Z", "references/types/DAL/interfaces/types.DAL.RepositoryService/page.mdx": "2024-09-17T00:10:57.963Z", @@ -1791,5 +1791,29 @@ export const generatedEditDates = { "references/medusa/types/medusa.MedusaRequestHandler-1/page.mdx": "2024-09-24T00:11:41.190Z", "references/medusa/types/medusa.MedusaRequestHandler/page.mdx": "2024-09-24T00:11:41.155Z", "references/medusa/types/medusa.SubscriberArgs/page.mdx": "2024-09-24T00:11:41.195Z", - "references/workflows/types/workflows.ReturnWorkflow/page.mdx": "2024-09-24T00:12:12.649Z" + "references/workflows/types/workflows.ReturnWorkflow/page.mdx": "2024-09-24T00:12:12.649Z", + "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx": "2024-09-30T08:43:53.188Z", + "references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.removeRemoteLinkStep/page.mdx": "2024-09-30T08:43:53.188Z", + "references/dml/Model_Methods/methods/dml.Model_Methods.indexes/page.mdx": "2024-09-30T08:43:53.190Z", + "references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.default/page.mdx": "2024-09-30T08:43:53.190Z", + "references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.index/page.mdx": "2024-09-30T08:43:53.190Z", + "references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.nullable/page.mdx": "2024-09-30T08:43:53.191Z", + "references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.unique/page.mdx": "2024-09-30T08:43:53.191Z", + "references/dml/Property_Types/methods/dml.Property_Types.array/page.mdx": "2024-09-30T08:43:53.191Z", + "references/dml/Property_Types/methods/dml.Property_Types.bigNumber/page.mdx": "2024-09-30T08:43:53.192Z", + "references/dml/Property_Types/methods/dml.Property_Types.boolean/page.mdx": "2024-09-30T08:43:53.192Z", + "references/dml/Property_Types/methods/dml.Property_Types.dateTime/page.mdx": "2024-09-30T08:43:53.192Z", + "references/dml/Property_Types/methods/dml.Property_Types.json/page.mdx": "2024-09-30T08:43:53.193Z", + "references/dml/Property_Types/methods/dml.Property_Types.number/page.mdx": "2024-09-30T08:43:53.193Z", + "references/dml/Property_Types/methods/dml.Property_Types.text/page.mdx": "2024-09-30T08:43:53.193Z", + "references/helper_steps/functions/helper_steps.removeRemoteLinkStep/page.mdx": "2024-09-30T08:43:53.198Z", + "references/modules/workflows/page.mdx": "2024-09-30T08:43:53.315Z", + "references/search/classes/search.AbstractSearchService/page.mdx": "2024-09-30T08:43:53.317Z", + "references/workflows/StepResponse/methods/workflows.StepResponse.permanentFailure/page.mdx": "2024-09-30T08:43:53.321Z", + "references/workflows/functions/workflows.createHook/page.mdx": "2024-09-30T08:43:53.321Z", + "references/workflows/functions/workflows.createStep/page.mdx": "2024-09-30T08:43:53.321Z", + "references/workflows/functions/workflows.createWorkflow/page.mdx": "2024-09-30T08:43:53.321Z", + "references/workflows/functions/workflows.parallelize/page.mdx": "2024-09-30T08:43:53.322Z", + "references/workflows/functions/workflows.transform/page.mdx": "2024-09-30T08:43:53.322Z", + "references/workflows/functions/workflows.when/page.mdx": "2024-09-30T08:43:53.324Z" } \ No newline at end of file diff --git a/www/apps/resources/references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx b/www/apps/resources/references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx index 74a9dc1630f04..37122f70200b5 100644 --- a/www/apps/resources/references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx +++ b/www/apps/resources/references/auth_provider/classes/auth_provider.AbstractAuthModuleProvider/page.mdx @@ -18,10 +18,10 @@ Start by creating a new directory for your module. For example, `src/modules/my- ## 2. Create the Auth Provider Service -Create the file `src/modules/my-auth/service.ts` that holds the module's main service. It must extend the `AbstractAuthModuleProvider` class imported from `@medusajs/utils`: +Create the file `src/modules/my-auth/service.ts` that holds the module's main service. It must extend the `AbstractAuthModuleProvider` class imported from `@medusajs/framework/utils`: ```ts title="src/modules/my-auth/service.ts" -import { AbstractAuthModuleProvider } from "@medusajs/utils" +import { AbstractAuthModuleProvider } from "@medusajs/framework/utils" class MyAuthProviderService extends AbstractAuthModuleProvider { // TODO implement methods @@ -47,8 +47,8 @@ In the constructor, you must pass to the parent constructor two parameters: #### Example ```ts -import { AbstractAuthModuleProvider } from "@medusajs/utils" -import { Logger } from "@medusajs/types" +import { AbstractAuthModuleProvider } from "@medusajs/framework/utils" +import { Logger } from "@medusajs/framework/types" type InjectedDependencies = { logger: Logger @@ -119,7 +119,7 @@ import { AuthIdentityProviderService, AuthenticationInput, AuthenticationResponse -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -162,7 +162,7 @@ import { AuthIdentityProviderService, AuthenticationInput, AuthenticationResponse -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -220,8 +220,8 @@ import { AuthIdentityProviderService, AuthenticationInput, AuthenticationResponse -} from "@medusajs/types" -import { MedusaError } from "@medusajs/utils" +} from "@medusajs/framework/types" +import { MedusaError } from "@medusajs/framework/utils" // ... class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -282,8 +282,8 @@ import { AuthIdentityProviderService, AuthenticationInput, AuthenticationResponse -} from "@medusajs/types" -import { MedusaError } from "@medusajs/utils" +} from "@medusajs/framework/types" +import { MedusaError } from "@medusajs/framework/utils" // ... class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -344,7 +344,7 @@ import { AuthIdentityProviderService, AuthenticationInput, AuthenticationResponse -} from "@medusajs/types" +} from "@medusajs/framework/types" // ... class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -428,7 +428,7 @@ This exports the module's definition, indicating that the `MyAuthProviderService To use your Auth Module Provider, add it to the `providers` array of the Auth Module: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.createRemoteLinkStep/page.mdx b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.createRemoteLinkStep/page.mdx index df9c2dccc168a..369beeee57089 100644 --- a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.createRemoteLinkStep/page.mdx +++ b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.createRemoteLinkStep/page.mdx @@ -16,9 +16,9 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva ## Example ```ts -import { createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow } from "@medusajs/framework/workflows-sdk" import { createRemoteLinkStep } from "@medusajs/core-flows" -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow("hello-world", () => { createRemoteLinkStep([ diff --git a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.dismissRemoteLinkStep/page.mdx b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.dismissRemoteLinkStep/page.mdx index fa8b9ef38272f..f9b63be58b985 100644 --- a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.dismissRemoteLinkStep/page.mdx +++ b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.dismissRemoteLinkStep/page.mdx @@ -18,13 +18,13 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { dismissRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", diff --git a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx index 174a95b0a232a..77b78848c3469 100644 --- a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx +++ b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx @@ -16,7 +16,7 @@ Emit an event. ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { emitEventStep } from "@medusajs/core-flows" diff --git a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.removeRemoteLinkStep/page.mdx b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.removeRemoteLinkStep/page.mdx index 11e41d2cfa86d..57af8b291e1ab 100644 --- a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.removeRemoteLinkStep/page.mdx +++ b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.removeRemoteLinkStep/page.mdx @@ -18,13 +18,13 @@ Learn more in the [Remote Link documentation](https://docs.medusajs.com/v2/advan ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { removeRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", diff --git a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx index bbdee7977283c..ae14bb2fd5e01 100644 --- a/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx +++ b/www/apps/resources/references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx @@ -20,7 +20,7 @@ To retrieve a list of records of a data model: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -44,7 +44,7 @@ To retrieve a single item instead of a an array: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -74,7 +74,7 @@ To throw an error if a record isn't found matching the specified ID: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" diff --git a/www/apps/resources/references/core_flows/Common/core_flows.Common.Steps_Common/page.mdx b/www/apps/resources/references/core_flows/Common/core_flows.Common.Steps_Common/page.mdx index 5b57de1abc86c..717c20a4c6b19 100644 --- a/www/apps/resources/references/core_flows/Common/core_flows.Common.Steps_Common/page.mdx +++ b/www/apps/resources/references/core_flows/Common/core_flows.Common.Steps_Common/page.mdx @@ -11,9 +11,9 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva ### Example ```ts -import { createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow } from "@medusajs/framework/workflows-sdk" import { createRemoteLinkStep } from "@medusajs/core-flows" -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow("hello-world", () => { createRemoteLinkStep([ @@ -50,13 +50,13 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { dismissRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", @@ -92,7 +92,7 @@ Emit an event. ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { emitEventStep } from "@medusajs/core-flows" @@ -127,13 +127,13 @@ Learn more in the [Remote Link documentation](https://docs.medusajs.com/v2/advan ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { removeRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", @@ -182,7 +182,7 @@ To retrieve a list of records of a data model: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -206,7 +206,7 @@ To retrieve a single item instead of a an array: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -236,7 +236,7 @@ To throw an error if a record isn't found matching the specified ID: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" diff --git a/www/apps/resources/references/core_flows/core_flows.Steps_Common/page.mdx b/www/apps/resources/references/core_flows/core_flows.Steps_Common/page.mdx index 8ba24b707ea41..c1c439cfe16e2 100644 --- a/www/apps/resources/references/core_flows/core_flows.Steps_Common/page.mdx +++ b/www/apps/resources/references/core_flows/core_flows.Steps_Common/page.mdx @@ -51,9 +51,9 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva ### Example ```ts -import { createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow } from "@medusajs/framework/workflows-sdk" import { createRemoteLinkStep } from "@medusajs/core-flows" -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow("hello-world", () => { createRemoteLinkStep([ @@ -90,13 +90,13 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { dismissRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", @@ -132,7 +132,7 @@ Emit an event. ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { emitEventStep } from "@medusajs/core-flows" @@ -167,13 +167,13 @@ Learn more in the [Remote Link documentation](https://docs.medusajs.com/v2/advan ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { removeRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", @@ -222,7 +222,7 @@ To retrieve a list of records of a data model: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -246,7 +246,7 @@ To retrieve a single item instead of a an array: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -276,7 +276,7 @@ To throw an error if a record isn't found matching the specified ID: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" diff --git a/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.cascades/page.mdx b/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.cascades/page.mdx index af2c799d21c9a..eeaf6a37f1d33 100644 --- a/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.cascades/page.mdx +++ b/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.cascades/page.mdx @@ -15,7 +15,7 @@ For example, if a store is deleted, its product should also be deleted. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const Store = model.define("store", { id: model.id(), diff --git a/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.indexes/page.mdx b/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.indexes/page.mdx index 78c359bd4a31a..c56ad724fdf1e 100644 --- a/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.indexes/page.mdx +++ b/www/apps/resources/references/dml/Model_Methods/methods/dml.Model_Methods.indexes/page.mdx @@ -15,7 +15,7 @@ and have conditions. An example of a simple index: ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id(), @@ -33,7 +33,7 @@ export default MyCustom To add a condition on the index, use the `where` option: ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id(), @@ -54,7 +54,7 @@ export default MyCustom The condition can also be a negation. For example: ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id(), diff --git a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.default/page.mdx b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.default/page.mdx index 23e23e86b6d64..ff293e9003029 100644 --- a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.default/page.mdx +++ b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.default/page.mdx @@ -12,7 +12,7 @@ This method defines the default value of a property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { color: model diff --git a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.index/page.mdx b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.index/page.mdx index 3b9ae73dec437..133e13a72731c 100644 --- a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.index/page.mdx +++ b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.index/page.mdx @@ -12,7 +12,7 @@ This method defines an index on a property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id(), diff --git a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.nullable/page.mdx b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.nullable/page.mdx index 879892ec99222..e1adb8d95c33a 100644 --- a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.nullable/page.mdx +++ b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.nullable/page.mdx @@ -12,7 +12,7 @@ This method indicates that a property's value can be `null`. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { price: model.bigNumber().nullable(), diff --git a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.unique/page.mdx b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.unique/page.mdx index 94af388fe7e13..997a68ecc1c78 100644 --- a/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.unique/page.mdx +++ b/www/apps/resources/references/dml/Property_Configuration_Methods/methods/dml.Property_Configuration_Methods.unique/page.mdx @@ -13,7 +13,7 @@ A unique index is created on the property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const User = model.define("user", { email: model.text().unique(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.array/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.array/page.mdx index 7ceceb0bebff5..e8420eacde28e 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.array/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.array/page.mdx @@ -12,7 +12,7 @@ This method defines an array of strings property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { names: model.array(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.bigNumber/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.bigNumber/page.mdx index 0fa4857af7388..55b5c80e70b87 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.bigNumber/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.bigNumber/page.mdx @@ -12,7 +12,7 @@ This method defines a number property that expects large numbers, such as prices ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { price: model.bigNumber(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.boolean/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.boolean/page.mdx index 712234f9db01a..33ea916013cfe 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.boolean/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.boolean/page.mdx @@ -12,7 +12,7 @@ This method defines a boolean property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { hasAccount: model.boolean(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.dateTime/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.dateTime/page.mdx index 62277379c5e71..6c785f0da11b7 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.dateTime/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.dateTime/page.mdx @@ -12,7 +12,7 @@ This method defines a timestamp property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { date_of_birth: model.dateTime(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.enum/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.enum/page.mdx index 7bbd4ca169386..8082fe1d34c5c 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.enum/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.enum/page.mdx @@ -12,7 +12,7 @@ This method defines a property whose value can only be one of the specified valu ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { color: model.enum(["black", "white"]), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.id/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.id/page.mdx index b81e215022169..0fb3f8f8edb87 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.id/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.id/page.mdx @@ -15,7 +15,7 @@ primary key. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const User = model.define("User", { id: model.id().primaryKey(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.json/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.json/page.mdx index da1ab362715f4..ef34f7a5e829f 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.json/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.json/page.mdx @@ -12,7 +12,7 @@ This method defines a property whose value is a stringified JSON object. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { metadata: model.json(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.number/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.number/page.mdx index 875b21a685631..2b6009c196841 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.number/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.number/page.mdx @@ -12,7 +12,7 @@ This method defines a number property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { age: model.number(), diff --git a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.text/page.mdx b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.text/page.mdx index 3ba35a8f57352..758b0621a09f4 100644 --- a/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.text/page.mdx +++ b/www/apps/resources/references/dml/Property_Types/methods/dml.Property_Types.text/page.mdx @@ -12,7 +12,7 @@ This method defines a string property. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { name: model.text(), diff --git a/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx b/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx index 3210e0215599e..c7384459d6fbd 100644 --- a/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx +++ b/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasMany/page.mdx @@ -16,7 +16,7 @@ For example, a store "hasMany" products. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const Store = model.define("store", { id: model.id(), diff --git a/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx b/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx index 53a6bb649b8bb..c6c2e54703476 100644 --- a/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx +++ b/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.hasOne/page.mdx @@ -19,7 +19,7 @@ the other data model. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const User = model.define("user", { id: model.id(), diff --git a/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx b/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx index 0751f3226dbe8..85c20ece74134 100644 --- a/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx +++ b/www/apps/resources/references/dml/Relationship_Methods/methods/dml.Relationship_Methods.manyToMany/page.mdx @@ -16,7 +16,7 @@ is associated with many orders. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const Order = model.define("order", { id: model.id(), diff --git a/www/apps/resources/references/dml/entity_builder/EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx b/www/apps/resources/references/dml/entity_builder/EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx index 653f430018868..b09c094bc698a 100644 --- a/www/apps/resources/references/dml/entity_builder/EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx +++ b/www/apps/resources/references/dml/entity_builder/EntityBuilder/methods/dml.entity_builder.EntityBuilder.define/page.mdx @@ -11,7 +11,7 @@ This method defines a data model. ## Example ```ts -import { model } from "@medusajs/utils" +import { model } from "@medusajs/framework/utils" const MyCustom = model.define("my_custom", { id: model.id(), diff --git a/www/apps/resources/references/file/classes/file.AbstractFileProviderService/page.mdx b/www/apps/resources/references/file/classes/file.AbstractFileProviderService/page.mdx index 9c0af9690b9ac..9eadc44824a69 100644 --- a/www/apps/resources/references/file/classes/file.AbstractFileProviderService/page.mdx +++ b/www/apps/resources/references/file/classes/file.AbstractFileProviderService/page.mdx @@ -18,10 +18,10 @@ Start by creating a new directory for your module. For example, `src/modules/my- ## 2. Create the File Provider Service -Create the file `src/modules/my-file/service.ts` that holds the implementation of the module's main service. It must extend the `AbstractFileProviderService` class imported from `@medusajs/utils`: +Create the file `src/modules/my-file/service.ts` that holds the implementation of the module's main service. It must extend the `AbstractFileProviderService` class imported from `@medusajs/framework/utils`: ```ts title="src/modules/my-file/service.ts" -import { AbstractFileProviderService } from "@medusajs/utils" +import { AbstractFileProviderService } from "@medusajs/framework/utils" class MyFileProviderService extends AbstractFileProviderService { // TODO implement methods @@ -40,8 +40,8 @@ If you're creating a client or establishing a connection with a third-party serv #### Example ```ts -import { Logger } from "@medusajs/types" -import { AbstractFileProviderService } from "@medusajs/utils" +import { Logger } from "@medusajs/framework/types" +import { AbstractFileProviderService } from "@medusajs/framework/utils" type InjectedDependencies = { logger: Logger @@ -206,7 +206,7 @@ The File Module accepts one provider only. ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx b/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx index e6e91c803905c..a72b2779b2b07 100644 --- a/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx +++ b/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx @@ -18,10 +18,10 @@ Start by creating a new directory for your module. For example, `src/modules/my- ## 2. Create the Fulfillment Provider Service -Create the file `src/modules/my-fulfillment/service.ts` that holds the module's main service. It must extend the `AbstractFulfillmentProviderService` class imported from `@medusajs/utils`: +Create the file `src/modules/my-fulfillment/service.ts` that holds the module's main service. It must extend the `AbstractFulfillmentProviderService` class imported from `@medusajs/framework/utils`: ```ts title="src/modules/my-fulfillment/service.ts" -import { AbstractFulfillmentProviderService } from "@medusajs/utils" +import { AbstractFulfillmentProviderService } from "@medusajs/framework/utils" class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { // TODO implement methods @@ -77,7 +77,7 @@ This exports the module's definition, indicating that the `MyFulfillmentProvider To use your Fulfillment Module Provider, add it to the `providers` array of the Fulfillment Module: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/references/helper_steps/functions/helper_steps.createRemoteLinkStep/page.mdx b/www/apps/resources/references/helper_steps/functions/helper_steps.createRemoteLinkStep/page.mdx index d88c7785fd84e..84f3be4d83f85 100644 --- a/www/apps/resources/references/helper_steps/functions/helper_steps.createRemoteLinkStep/page.mdx +++ b/www/apps/resources/references/helper_steps/functions/helper_steps.createRemoteLinkStep/page.mdx @@ -12,9 +12,9 @@ This documentation provides a reference to the `createRemoteLinkStep` step. It b ## Example ```ts -import { createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow } from "@medusajs/framework/workflows-sdk" import { createRemoteLinkStep } from "@medusajs/core-flows" -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow("hello-world", () => { createRemoteLinkStep([ diff --git a/www/apps/resources/references/helper_steps/functions/helper_steps.dismissRemoteLinkStep/page.mdx b/www/apps/resources/references/helper_steps/functions/helper_steps.dismissRemoteLinkStep/page.mdx index 530d36524dfa3..8f68ee57b33f4 100644 --- a/www/apps/resources/references/helper_steps/functions/helper_steps.dismissRemoteLinkStep/page.mdx +++ b/www/apps/resources/references/helper_steps/functions/helper_steps.dismissRemoteLinkStep/page.mdx @@ -14,13 +14,13 @@ This documentation provides a reference to the `dismissRemoteLinkStep` step. It ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { dismissRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", diff --git a/www/apps/resources/references/helper_steps/functions/helper_steps.emitEventStep/page.mdx b/www/apps/resources/references/helper_steps/functions/helper_steps.emitEventStep/page.mdx index 19104a770026d..33994bcfbf8b1 100644 --- a/www/apps/resources/references/helper_steps/functions/helper_steps.emitEventStep/page.mdx +++ b/www/apps/resources/references/helper_steps/functions/helper_steps.emitEventStep/page.mdx @@ -14,7 +14,7 @@ This documentation provides a reference to the `emitEventStep` step. It belongs ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { emitEventStep } from "@medusajs/core-flows" diff --git a/www/apps/resources/references/helper_steps/functions/helper_steps.removeRemoteLinkStep/page.mdx b/www/apps/resources/references/helper_steps/functions/helper_steps.removeRemoteLinkStep/page.mdx index 50c56a534fe6c..6fda5aaa2b883 100644 --- a/www/apps/resources/references/helper_steps/functions/helper_steps.removeRemoteLinkStep/page.mdx +++ b/www/apps/resources/references/helper_steps/functions/helper_steps.removeRemoteLinkStep/page.mdx @@ -14,13 +14,13 @@ This documentation provides a reference to the `removeRemoteLinkStep` step. It b ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { removeRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", diff --git a/www/apps/resources/references/helper_steps/functions/helper_steps.useRemoteQueryStep/page.mdx b/www/apps/resources/references/helper_steps/functions/helper_steps.useRemoteQueryStep/page.mdx index 19c09d6a214c8..1ff308542699c 100644 --- a/www/apps/resources/references/helper_steps/functions/helper_steps.useRemoteQueryStep/page.mdx +++ b/www/apps/resources/references/helper_steps/functions/helper_steps.useRemoteQueryStep/page.mdx @@ -16,7 +16,7 @@ To retrieve a list of records of a data model: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -40,7 +40,7 @@ To retrieve a single item instead of a an array: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -70,7 +70,7 @@ To throw an error if a record isn't found matching the specified ID: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" diff --git a/www/apps/resources/references/medusa_config/interfaces/medusa_config.ConfigModule/page.mdx b/www/apps/resources/references/medusa_config/interfaces/medusa_config.ConfigModule/page.mdx index 21c4db91960bc..eee29c046124f 100644 --- a/www/apps/resources/references/medusa_config/interfaces/medusa_config.ConfigModule/page.mdx +++ b/www/apps/resources/references/medusa_config/interfaces/medusa_config.ConfigModule/page.mdx @@ -10,7 +10,7 @@ In this document, you’ll learn how to create a file service in the Medusa back The configurations for your Medusa application are in `medusa-config.js` located in the root of your Medusa project. The configurations include configurations for database, modules, and more. -`medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/utils`. +`medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/framework/utils`. `defineConfig` accepts as a parameter an object with the following properties: diff --git a/www/apps/resources/references/modules/core_flows/page.mdx b/www/apps/resources/references/modules/core_flows/page.mdx index 47517ee169c78..50e5939a97307 100644 --- a/www/apps/resources/references/modules/core_flows/page.mdx +++ b/www/apps/resources/references/modules/core_flows/page.mdx @@ -3938,9 +3938,9 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva #### Example ```ts -import { createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow } from "@medusajs/framework/workflows-sdk" import { createRemoteLinkStep } from "@medusajs/core-flows" -import { Modules } from "@medusajs/utils" +import { Modules } from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow("hello-world", () => { createRemoteLinkStep([ @@ -3975,13 +3975,13 @@ Learn more in the [Remote Link documentation.](https://docs.medusajs.com/v2/adva ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { dismissRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", @@ -4015,7 +4015,7 @@ Emit an event. ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { emitEventStep } from "@medusajs/core-flows" @@ -4048,13 +4048,13 @@ Learn more in the [Remote Link documentation](https://docs.medusajs.com/v2/advan ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { removeRemoteLinkStep } from "@medusajs/core-flows" import { Modules -} from "@medusajs/utils" +} from "@medusajs/framework/utils" const helloWorldWorkflow = createWorkflow( "hello-world", @@ -4099,7 +4099,7 @@ To retrieve a list of records of a data model: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -4123,7 +4123,7 @@ To retrieve a single item instead of a an array: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" @@ -4153,7 +4153,7 @@ To throw an error if a record isn't found matching the specified ID: ```ts import { createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { useRemoteQueryStep } from "@medusajs/core-flows" diff --git a/www/apps/resources/references/modules/workflows/page.mdx b/www/apps/resources/references/modules/workflows/page.mdx index d68e156869c75..f4f723f33c974 100644 --- a/www/apps/resources/references/modules/workflows/page.mdx +++ b/www/apps/resources/references/modules/workflows/page.mdx @@ -6,7 +6,7 @@ import { TypeList } from "docs-ui" # Workflows API Reference -This section of the documentation provides a reference to the utility functions of the `@medusajs/workflows-sdk` package. +This section of the documentation provides a reference to the utility functions of the `@medusajs/framework/workflows-sdk` package. ## Functions diff --git a/www/apps/resources/references/notification/classes/notification.AbstractNotificationProviderService/page.mdx b/www/apps/resources/references/notification/classes/notification.AbstractNotificationProviderService/page.mdx index bfd8cf11dc9f3..27896cb644a7a 100644 --- a/www/apps/resources/references/notification/classes/notification.AbstractNotificationProviderService/page.mdx +++ b/www/apps/resources/references/notification/classes/notification.AbstractNotificationProviderService/page.mdx @@ -20,12 +20,12 @@ Start by creating a new directory for your module. For example, `src/modules/my- Create the file `src/modules/my-notification/service.ts` that holds the implementation of the notification service. -The Notification Provider Module's main service must extend the `AbstractNotificationProviderService` class imported from `@medusajs/utils`: +The Notification Provider Module's main service must extend the `AbstractNotificationProviderService` class imported from `@medusajs/framework/utils`: ```ts title="src/modules/my-notification/service.ts" import { AbstractNotificationProviderService -} from "@medusajs/utils" +} from "@medusajs/framework/utils" class MyNotificationProviderService extends AbstractNotificationProviderService { // TODO add methods @@ -44,8 +44,8 @@ If you're creating a client or establishing a connection with a third-party serv #### Example ```ts -import { AbstractNotificationProviderService } from "@medusajs/utils" -import { Logger } from "@medusajs/types" +import { AbstractNotificationProviderService } from "@medusajs/framework/utils" +import { Logger } from "@medusajs/framework/types" type InjectedDependencies = { logger: Logger @@ -103,7 +103,7 @@ This method is used to send a notification using the third-party provider or you import { ProviderSendNotificationDTO, ProviderSendNotificationResultsDTO -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyNotificationProviderService extends AbstractNotificationProviderService { // ... @@ -159,7 +159,7 @@ The Notification Module accepts one provider per channel. ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/references/payment_provider/classes/payment_provider.AbstractPaymentProvider/page.mdx b/www/apps/resources/references/payment_provider/classes/payment_provider.AbstractPaymentProvider/page.mdx index 7b726ed99d501..73254f160673e 100644 --- a/www/apps/resources/references/payment_provider/classes/payment_provider.AbstractPaymentProvider/page.mdx +++ b/www/apps/resources/references/payment_provider/classes/payment_provider.AbstractPaymentProvider/page.mdx @@ -18,10 +18,10 @@ Start by creating a new directory for your module. For example, `src/modules/my- ## 2. Create the Payment Provider Service -Create the file `src/modules/my-payment/service.ts` that holds the module's main service. It must extend the `AbstractPaymentProvider` class imported from `@medusajs/utils`: +Create the file `src/modules/my-payment/service.ts` that holds the module's main service. It must extend the `AbstractPaymentProvider` class imported from `@medusajs/framework/utils`: ```ts title="src/modules/my-payment/service.ts" -import { AbstractPaymentProvider } from "@medusajs/utils" +import { AbstractPaymentProvider } from "@medusajs/framework/utils" type Options = { apiKey: string @@ -54,8 +54,8 @@ The provider can also access the module's options as a second parameter. ```ts import { AbstractPaymentProvider -} from "@medusajs/utils" -import { Logger } from "@medusajs/types" +} from "@medusajs/framework/utils" +import { Logger } from "@medusajs/framework/types" type InjectedDependencies = { logger: Logger @@ -127,7 +127,7 @@ In this method, use the third-party provider to capture the payment. import { PaymentProviderError, PaymentProviderSessionResponse, -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -183,7 +183,7 @@ import { PaymentProviderError, PaymentProviderSessionResponse, PaymentSessionStatus -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -241,7 +241,7 @@ This method cancels a payment. import { PaymentProviderError, PaymentProviderSessionResponse, -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -286,7 +286,7 @@ in the third-party session, before authorizing or capturing the payment later. import { PaymentProviderError, PaymentProviderSessionResponse, -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -345,7 +345,7 @@ Use this to delete or cancel the payment in the third-party service. import { PaymentProviderError, PaymentProviderSessionResponse, -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -390,7 +390,7 @@ This method gets the status of a payment session based on the status in the thir // other imports... import { PaymentSessionStatus -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -441,7 +441,7 @@ This method refunds an amount of a payment previously captured. import { PaymentProviderError, PaymentProviderSessionResponse, -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -496,7 +496,7 @@ Retrieves the payment's data from the third-party service. import { PaymentProviderError, PaymentProviderSessionResponse, -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -543,7 +543,7 @@ import { UpdatePaymentProviderSession, PaymentProviderError, PaymentProviderSessionResponse, -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -609,11 +609,11 @@ Learn more in [this documentation](https://docs.medusajs.com/v2/resources/commer // other imports... import { BigNumber -} from "@medusajs/utils" +} from "@medusajs/framework/utils" import { ProviderWebhookPayload, WebhookActionResult -} from "@medusajs/types" +} from "@medusajs/framework/types" class MyPaymentProviderService extends AbstractPaymentProvider< Options @@ -696,7 +696,7 @@ This exports the module's definition, indicating that the `MyPaymentProviderServ To use your Payment Module Provider, add it to the `providers` array of the Payment Module: ```js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... diff --git a/www/apps/resources/references/search/classes/search.AbstractSearchService/page.mdx b/www/apps/resources/references/search/classes/search.AbstractSearchService/page.mdx index e74f7cb5f8188..04c269652af24 100644 --- a/www/apps/resources/references/search/classes/search.AbstractSearchService/page.mdx +++ b/www/apps/resources/references/search/classes/search.AbstractSearchService/page.mdx @@ -10,11 +10,11 @@ In this document, you’ll learn how to create a search service in the Medusa ba ## Prerequisites -A search service must extend the `AbstractSearchService` class imported from the `@medusajs/utils` package. If you don’t already have the package +A search service must extend the `AbstractSearchService` class imported from the `@medusajs/framework/utils` package. If you don’t already have the package installed, run the following command to install it within your project: ```bash npm2yarn -npm install @medusajs/utils +npm install @medusajs/framework/utils ``` --- @@ -22,7 +22,7 @@ npm install @medusajs/utils ## Overview A search service class is in a TypeScript or JavaScript file created in the `src/services` directory. The class must extend the `AbstractSearchService` class imported - from the `@medusajs/utils` package. + from the `@medusajs/framework/utils` package. Based on services’ naming conventions, the file’s name should be the slug version of the search service’s name without `service`, and the class’s name should be the pascal case of the search service’s name following by `Service`. @@ -30,7 +30,7 @@ pascal case of the search service’s name following by `Service`. For example, create the `MySearchService` class in the file `src/services/my-search.ts`: ```ts title="src/services/my-search.ts" -import { AbstractSearchService } from "@medusajs/utils" +import { AbstractSearchService } from "@medusajs/framework/utils" class MySearchService extends AbstractSearchService { isDefault = false diff --git a/www/apps/resources/references/tax_provider/interfaces/tax_provider.ITaxProvider/page.mdx b/www/apps/resources/references/tax_provider/interfaces/tax_provider.ITaxProvider/page.mdx index e81ae5e099d57..6e777613fb645 100644 --- a/www/apps/resources/references/tax_provider/interfaces/tax_provider.ITaxProvider/page.mdx +++ b/www/apps/resources/references/tax_provider/interfaces/tax_provider.ITaxProvider/page.mdx @@ -18,7 +18,7 @@ either in a plugin, in a provider module, or directly in your Medusa application ## How to Create a Tax Provider A tax provider class is defined in a TypeScript or JavaScript file. The class must implement the -`ITaxProvider` interface imported from `@medusajs/types`. +`ITaxProvider` interface imported from `@medusajs/framework/types`. The file can be defined in a plugin, a provider module, or under the `src/services` directory of your Medusa application. You can later pass the package's name or the path to the file in the `providers` option of the Tax Module. @@ -26,7 +26,7 @@ path to the file in the `providers` option of the Tax Module. For example: ```ts title="src/services/my-tax.ts" -import { ITaxProvider } from "@medusajs/types" +import { ITaxProvider } from "@medusajs/framework/types" export default class MyTaxProvider implements ITaxProvider { // ... diff --git a/www/apps/resources/references/types/CommonTypes/interfaces/types.CommonTypes.ConfigModule/page.mdx b/www/apps/resources/references/types/CommonTypes/interfaces/types.CommonTypes.ConfigModule/page.mdx index 195d6d08ff01d..c4e4bd3df6e55 100644 --- a/www/apps/resources/references/types/CommonTypes/interfaces/types.CommonTypes.ConfigModule/page.mdx +++ b/www/apps/resources/references/types/CommonTypes/interfaces/types.CommonTypes.ConfigModule/page.mdx @@ -4,7 +4,7 @@ import { TypeList } from "docs-ui" The configurations for your Medusa application are in `medusa-config.js` located in the root of your Medusa project. The configurations include configurations for database, modules, and more. -`medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/utils`. +`medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/framework/utils`. `defineConfig` accepts as a parameter an object with the following properties: diff --git a/www/apps/resources/references/types/interfaces/types.DetailWidgetProps/page.mdx b/www/apps/resources/references/types/interfaces/types.DetailWidgetProps/page.mdx index 70c3a255bdce4..b03c3df25be13 100644 --- a/www/apps/resources/references/types/interfaces/types.DetailWidgetProps/page.mdx +++ b/www/apps/resources/references/types/interfaces/types.DetailWidgetProps/page.mdx @@ -12,7 +12,7 @@ type AdminProduct. ## Example ```tsx -import type { DetailWidgetProps, AdminProduct } from "@medusajs/types" +import type { DetailWidgetProps, AdminProduct } from "@medusajs/framework/types" import { defineWidgetConfig } from "@medusajs/admin-sdk" const ProductWidget = ({ data }: DetailWidgetProps) => { diff --git a/www/apps/resources/references/workflows/StepResponse/methods/workflows.StepResponse.permanentFailure/page.mdx b/www/apps/resources/references/workflows/StepResponse/methods/workflows.StepResponse.permanentFailure/page.mdx index b5b3e457acadf..41832e44c258a 100644 --- a/www/apps/resources/references/workflows/StepResponse/methods/workflows.StepResponse.permanentFailure/page.mdx +++ b/www/apps/resources/references/workflows/StepResponse/methods/workflows.StepResponse.permanentFailure/page.mdx @@ -12,7 +12,7 @@ import { createStep, StepResponse, createWorkflow -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" interface CreateProductInput { title: string diff --git a/www/apps/resources/references/workflows/functions/workflows.createHook/page.mdx b/www/apps/resources/references/workflows/functions/workflows.createHook/page.mdx index 58adb75375ea8..632bf35d5cb12 100644 --- a/www/apps/resources/references/workflows/functions/workflows.createHook/page.mdx +++ b/www/apps/resources/references/workflows/functions/workflows.createHook/page.mdx @@ -7,7 +7,7 @@ import { TypeList } from "docs-ui" # createHook - Workflows API Reference -This documentation provides a reference to the `createHook` . It belongs to the `@medusajs/workflows-sdk` package. +This documentation provides a reference to the `createHook` . It belongs to the `@medusajs/framework/workflows-sdk` package. Expose a hook in your workflow where you can inject custom functionality as a step function. @@ -23,7 +23,7 @@ import { createHook, createWorkflow, WorkflowResponse, -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createProductStep } from "./steps/create-product" export const myWorkflow = createWorkflow( diff --git a/www/apps/resources/references/workflows/functions/workflows.createStep/page.mdx b/www/apps/resources/references/workflows/functions/workflows.createStep/page.mdx index 4e417bf149957..50ae51bd5c223 100644 --- a/www/apps/resources/references/workflows/functions/workflows.createStep/page.mdx +++ b/www/apps/resources/references/workflows/functions/workflows.createStep/page.mdx @@ -7,7 +7,7 @@ import { TypeList } from "docs-ui" # createStep - Workflows API Reference -This documentation provides a reference to the `createStep` . It belongs to the `@medusajs/workflows-sdk` package. +This documentation provides a reference to the `createStep` . It belongs to the `@medusajs/framework/workflows-sdk` package. This function creates a [StepFunction](../../types/workflows.StepFunction/page.mdx) that can be used as a step in a workflow constructed by the [createWorkflow](../workflows.createWorkflow/page.mdx) function. @@ -19,7 +19,7 @@ import { StepResponse, StepExecutionContext, WorkflowData -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" interface CreateProductInput { title: string diff --git a/www/apps/resources/references/workflows/functions/workflows.createWorkflow/page.mdx b/www/apps/resources/references/workflows/functions/workflows.createWorkflow/page.mdx index 4bb189ad6d303..22fea72920a8e 100644 --- a/www/apps/resources/references/workflows/functions/workflows.createWorkflow/page.mdx +++ b/www/apps/resources/references/workflows/functions/workflows.createWorkflow/page.mdx @@ -7,7 +7,7 @@ import { TypeList } from "docs-ui" # createWorkflow - Workflows API Reference -This documentation provides a reference to the `createWorkflow` . It belongs to the `@medusajs/workflows-sdk` package. +This documentation provides a reference to the `createWorkflow` . It belongs to the `@medusajs/framework/workflows-sdk` package. This function creates a workflow with the provided name and a constructor function. The constructor function builds the workflow from steps created by the [createStep](../workflows.createStep/page.mdx) function. @@ -17,7 +17,7 @@ invoke the exported workflow, then run its `run` method. ## Example ```ts -import { createWorkflow } from "@medusajs/workflows-sdk" +import { createWorkflow } from "@medusajs/framework/workflows-sdk" import { MedusaRequest, MedusaResponse, Product } from "@medusajs/medusa" import { createProductStep, diff --git a/www/apps/resources/references/workflows/functions/workflows.parallelize/page.mdx b/www/apps/resources/references/workflows/functions/workflows.parallelize/page.mdx index e94b1ef0c775f..732ba38e3d722 100644 --- a/www/apps/resources/references/workflows/functions/workflows.parallelize/page.mdx +++ b/www/apps/resources/references/workflows/functions/workflows.parallelize/page.mdx @@ -7,7 +7,7 @@ import { TypeList } from "docs-ui" # parallelize - Workflows API Reference -This documentation provides a reference to the `parallelize` . It belongs to the `@medusajs/workflows-sdk` package. +This documentation provides a reference to the `parallelize` . It belongs to the `@medusajs/framework/workflows-sdk` package. This function is used to run multiple steps in parallel. The result of each step will be returned as part of the result array. @@ -17,7 +17,7 @@ This function is used to run multiple steps in parallel. The result of each step import { createWorkflow, parallelize -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { createProductStep, getProductStep, diff --git a/www/apps/resources/references/workflows/functions/workflows.transform/page.mdx b/www/apps/resources/references/workflows/functions/workflows.transform/page.mdx index 1bab91e758012..c7410fd071c02 100644 --- a/www/apps/resources/references/workflows/functions/workflows.transform/page.mdx +++ b/www/apps/resources/references/workflows/functions/workflows.transform/page.mdx @@ -7,7 +7,7 @@ import { TypeList } from "docs-ui" # transform - Workflows API Reference -This documentation provides a reference to the `transform` . It belongs to the `@medusajs/workflows-sdk` package. +This documentation provides a reference to the `transform` . It belongs to the `@medusajs/framework/workflows-sdk` package. This function transforms the output of other utility functions. @@ -24,7 +24,7 @@ If you're also retrieving the output of a hook and want to check if its value is import { createWorkflow, transform -} from "@medusajs/workflows-sdk" +} from "@medusajs/framework/workflows-sdk" import { step1, step2 } from "./steps" type WorkflowInput = { diff --git a/www/apps/resources/references/workflows/functions/workflows.when/page.mdx b/www/apps/resources/references/workflows/functions/workflows.when/page.mdx index d60e1b76e130d..7b5f3a22c30b2 100644 --- a/www/apps/resources/references/workflows/functions/workflows.when/page.mdx +++ b/www/apps/resources/references/workflows/functions/workflows.when/page.mdx @@ -7,7 +7,7 @@ import { TypeList } from "docs-ui" # when - Workflows API Reference -This documentation provides a reference to the `when` . It belongs to the `@medusajs/workflows-sdk` package. +This documentation provides a reference to the `when` . It belongs to the `@medusajs/framework/workflows-sdk` package. ## Type Parameters diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts index 324e5663743f4..9ae2b597a14a7 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/auth-provider.ts @@ -20,10 +20,10 @@ const authProviderOptions: FormattingOptionsType = { Start by creating a new directory for your module. For example, \`src/modules/my-auth\`.`, `## 2. Create the Auth Provider Service -Create the file \`src/modules/my-auth/service.ts\` that holds the module's main service. It must extend the \`AbstractAuthModuleProvider\` class imported from \`@medusajs/utils\`: +Create the file \`src/modules/my-auth/service.ts\` that holds the module's main service. It must extend the \`AbstractAuthModuleProvider\` class imported from \`@medusajs/framework/utils\`: \`\`\`ts title="src/modules/my-auth/service.ts" -import { AbstractAuthModuleProvider } from "@medusajs/utils" +import { AbstractAuthModuleProvider } from "@medusajs/framework/utils" class MyAuthProviderService extends AbstractAuthModuleProvider { // TODO implement methods @@ -51,7 +51,7 @@ This exports the module's definition, indicating that the \`MyAuthProviderServic To use your Auth Module Provider, add it to the \`providers\` array of the Auth Module: \`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -59,7 +59,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.AUTH]: { - resolve: "@medusajs/auth", + resolve: "@medusajs/framework/auth", options: { providers: [ { diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/core-flows.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/core-flows.ts index da7b47f7e7f20..f4fa6298c3830 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/core-flows.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/core-flows.ts @@ -43,7 +43,7 @@ const coreFlowsOptions: FormattingOptionsType = { }, "^core_flows/.*/Workflows_.*/functions/.*/page\\.mdx": { reflectionDescription: - "This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/core-flows` package.", + "This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/medusa/core-flows` package.", frontmatterData: { slug: "/references/medusa-workflows/{{alias}}", sidebar_label: "{{alias}}", @@ -56,7 +56,7 @@ const coreFlowsOptions: FormattingOptionsType = { }, "^core_flows/.*/Steps_.*/functions/.*/page\\.mdx": { reflectionDescription: - "This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/core-flows` package.", + "This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/medusa/core-flows` package.", frontmatterData: { slug: "/references/medusa-workflows/steps/{{alias}}", sidebar_label: "{{alias}}", diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts index 9c32596e5439c..47d4608e7e187 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/file.ts @@ -20,10 +20,10 @@ const fileOptions: FormattingOptionsType = { Start by creating a new directory for your module. For example, \`src/modules/my-file\`.`, `## 2. Create the File Provider Service -Create the file \`src/modules/my-file/service.ts\` that holds the implementation of the module's main service. It must extend the \`AbstractFileProviderService\` class imported from \`@medusajs/utils\`: +Create the file \`src/modules/my-file/service.ts\` that holds the implementation of the module's main service. It must extend the \`AbstractFileProviderService\` class imported from \`@medusajs/framework/utils\`: \`\`\`ts title="src/modules/my-file/service.ts" -import { AbstractFileProviderService } from "@medusajs/utils" +import { AbstractFileProviderService } from "@medusajs/framework/utils" class MyFileProviderService extends AbstractFileProviderService { // TODO implement methods @@ -57,7 +57,7 @@ The File Module accepts one provider only. \`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -65,7 +65,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.FILE]: { - resolve: "@medusajs/file", + resolve: "@medusajs/framework/file", options: { providers: [ { diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts index 25f42c719696b..ee346852fa253 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/fulfillment-provider.ts @@ -20,10 +20,10 @@ const fulfillmentProviderOptions: FormattingOptionsType = { Start by creating a new directory for your module. For example, \`src/modules/my-fulfillment\`.`, `## 2. Create the Fulfillment Provider Service -Create the file \`src/modules/my-fulfillment/service.ts\` that holds the module's main service. It must extend the \`AbstractFulfillmentProviderService\` class imported from \`@medusajs/utils\`: +Create the file \`src/modules/my-fulfillment/service.ts\` that holds the module's main service. It must extend the \`AbstractFulfillmentProviderService\` class imported from \`@medusajs/framework/utils\`: \`\`\`ts title="src/modules/my-fulfillment/service.ts" -import { AbstractFulfillmentProviderService } from "@medusajs/utils" +import { AbstractFulfillmentProviderService } from "@medusajs/framework/utils" class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { // TODO implement methods @@ -51,7 +51,7 @@ This exports the module's definition, indicating that the \`MyFulfillmentProvide To use your Fulfillment Module Provider, add it to the \`providers\` array of the Fulfillment Module: \`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -59,7 +59,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.FULFILLMENT]: { - resolve: "@medusajs/fulfillment", + resolve: "@medusajs/framework/fulfillment", options: { providers: [ { diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/helper-steps.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/helper-steps.ts index 218cdc474537c..96ca99efe9985 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/helper-steps.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/helper-steps.ts @@ -12,7 +12,7 @@ const helperStepsOptions: FormattingOptionsType = { }, "^modules/helper_steps/page\\.mdx": { reflectionDescription: - "This section of the documentation provides a reference to utility steps that you can use in your workflows. These steps are imported from the `@medusajs/core-flows` package.", + "This section of the documentation provides a reference to utility steps that you can use in your workflows. These steps are imported from the `@medusajs/medusa/core-flows` package.", reflectionGroups: { Namespaces: false, Enumerations: false, @@ -35,7 +35,7 @@ const helperStepsOptions: FormattingOptionsType = { }, "^helper_steps/functions": { reflectionDescription: - "This documentation provides a reference to the `{{alias}}` step. It belongs to the `@medusajs/core-flows` package.", + "This documentation provides a reference to the `{{alias}}` step. It belongs to the `@medusajs/medusa/core-flows` package.", frontmatterData: { slug: "/references/helper-steps/{{alias}}", sidebar_label: "{{alias}}", diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts index 02607b05e5cae..32e307db997a5 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/notification.ts @@ -22,12 +22,12 @@ Start by creating a new directory for your module. For example, \`src/modules/my Create the file \`src/modules/my-notification/service.ts\` that holds the implementation of the notification service. -The Notification Provider Module's main service must extend the \`AbstractNotificationProviderService\` class imported from \`@medusajs/utils\`: +The Notification Provider Module's main service must extend the \`AbstractNotificationProviderService\` class imported from \`@medusajs/framework/utils\`: \`\`\`ts title="src/modules/my-notification/service.ts" import { AbstractNotificationProviderService -} from "@medusajs/utils" +} from "@medusajs/framework/utils" class MyNotificationProviderService extends AbstractNotificationProviderService { // TODO add methods @@ -61,7 +61,7 @@ The Notification Module accepts one provider per channel. \`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -69,7 +69,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.NOTIFICATION]: { - resolve: "@medusajs/notification", + resolve: "@medusajs/framework/notification", options: { providers: [ { diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts index 926202d9c8f3a..8575f125813ee 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/payment-provider.ts @@ -23,10 +23,10 @@ const paymentProviderOptions: FormattingOptionsType = { Start by creating a new directory for your module. For example, \`src/modules/my-payment\`.`, `## 2. Create the Payment Provider Service -Create the file \`src/modules/my-payment/service.ts\` that holds the module's main service. It must extend the \`AbstractPaymentProvider\` class imported from \`@medusajs/utils\`: +Create the file \`src/modules/my-payment/service.ts\` that holds the module's main service. It must extend the \`AbstractPaymentProvider\` class imported from \`@medusajs/framework/utils\`: \`\`\`ts title="src/modules/my-payment/service.ts" -import { AbstractPaymentProvider } from "@medusajs/utils" +import { AbstractPaymentProvider } from "@medusajs/framework/utils" type Options = { apiKey: string @@ -60,7 +60,7 @@ This exports the module's definition, indicating that the \`MyPaymentProviderSer To use your Payment Module Provider, add it to the \`providers\` array of the Payment Module: \`\`\`js title="medusa-config.js" -const { Modules } = require("@medusajs/utils") +const { Modules } = require("@medusajs/framework/utils") // ... @@ -68,7 +68,7 @@ module.exports = defineConfig({ // ... modules: { [Modules.PAYMENT]: { - resolve: "@medusajs/payment", + resolve: "@medusajs/framework/payment", options: { providers: [ { diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/search.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/search.ts index fe083f8e3fae0..bd51f513c9d73 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/search.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/search.ts @@ -6,7 +6,7 @@ const searchOptions: FormattingOptionsType = { ## Prerequisites -A search service must extend the \`AbstractSearchService\` class imported from the \`@medusajs/utils\` package. If you don’t already have the package +A search service must extend the \`AbstractSearchService\` class imported from the \`@medusajs/framework/utils\` package. If you don’t already have the package installed, run the following command to install it within your project: \`\`\`bash npm2yarn diff --git a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/workflows.ts b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/workflows.ts index 466f893cfeb35..0e7496989b066 100644 --- a/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/workflows.ts +++ b/www/utils/packages/typedoc-generate-references/src/constants/merger-custom-options/workflows.ts @@ -12,7 +12,7 @@ const workflowsOptions: FormattingOptionsType = { }, "^modules/workflows/page\\.mdx": { reflectionDescription: - "This section of the documentation provides a reference to the utility functions of the `@medusajs/workflows-sdk` package.", + "This section of the documentation provides a reference to the utility functions of the `@medusajs/framework/workflows-sdk` package.", reflectionGroups: { Namespaces: false, Enumerations: false, @@ -32,7 +32,7 @@ const workflowsOptions: FormattingOptionsType = { "^workflows/functions": { maxLevel: 1, reflectionDescription: - "This documentation provides a reference to the `{{alias}}` {{kind}}. It belongs to the `@medusajs/workflows-sdk` package.", + "This documentation provides a reference to the `{{alias}}` {{kind}}. It belongs to the `@medusajs/framework/workflows-sdk` package.", frontmatterData: { slug: "/references/workflows/{{alias}}", sidebar_label: "{{alias}}", From 4587a69f3f2b2ee60defac4a2c49df519bb235b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20Poli=C4=87?= <16856471+fPolic@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:03:51 +0200 Subject: [PATCH 3/9] fix(dashboard): allow to unset currency cell value (#9312) **What** - unset datagrid currency cell on delete press instead of setting it to 0 - consolidate pricing editors validations - fix PL edit pricing schema --- FIXES CC-529 --- .../hooks/use-data-grid-form-handlers.tsx | 4 +- .../create-shipping-options-form.tsx | 16 ++++--- .../src/routes/price-lists/common/schemas.ts | 4 +- .../price-list-prices-edit-form.tsx | 43 +++++++++++++------ .../create-product-variant-form.tsx | 19 ++++---- .../routes/products/product-create/utils.ts | 4 ++ .../products/product-prices/pricing-edit.tsx | 10 +++-- 7 files changed, 64 insertions(+), 36 deletions(-) diff --git a/packages/admin/dashboard/src/components/data-grid/hooks/use-data-grid-form-handlers.tsx b/packages/admin/dashboard/src/components/data-grid/hooks/use-data-grid-form-handlers.tsx index 69fffff08285f..bee8c62bac50b 100644 --- a/packages/admin/dashboard/src/components/data-grid/hooks/use-data-grid-form-handlers.tsx +++ b/packages/admin/dashboard/src/components/data-grid/hooks/use-data-grid-form-handlers.tsx @@ -12,7 +12,7 @@ type UseDataGridFormHandlersOptions = { export const useDataGridFormHandlers = < TData, - TFieldValues extends FieldValues + TFieldValues extends FieldValues, >({ matrix, form, @@ -119,7 +119,7 @@ export function convertArrayToPrimitive( ): any[] { switch (type) { case "number": - return values.map(convertToNumber) + return values.map((v) => (v === "" ? v : convertToNumber(v))) case "boolean": return values.map(convertToBoolean) case "text": diff --git a/packages/admin/dashboard/src/routes/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx b/packages/admin/dashboard/src/routes/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx index 0aa6f40ef1d1f..4e7ebbe844d88 100644 --- a/packages/admin/dashboard/src/routes/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx +++ b/packages/admin/dashboard/src/routes/locations/location-service-zone-shipping-option-create/components/create-shipping-options-form/create-shipping-options-form.tsx @@ -62,25 +62,29 @@ export function CreateShippingOptionsForm({ const handleSubmit = form.handleSubmit(async (data) => { const currencyPrices = Object.entries(data.currency_prices) .map(([code, value]) => { - const amount = value ? castNumber(value) : undefined + if (value === "" || value === undefined) { + return undefined + } return { currency_code: code, - amount: amount, + amount: castNumber(value), } }) - .filter((o) => !!o.amount) as { currency_code: string; amount: number }[] + .filter((o) => !!o) as { currency_code: string; amount: number }[] const regionPrices = Object.entries(data.region_prices) .map(([region_id, value]) => { - const amount = value ? castNumber(value) : undefined + if (value === "" || value === undefined) { + return undefined + } return { region_id, - amount: amount, + amount: castNumber(value), } }) - .filter((o) => !!o.amount) as { region_id: string; amount: number }[] + .filter((o) => !!o) as { region_id: string; amount: number }[] await mutateAsync( { diff --git a/packages/admin/dashboard/src/routes/price-lists/common/schemas.ts b/packages/admin/dashboard/src/routes/price-lists/common/schemas.ts index 755c14add166f..dceda6eb87832 100644 --- a/packages/admin/dashboard/src/routes/price-lists/common/schemas.ts +++ b/packages/admin/dashboard/src/routes/price-lists/common/schemas.ts @@ -57,7 +57,7 @@ export type PriceListCreateProductsSchema = z.infer< > export const PriceListUpdateCurrencyPriceSchema = z.object({ - amount: z.string().nullish(), + amount: z.string().or(z.number()).optional(), id: z.string().nullish(), }) @@ -66,7 +66,7 @@ export type PriceListUpdateCurrencyPrice = z.infer< > export const PriceListUpdateRegionPriceSchema = z.object({ - amount: z.string().nullish(), + amount: z.string().or(z.number()).optional(), id: z.string().nullish(), }) diff --git a/packages/admin/dashboard/src/routes/price-lists/price-list-prices-edit/components/price-list-prices-edit-form/price-list-prices-edit-form.tsx b/packages/admin/dashboard/src/routes/price-lists/price-list-prices-edit/components/price-list-prices-edit-form/price-list-prices-edit-form.tsx index 1d71d3df79eef..b9b090491fb68 100644 --- a/packages/admin/dashboard/src/routes/price-lists/price-list-prices-edit/components/price-list-prices-edit-form/price-list-prices-edit-form.tsx +++ b/packages/admin/dashboard/src/routes/price-lists/price-list-prices-edit/components/price-list-prices-edit-form/price-list-prices-edit-form.tsx @@ -185,10 +185,13 @@ function convertToPriceArray( ) { const prices: PriceObject[] = [] - const regionCurrencyMap = regions.reduce((map, region) => { - map[region.id] = region.currency_code - return map - }, {} as Record) + const regionCurrencyMap = regions.reduce( + (map, region) => { + map[region.id] = region.currency_code + return map + }, + {} as Record + ) for (const [_productId, product] of Object.entries(data || {})) { const { variants } = product || {} @@ -200,7 +203,10 @@ function convertToPriceArray( for (const [currencyCode, currencyPrice] of Object.entries( currencyPrices || {} )) { - if (currencyPrice?.amount) { + if ( + currencyPrice?.amount !== "" && + typeof currencyPrice?.amount !== "undefined" + ) { prices.push({ variantId, currencyCode, @@ -213,7 +219,10 @@ function convertToPriceArray( for (const [regionId, regionPrice] of Object.entries( regionPrices || {} )) { - if (regionPrice?.amount) { + if ( + regionPrice?.amount !== "" && + typeof regionPrice?.amount !== "undefined" + ) { prices.push({ variantId, regionId, @@ -240,15 +249,21 @@ function comparePrices(initialPrices: PriceObject[], newPrices: PriceObject[]) { const pricesToCreate: HttpTypes.AdminCreatePriceListPrice[] = [] const pricesToDelete: string[] = [] - const initialPriceMap = initialPrices.reduce((map, price) => { - map[createMapKey(price)] = price - return map - }, {} as Record) + const initialPriceMap = initialPrices.reduce( + (map, price) => { + map[createMapKey(price)] = price + return map + }, + {} as Record + ) - const newPriceMap = newPrices.reduce((map, price) => { - map[createMapKey(price)] = price - return map - }, {} as Record) + const newPriceMap = newPrices.reduce( + (map, price) => { + map[createMapKey(price)] = price + return map + }, + {} as Record + ) const keys = new Set([ ...Object.keys(initialPriceMap), diff --git a/packages/admin/dashboard/src/routes/products/product-create-variant/components/create-product-variant-form/create-product-variant-form.tsx b/packages/admin/dashboard/src/routes/products/product-create-variant/components/create-product-variant-form/create-product-variant-form.tsx index 7dcd1cb1ae306..3b6f35bc64787 100644 --- a/packages/admin/dashboard/src/routes/products/product-create-variant/components/create-product-variant-form/create-product-variant-form.tsx +++ b/packages/admin/dashboard/src/routes/products/product-create-variant/components/create-product-variant-form/create-product-variant-form.tsx @@ -74,10 +74,13 @@ export const CreateProductVariantForm = ({ return {} } - return regions.reduce((acc, reg) => { - acc[reg.id] = reg.currency_code - return acc - }, {} as Record) + return regions.reduce( + (acc, reg) => { + acc[reg.id] = reg.currency_code + return acc + }, + {} as Record + ) }, [regions]) const isManageInventoryEnabled = useWatch({ @@ -210,13 +213,13 @@ export const CreateProductVariantForm = ({ options: data.options, prices: Object.entries(data.prices ?? {}) .map(([currencyOrRegion, value]) => { - const ret: AdminCreateProductVariantPrice = {} - const amount = castNumber(value) - - if (isNaN(amount) || value === "") { + if (value === "" || value === undefined) { return undefined } + const ret: AdminCreateProductVariantPrice = {} + const amount = castNumber(value) + if (currencyOrRegion.startsWith("reg_")) { ret.rules = { region_id: currencyOrRegion } ret.currency_code = regionsCurrencyMap[currencyOrRegion] diff --git a/packages/admin/dashboard/src/routes/products/product-create/utils.ts b/packages/admin/dashboard/src/routes/products/product-create/utils.ts index 506de39ee8c0e..ef57931290cae 100644 --- a/packages/admin/dashboard/src/routes/products/product-create/utils.ts +++ b/packages/admin/dashboard/src/routes/products/product-create/utils.ts @@ -75,6 +75,10 @@ export const normalizeVariants = ( .filter(Boolean), prices: Object.entries(variant.prices || {}) .map(([key, value]: any) => { + if (value === "" || value === undefined) { + return undefined + } + if (key.startsWith("reg_")) { return { currency_code: regionsCurrencyMap[key], diff --git a/packages/admin/dashboard/src/routes/products/product-prices/pricing-edit.tsx b/packages/admin/dashboard/src/routes/products/product-prices/pricing-edit.tsx index f01a9d94bc2b2..9840a3f287de7 100644 --- a/packages/admin/dashboard/src/routes/products/product-prices/pricing-edit.tsx +++ b/packages/admin/dashboard/src/routes/products/product-prices/pricing-edit.tsx @@ -74,8 +74,11 @@ export const PricingEdit = ({ const handleSubmit = form.handleSubmit(async (values) => { const reqData = values.variants.map((variant, ind) => ({ id: variants[ind].id, - prices: Object.entries(variant.prices || {}).map( - ([currencyCodeOrRegionId, value]: any) => { + prices: Object.entries(variant.prices || {}) + .filter( + ([_, value]) => value !== "" && typeof value !== "undefined" // deleted cells + ) + .map(([currencyCodeOrRegionId, value]: any) => { const regionId = currencyCodeOrRegionId.startsWith("reg_") ? currencyCodeOrRegionId : undefined @@ -105,8 +108,7 @@ export const PricingEdit = ({ amount, ...(regionId ? { rules: { region_id: regionId } } : {}), } - } - ), + }), })) await mutateAsync(reqData, { From 20943902f9c212cae74d8fc5306a7ce7fb8f9c10 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 1 Oct 2024 12:04:03 +0300 Subject: [PATCH 4/9] chore: update imports in tsdocs (#9379) --- .../src/common/steps/create-remote-links.ts | 2 +- .../src/common/steps/dismiss-remote-links.ts | 2 +- .../core-flows/src/common/steps/emit-event.ts | 2 +- .../src/common/steps/remove-remote-links.ts | 2 +- .../src/common/steps/use-remote-query.ts | 2 +- packages/core/framework/src/config/types.ts | 2 +- packages/core/types/src/tax/provider.ts | 4 +-- .../utils/src/auth/abstract-auth-provider.ts | 18 ++++++------ packages/core/utils/src/dml/entity-builder.ts | 28 ++++++++++--------- packages/core/utils/src/dml/entity.ts | 8 +++--- .../core/utils/src/dml/properties/base.ts | 8 +++--- packages/core/utils/src/dml/properties/id.ts | 2 +- .../core/utils/src/dml/properties/number.ts | 15 ++++++++++ .../core/utils/src/dml/properties/text.ts | 4 +-- .../utils/src/file/abstract-file-provider.ts | 4 +-- .../abstract-notification-provider.ts | 6 ++-- .../src/payment/abstract-payment-provider.ts | 26 ++++++++--------- .../src/utils/composer/create-hook.ts | 2 +- .../src/utils/composer/create-step.ts | 6 ++-- .../src/utils/composer/create-workflow.ts | 16 ++++++----- .../src/utils/composer/parallelize.ts | 14 +++++----- .../src/utils/composer/transform.ts | 25 +++++++---------- 22 files changed, 105 insertions(+), 93 deletions(-) diff --git a/packages/core/core-flows/src/common/steps/create-remote-links.ts b/packages/core/core-flows/src/common/steps/create-remote-links.ts index e60fac9022001..87eef77df2ab0 100644 --- a/packages/core/core-flows/src/common/steps/create-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/create-remote-links.ts @@ -15,7 +15,7 @@ export const createLinksStepId = "create-remote-links" * } from "@medusajs/framework/workflows-sdk" * import { * createRemoteLinkStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * import { * Modules * } from "@medusajs/framework/utils" diff --git a/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts b/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts index 7b6d34f0314b3..9849789f0a928 100644 --- a/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts @@ -19,7 +19,7 @@ export const dismissRemoteLinkStepId = "dismiss-remote-links" * } from "@medusajs/framework/workflows-sdk" * import { * dismissRemoteLinkStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * import { * Modules * } from "@medusajs/framework/utils" diff --git a/packages/core/core-flows/src/common/steps/emit-event.ts b/packages/core/core-flows/src/common/steps/emit-event.ts index 000eeafc0724c..63448568eb2bb 100644 --- a/packages/core/core-flows/src/common/steps/emit-event.ts +++ b/packages/core/core-flows/src/common/steps/emit-event.ts @@ -46,7 +46,7 @@ export const emitEventStepId = "emit-event-step" * } from "@medusajs/framework/workflows-sdk" * import { * emitEventStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * * const helloWorldWorkflow = createWorkflow( * "hello-world", diff --git a/packages/core/core-flows/src/common/steps/remove-remote-links.ts b/packages/core/core-flows/src/common/steps/remove-remote-links.ts index 3a3cd00f64470..fc194d0a908cc 100644 --- a/packages/core/core-flows/src/common/steps/remove-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/remove-remote-links.ts @@ -17,7 +17,7 @@ export const removeRemoteLinkStepId = "remove-remote-links" * } from "@medusajs/framework/workflows-sdk" * import { * removeRemoteLinkStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * import { * Modules * } from "@medusajs/framework/utils" diff --git a/packages/core/core-flows/src/common/steps/use-remote-query.ts b/packages/core/core-flows/src/common/steps/use-remote-query.ts index b6eae2e9a8ea1..734e253d6f2e0 100644 --- a/packages/core/core-flows/src/common/steps/use-remote-query.ts +++ b/packages/core/core-flows/src/common/steps/use-remote-query.ts @@ -62,7 +62,7 @@ export const useRemoteQueryStepId = "use-remote-query" * } from "@medusajs/framework/workflows-sdk" * import { * useRemoteQueryStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * * const helloWorldWorkflow = createWorkflow( * "hello-world", diff --git a/packages/core/framework/src/config/types.ts b/packages/core/framework/src/config/types.ts index 5bcec447ffc34..928b268317a27 100644 --- a/packages/core/framework/src/config/types.ts +++ b/packages/core/framework/src/config/types.ts @@ -760,7 +760,7 @@ export type ProjectConfigOptions = { * * The configurations for your Medusa application are in `medusa-config.js` located in the root of your Medusa project. The configurations include configurations for database, modules, and more. * - * `medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/utils`. + * `medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/framework/utils`. * * `defineConfig` accepts as a parameter an object with the following properties: * diff --git a/packages/core/types/src/tax/provider.ts b/packages/core/types/src/tax/provider.ts index 302418799eede..2016ba6ac9951 100644 --- a/packages/core/types/src/tax/provider.ts +++ b/packages/core/types/src/tax/provider.ts @@ -48,7 +48,7 @@ export type ItemTaxCalculationLine = { * ## How to Create a Tax Provider * * A tax provider class is defined in a TypeScript or JavaScript file. The class must implement the - * `ITaxProvider` interface imported from `@medusajs/types`. + * `ITaxProvider` interface imported from `@medusajs/framework/types`. * * The file can be defined in a plugin, a provider module, or under the `src/services` directory of your Medusa application. You can later pass the package's name or the * path to the file in the `providers` option of the Tax Module. @@ -56,7 +56,7 @@ export type ItemTaxCalculationLine = { * For example: * * ```ts title="src/services/my-tax.ts" - * import { ITaxProvider } from "@medusajs/types" + * import { ITaxProvider } from "@medusajs/framework/types" * * export default class MyTaxProvider implements ITaxProvider { * // ... diff --git a/packages/core/utils/src/auth/abstract-auth-provider.ts b/packages/core/utils/src/auth/abstract-auth-provider.ts index 628d715c9e374..fe17774b7f425 100644 --- a/packages/core/utils/src/auth/abstract-auth-provider.ts +++ b/packages/core/utils/src/auth/abstract-auth-provider.ts @@ -23,8 +23,8 @@ import { * #### Example * * ```ts - * import { AbstractAuthModuleProvider } from "@medusajs/utils" - * import { Logger } from "@medusajs/types" + * import { AbstractAuthModuleProvider } from "@medusajs/framework/utils" + * import { Logger } from "@medusajs/framework/types" * * type InjectedDependencies = { * logger: Logger @@ -136,7 +136,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -179,7 +179,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -238,8 +238,8 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" - * import { MedusaError } from "@medusajs/utils" + * } from "@medusajs/framework/types" + * import { MedusaError } from "@medusajs/framework/utils" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -305,8 +305,8 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" - * import { MedusaError } from "@medusajs/utils" + * } from "@medusajs/framework/types" + * import { MedusaError } from "@medusajs/framework/utils" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -371,7 +371,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { diff --git a/packages/core/utils/src/dml/entity-builder.ts b/packages/core/utils/src/dml/entity-builder.ts index 6472055842469..1cb76c32e328b 100644 --- a/packages/core/utils/src/dml/entity-builder.ts +++ b/packages/core/utils/src/dml/entity-builder.ts @@ -100,7 +100,7 @@ export class EntityBuilder { * @param {Schema} schema - The schema of the data model's properties. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -135,7 +135,7 @@ export class EntityBuilder { * primary key. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const User = model.define("User", { * id: model.id().primaryKey(), @@ -154,7 +154,7 @@ export class EntityBuilder { * This method defines a string property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * name: model.text(), @@ -173,7 +173,7 @@ export class EntityBuilder { * This method defines a boolean property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * hasAccount: model.boolean(), @@ -192,7 +192,7 @@ export class EntityBuilder { * This method defines a number property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * age: model.number(), @@ -211,7 +211,7 @@ export class EntityBuilder { * This method defines a number property that expects large numbers, such as prices. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * price: model.bigNumber(), @@ -235,7 +235,7 @@ export class EntityBuilder { * This method defines an array of strings property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * names: model.array(), @@ -254,7 +254,7 @@ export class EntityBuilder { * This method defines a timestamp property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * date_of_birth: model.dateTime(), @@ -273,7 +273,7 @@ export class EntityBuilder { * This method defines a property whose value is a stringified JSON object. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * metadata: model.json(), @@ -296,7 +296,7 @@ export class EntityBuilder { * @param {Values[]} values - An array of possible values. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * color: model.enum(["black", "white"]), @@ -328,7 +328,7 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const User = model.define("user", { * id: model.id(), @@ -353,6 +353,8 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example + * import { model } from "@medusajs/framework/utils" + * * const Product = model.define("product", { * id: model.id(), * store: model.belongsTo(() => Store, { @@ -380,7 +382,7 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Store = model.define("store", { * id: model.id(), @@ -407,7 +409,7 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Order = model.define("order", { * id: model.id(), diff --git a/packages/core/utils/src/dml/entity.ts b/packages/core/utils/src/dml/entity.ts index 233937a1bcc80..ab0f4931be9f7 100644 --- a/packages/core/utils/src/dml/entity.ts +++ b/packages/core/utils/src/dml/entity.ts @@ -117,7 +117,7 @@ export class DmlEntity< * action should be cascaded to. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Store = model.define("store", { * id: model.id(), @@ -162,7 +162,7 @@ export class DmlEntity< * An example of a simple index: * * ```ts - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -180,7 +180,7 @@ export class DmlEntity< * To add a condition on the index, use the `where` option: * * ```ts - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -201,7 +201,7 @@ export class DmlEntity< * The condition can also be a negation. For example: * * ```ts - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), diff --git a/packages/core/utils/src/dml/properties/base.ts b/packages/core/utils/src/dml/properties/base.ts index 189cd0fff26e8..e108b2d22679a 100644 --- a/packages/core/utils/src/dml/properties/base.ts +++ b/packages/core/utils/src/dml/properties/base.ts @@ -33,7 +33,7 @@ export abstract class BaseProperty implements PropertyType { * This method indicates that a property's value can be `null`. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * price: model.bigNumber().nullable(), @@ -55,7 +55,7 @@ export abstract class BaseProperty implements PropertyType { * Medusa generates the name. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -81,7 +81,7 @@ export abstract class BaseProperty implements PropertyType { * Medusa generates the name. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const User = model.define("user", { * email: model.text().unique(), @@ -103,7 +103,7 @@ export abstract class BaseProperty implements PropertyType { * @param {T} value - The default value. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * color: model diff --git a/packages/core/utils/src/dml/properties/id.ts b/packages/core/utils/src/dml/properties/id.ts index c836972239e7c..a2d7bbf30d40f 100644 --- a/packages/core/utils/src/dml/properties/id.ts +++ b/packages/core/utils/src/dml/properties/id.ts @@ -33,7 +33,7 @@ export class IdProperty extends BaseProperty { * This method indicates that the property is the data model's primary key. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Product = model.define("Product", { * id: model.id().primaryKey(), diff --git a/packages/core/utils/src/dml/properties/number.ts b/packages/core/utils/src/dml/properties/number.ts index f8c8fc149084f..a541bd3783224 100644 --- a/packages/core/utils/src/dml/properties/number.ts +++ b/packages/core/utils/src/dml/properties/number.ts @@ -11,6 +11,21 @@ export class NumberProperty extends BaseProperty { options: {} } + /** + * This method indicates that the property is the data model's primary key. + * + * @example + * import { model } from "@medusajs/framework/utils" + * + * const Product = model.define("Product", { + * code: model.number().primaryKey(), + * // ... + * }) + * + * export default Product + * + * @customNamespace Property Configuration Methods + */ primaryKey() { return new PrimaryKeyModifier(this) } diff --git a/packages/core/utils/src/dml/properties/text.ts b/packages/core/utils/src/dml/properties/text.ts index f329d348e164a..a86d0695fc301 100644 --- a/packages/core/utils/src/dml/properties/text.ts +++ b/packages/core/utils/src/dml/properties/text.ts @@ -22,7 +22,7 @@ export class TextProperty extends BaseProperty { * This method indicates that the property is the data model's primary key. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Product = model.define("Product", { * code: model.text().primaryKey(), @@ -41,7 +41,7 @@ export class TextProperty extends BaseProperty { * This method indicates that a text property is searchable. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * name: model.text().searchable(), diff --git a/packages/core/utils/src/file/abstract-file-provider.ts b/packages/core/utils/src/file/abstract-file-provider.ts index 51e0d9471186e..26c3a0d62b877 100644 --- a/packages/core/utils/src/file/abstract-file-provider.ts +++ b/packages/core/utils/src/file/abstract-file-provider.ts @@ -11,8 +11,8 @@ import { FileTypes, IFileProvider } from "@medusajs/types" * #### Example * * ```ts - * import { Logger } from "@medusajs/types" - * import { AbstractFileProviderService } from "@medusajs/utils" + * import { Logger } from "@medusajs/framework/types" + * import { AbstractFileProviderService } from "@medusajs/framework/utils" * * type InjectedDependencies = { * logger: Logger diff --git a/packages/core/utils/src/notification/abstract-notification-provider.ts b/packages/core/utils/src/notification/abstract-notification-provider.ts index 50e9ada76b46b..ec0e9cc190257 100644 --- a/packages/core/utils/src/notification/abstract-notification-provider.ts +++ b/packages/core/utils/src/notification/abstract-notification-provider.ts @@ -11,8 +11,8 @@ import { INotificationProvider, NotificationTypes } from "@medusajs/types" * #### Example * * ```ts - * import { AbstractNotificationProviderService } from "@medusajs/utils" - * import { Logger } from "@medusajs/types" + * import { AbstractNotificationProviderService } from "@medusajs/framework/utils" + * import { Logger } from "@medusajs/framework/types" * * type InjectedDependencies = { * logger: Logger @@ -67,7 +67,7 @@ export class AbstractNotificationProviderService * import { * ProviderSendNotificationDTO, * ProviderSendNotificationResultsDTO - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * class MyNotificationProviderService extends AbstractNotificationProviderService { * // ... diff --git a/packages/core/utils/src/payment/abstract-payment-provider.ts b/packages/core/utils/src/payment/abstract-payment-provider.ts index 652ff1f5f45d0..9715aa04d6f7e 100644 --- a/packages/core/utils/src/payment/abstract-payment-provider.ts +++ b/packages/core/utils/src/payment/abstract-payment-provider.ts @@ -34,8 +34,8 @@ export abstract class AbstractPaymentProvider> * ```ts * import { * AbstractPaymentProvider - * } from "@medusajs/utils" - * import { Logger } from "@medusajs/types" + * } from "@medusajs/framework/utils" + * import { Logger } from "@medusajs/framework/types" * * type InjectedDependencies = { * logger: Logger @@ -138,7 +138,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * class MyPaymentProviderService extends AbstractPaymentProvider< * Options @@ -193,7 +193,7 @@ export abstract class AbstractPaymentProvider> * PaymentProviderError, * PaymentProviderSessionResponse, * PaymentSessionStatus - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -261,7 +261,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -303,7 +303,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -359,7 +359,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -401,7 +401,7 @@ export abstract class AbstractPaymentProvider> * // other imports... * import { * PaymentSessionStatus - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -450,7 +450,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -503,7 +503,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -547,7 +547,7 @@ export abstract class AbstractPaymentProvider> * UpdatePaymentProviderSession, * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -610,11 +610,11 @@ export abstract class AbstractPaymentProvider> * // other imports... * import { * BigNumber - * } from "@medusajs/utils" + * } from "@medusajs/framework/utils" * import { * ProviderWebhookPayload, * WebhookActionResult - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< diff --git a/packages/core/workflows-sdk/src/utils/composer/create-hook.ts b/packages/core/workflows-sdk/src/utils/composer/create-hook.ts index f5fcb0b77558d..8b290944c3910 100644 --- a/packages/core/workflows-sdk/src/utils/composer/create-hook.ts +++ b/packages/core/workflows-sdk/src/utils/composer/create-hook.ts @@ -35,7 +35,7 @@ export type Hook = { * createHook, * createWorkflow, * WorkflowResponse, - * } from "@medusajs/workflows-sdk" + * } from "@medusajs/framework/workflows-sdk" * import { createProductStep } from "./steps/create-product" * * export const myWorkflow = createWorkflow( diff --git a/packages/core/workflows-sdk/src/utils/composer/create-step.ts b/packages/core/workflows-sdk/src/utils/composer/create-step.ts index 2aaf0d04da5b1..def2b1ad86a0e 100644 --- a/packages/core/workflows-sdk/src/utils/composer/create-step.ts +++ b/packages/core/workflows-sdk/src/utils/composer/create-step.ts @@ -311,10 +311,8 @@ function wrapConditionalStep( * @example * import { * createStep, - * StepResponse, - * StepExecutionContext, - * WorkflowData - * } from "@medusajs/workflows-sdk" + * StepResponse + * } from "@medusajs/framework/workflows-sdk" * * interface CreateProductInput { * title: string diff --git a/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts b/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts index 8e11efa2ac61f..970dc6046434a 100644 --- a/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts +++ b/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts @@ -34,8 +34,11 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null * @returns The created workflow. You can later execute the workflow by invoking it, then using its `run` method. * * @example - * import { createWorkflow } from "@medusajs/workflows-sdk" - * import { MedusaRequest, MedusaResponse, Product } from "@medusajs/medusa" + * import { + * createWorkflow, + * WorkflowResponse + * } from "@medusajs/framework/workflows-sdk" + * import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" * import { * createProductStep, * getProductStep, @@ -46,16 +49,15 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null * title: string * } * - * const myWorkflow = createWorkflow< - * WorkflowInput, - * Product - * >("my-workflow", (input) => { + * const myWorkflow = createWorkflow( + * "my-workflow", + * (input: WorkflowInput) => { * // Everything here will be executed and resolved later * // during the execution. Including the data access. * * const product = createProductStep(input) * const prices = createPricesStep(product) - * return getProductStep(product.id) + * return new WorkflowResponse(getProductStep(product.id)) * } * ) * diff --git a/packages/core/workflows-sdk/src/utils/composer/parallelize.ts b/packages/core/workflows-sdk/src/utils/composer/parallelize.ts index f9ab8df14947e..dc6b6dd6de7cd 100644 --- a/packages/core/workflows-sdk/src/utils/composer/parallelize.ts +++ b/packages/core/workflows-sdk/src/utils/composer/parallelize.ts @@ -11,8 +11,9 @@ import { OrchestrationUtils } from "@medusajs/utils" * @example * import { * createWorkflow, - * parallelize - * } from "@medusajs/workflows-sdk" + * parallelize, + * WorkflowResponse + * } from "@medusajs/framework/workflows-sdk" * import { * createProductStep, * getProductStep, @@ -24,10 +25,9 @@ import { OrchestrationUtils } from "@medusajs/utils" * title: string * } * - * const myWorkflow = createWorkflow< - * WorkflowInput, - * Product - * >("my-workflow", (input) => { + * const myWorkflow = createWorkflow( + * "my-workflow", + * (input: WorkflowInput) => { * const product = createProductStep(input) * * const [prices, productSalesChannel] = parallelize( @@ -36,7 +36,7 @@ import { OrchestrationUtils } from "@medusajs/utils" * ) * * const id = product.id - * return getProductStep(product.id) + * return new WorkflowResponse(getProductStep(product.id)) * } * ) */ diff --git a/packages/core/workflows-sdk/src/utils/composer/transform.ts b/packages/core/workflows-sdk/src/utils/composer/transform.ts index 0b7020e63091c..0369a4ddfbdeb 100644 --- a/packages/core/workflows-sdk/src/utils/composer/transform.ts +++ b/packages/core/workflows-sdk/src/utils/composer/transform.ts @@ -30,32 +30,27 @@ type Func = (input: T, context: StepExecutionContext) => U | Promise * @example * import { * createWorkflow, - * transform - * } from "@medusajs/workflows-sdk" + * transform, + * WorkflowResponse + * } from "@medusajs/framework/workflows-sdk" * import { step1, step2 } from "./steps" * * type WorkflowInput = { * name: string * } * - * type WorkflowOutput = { - * message: string - * } - * - * const myWorkflow = createWorkflow< - * WorkflowInput, - * WorkflowOutput - * > - * ("hello-world", (input) => { + * const myWorkflow = createWorkflow( + * "hello-world", + * (input: WorkflowInput) => { * const str1 = step1(input) * const str2 = step2(input) * - * return transform({ + * const message = transform({ * str1, * str2 - * }, (input) => ({ - * message: `${input.str1}${input.str2}` - * })) + * }, (input) => `${input.str1}${input.str2}`) + * + * return new WorkflowResponse(message) * }) */ // prettier-ignore From 9bd99df545f04f7b8106baaf0da06070994ba7bb Mon Sep 17 00:00:00 2001 From: arun-prasath2005 <84761066+arun-prasath2005@users.noreply.github.com> Date: Tue, 1 Oct 2024 15:16:45 +0530 Subject: [PATCH 5/9] Update page.mdx (#9366) Spelling issue with perform, Fixed it! --- .../app/customization/integrate-systems/schedule-task/page.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx b/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx index 8e8ae9515e51f..375c1b3a00484 100644 --- a/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx +++ b/www/apps/book/app/customization/integrate-systems/schedule-task/page.mdx @@ -206,7 +206,7 @@ Next, you need to identify which brands must be created or updated. Since workflows are constructed internally and are only evaluated during execution, you can't access any data's value to perform data manipulation or checks. -Instead, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`, which gives you access to the real-time values of the data to perfrom actions on them. +Instead, use the `transform` utility function imported from `@medusajs/framework/workflows-sdk`, which gives you access to the real-time values of the data to perform actions on them. So, replace the `TODO` with the following: From 1ad7e7583ff9f723d16fc0de38201da13e3ef302 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 1 Oct 2024 12:49:37 +0300 Subject: [PATCH 6/9] docs: fix imports from dist (#9401) --- .../app/advanced-development/api-routes/validation/page.mdx | 2 +- .../app/recipes/digital-products/examples/standard/page.mdx | 6 +++--- .../marketplace/examples/restaurant-delivery/page.mdx | 2 +- .../app/recipes/marketplace/examples/vendors/page.mdx | 4 ++-- .../app/recipes/subscriptions/examples/standard/page.mdx | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/www/apps/book/app/advanced-development/api-routes/validation/page.mdx b/www/apps/book/app/advanced-development/api-routes/validation/page.mdx index 4a6d3e348992f..7dd7dab903ca6 100644 --- a/www/apps/book/app/advanced-development/api-routes/validation/page.mdx +++ b/www/apps/book/app/advanced-development/api-routes/validation/page.mdx @@ -49,7 +49,7 @@ For example, create the file `src/api/middlewares.ts` with the following content import { defineMiddlewares } from "@medusajs/medusa" import { validateAndTransformBody, -} from "@medusajs/medusa/dist/api/utils/validate-body" +} from "@medusajs/medusa/api/utils/validate-body" import { PostStoreCustomSchema } from "./custom/validators" export default defineMiddlewares({ diff --git a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx index ebae4b215e492..ea4681b00c4b0 100644 --- a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx @@ -667,7 +667,7 @@ The route handler imports a validation schema from a `validation-schema` file. S ```ts title="src/api/validation-schemas.ts" import { AdminCreateProduct, -} from "@medusajs/medusa/dist/api/admin/products/validators" +} from "@medusajs/medusa/api/admin/products/validators" import { z } from "zod" import { MediaType } from "../modules/digital-product/types" @@ -690,7 +690,7 @@ Finally, create the file `src/api/middlewares.ts` with the following content: import { defineMiddlewares } from "@medusajs/medusa" import { validateAndTransformBody, -} from "@medusajs/medusa/dist/api/utils/validate-body" +} from "@medusajs/medusa/api/utils/validate-body" import { createDigitalProductsSchema } from "./validation-schemas" export default defineMiddlewares({ @@ -2312,7 +2312,7 @@ In this section, you’ll customize the [Next.js Starter storefront](../../../.. In `src/types/global.ts`, add the following types that you’ll use in your customizations: ```ts title="src/types/global.ts" -import { BaseProductVariant } from "@medusajs/framework/types/dist/http/product/common" +import { BaseProductVariant } from "@medusajs/framework/types/http/product/common" // ... diff --git a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx index 5ad8e5bd8bb84..a67859514cf7a 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/restaurant-delivery/page.mdx @@ -1314,7 +1314,7 @@ Create the file `src/api/restaurants/[id]/products/route.ts` with the following import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" import { AdminCreateProduct, -} from "@medusajs/medusa/dist/api/admin/products/validators" +} from "@medusajs/medusa/api/admin/products/validators" import { z } from "zod" import { createRestaurantProductsWorkflow, diff --git a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx index 519334c72eba3..7ad2f00b15e0a 100644 --- a/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/examples/vendors/page.mdx @@ -712,10 +712,10 @@ import { } from "@medusajs/medusa" import { validateAndTransformBody, -} from "@medusajs/medusa/dist/api/utils/validate-body" +} from "@medusajs/medusa/api/utils/validate-body" import { AdminCreateProduct, -} from "@medusajs/medusa/dist/api/admin/products/validators" +} from "@medusajs/medusa/api/admin/products/validators" export default defineMiddlewares({ routes: [ diff --git a/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx b/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx index 6d1feaeeb0b67..21aa32767044b 100644 --- a/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/subscriptions/examples/standard/page.mdx @@ -1765,10 +1765,10 @@ import { } from "../../modules/subscription/types" import { authorizePaymentSessionStep, -} from "@medusajs/medusa/core-flows/dist/payment/steps/authorize-payment-session" +} from "@medusajs/medusa/core-flows" import { createPaymentCollectionsStep, -} from "@medusajs/medusa/core-flows/dist/cart/steps/create-payment-collection" +} from "@medusajs/medusa/core-flows" import createSubscriptionOrderStep from "./steps/create-subscription-order" import updateSubscriptionStep from "./steps/update-subscription" From fb67d90b64adc00a7ceefce57108d623b664c90b Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 1 Oct 2024 14:20:54 +0300 Subject: [PATCH 7/9] docs: improvements + additions to module docs (#9152) - Split Module and Module Links to their own chapters - Add new docs on db operations and transactions in modules, multiple services, links with custom columns, etc... - Added a list of registered dependencies in a module container --- .../module-links/custom-columns/page.mdx | 174 +++++++ .../directions}/page.mdx | 2 +- .../{modules => }/module-links/page.mdx | 68 ++- .../{modules => module-links}/query/page.mdx | 0 .../remote-link/page.mdx | 0 .../modules/container/page.mdx | 8 +- .../modules/db-operations/page.mdx | 464 ++++++++++++++++++ .../modules/isolation/page.mdx | 95 +++- .../modules/multiple-services/page.mdx | 130 +++++ .../modules/options/page.mdx | 2 - .../app/advanced-development/modules/page.mdx | 15 + .../modules/service-constraints/page.mdx | 8 +- .../modules/service-factory/page.mdx | 4 +- .../app/basics/modules-and-services/page.mdx | 13 +- .../book/app/more-resources/examples/page.mdx | 2 +- www/apps/book/generated/edit-dates.mjs | 9 +- www/apps/book/next.config.mjs | 22 +- www/apps/book/sidebar.mjs | 38 +- .../product/guides/price/page.mdx | 2 +- .../app/medusa-container-resources/page.mdx | 140 +++++- .../examples/standard/page.mdx | 8 +- .../app/recipes/digital-products/page.mdx | 6 +- .../examples/restaurant-delivery/page.mdx | 4 +- .../marketplace/examples/vendors/page.mdx | 8 +- .../app/recipes/marketplace/page.mdx | 2 +- .../subscriptions/examples/standard/page.mdx | 4 +- .../app/recipes/subscriptions/page.mdx | 2 +- .../methods/list/page.mdx | 2 +- .../methods/listAndCount/page.mdx | 2 +- .../methods/retrieve/page.mdx | 2 +- www/apps/resources/generated/sidebar.mjs | 2 +- www/apps/resources/sidebar.mjs | 2 +- 32 files changed, 1138 insertions(+), 102 deletions(-) create mode 100644 www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx rename www/apps/book/app/advanced-development/{modules/module-link-directions => module-links/directions}/page.mdx (93%) rename www/apps/book/app/advanced-development/{modules => }/module-links/page.mdx (75%) rename www/apps/book/app/advanced-development/{modules => module-links}/query/page.mdx (100%) rename www/apps/book/app/advanced-development/{modules => module-links}/remote-link/page.mdx (100%) create mode 100644 www/apps/book/app/advanced-development/modules/db-operations/page.mdx create mode 100644 www/apps/book/app/advanced-development/modules/multiple-services/page.mdx create mode 100644 www/apps/book/app/advanced-development/modules/page.mdx diff --git a/www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx b/www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx new file mode 100644 index 0000000000000..802f20b3a380b --- /dev/null +++ b/www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx @@ -0,0 +1,174 @@ +export const metadata = { + title: `${pageNumber} Add Columns to a Link`, +} + +# {metadata.title} + +In this chapter, you'll learn how to add custom columns to a link definition and manage them. + +## How to Add Custom Columns to a Link's Table? + +The `defineLink` function used to define a link accepts a third paramter, which is an object of options. + +To add custom columns to a link's table, pass in the third parameter of `defineLink` a `database` property: + +export const linkHighlights = [ + ["10", "extraColumns", "Custom columns to add to the created link's table."], + ["11", "metadata", "The column's name."], + ["12", "type", "The column's type."] +] + +```ts highlights={linkHighlights} +import HelloModule from "../modules/hello" +import ProductModule from "@medusajs/medusa/product" +import { defineLink } from "@medusajs/framework/utils" + +export default defineLink( + ProductModule.linkable.product, + HelloModule.linkable.myCustom, + { + database: { + extraColumns: { + metadata: { + type: "json", + } + } + } + } +) +``` + +This adds to the table created for the link between `product` and `myCustom` a `metadata` column of type `json`. + +### Database Options + +The `database` property defines configuration for the table created in the database. + +Its `extraColumns` property defines custom columns to create in the link's table. + +`extraColumns`'s value is an object whose keys are the names of the columns, and values are the column's configurations as an object. + +### Column Configurations + +The column's configurations object accepts the following properties: + +- `type`: The column's type. Possible values are: + - `string` + - `text` + - `integer` + - `boolean` + - `date` + - `time` + - `datetime` + - `enum` + - `json` + - `array` + - `enumArray` + - `float` + - `double` + - `decimal` + - `bigint` + - `mediumint` + - `smallint` + - `tinyint` + - `blob` + - `uuid` + - `uint8array` +- `defaultValue`: The column's default value. +- `nullable`: Whether the column can have `null` values. + +--- + +## Set Custom Column when Creating Link + +The object you pass to the remote link's `create` method accepts a `data` property. Its value is an object whose keys are custom column names, and values are the value of the custom column for this link. + +For example: + + + +Learn more about the remote link, how to resolve it, and its methods in [this chapter](../remote-link/page.mdx). + + + +```ts +await remoteLink.create({ + [Modules.PRODUCT]: { + product_id: "123" + }, + HELLO_MODULE: { + my_custom_id: "321" + }, + data: { + metadata: { + test: true + } + } +}) +``` + +--- + +## Retrieve Custom Column with Link + +To retrieve linked records with their custom columns, use Query and pass the link definition as the `entity` property's value. + +For example: + + + +Learn more about Query and how to resolve use it [this chapter](../remote-link/page.mdx). + + + +export const retrieveHighlights = [ + ["1", "productHelloLink", "Import the exported link definition."], + ["6", "entity", "Pass the link definition to retrieve its data."], + ["7", `"metadata"`, "Retrieve the `metadata` column."], + ["7", `"product.*"`, "Retrieve the linked product's details."], + ["7", `"my_custom.*"`, "Retrieve the linked `myCustom` record's details."], +] + +```ts highlights={retrieveHighlights} +import productHelloLink from "../links/product-hello" + +// ... + +const { data } = await query.graph({ + entity: productHelloLink.entryPoint, + fields: ["metadata", "product.*", "my_custom.*"], + filters: { + product_id: "prod_123" + } +}) +``` + +This retrieves the product of id `prod_123` and its linked `my_custom` records. + +In the `fields` array you pass `metadata`, which is the custom column to retrieve of the link. + +--- + +## Update Custom Column's Value + +The remote link's `create` method updates a link's data if the link between the specified records already exists. + +So, to update the value of a custom column in a created link, use the `create` method again passing it a new value for the custom column. + +For example: + +```ts +await remoteLink.create({ + [Modules.PRODUCT]: { + product_id: "123" + }, + HELLO_MODULE: { + my_custom_id: "321" + }, + data: { + metadata: { + test: false + } + } +}) +``` diff --git a/www/apps/book/app/advanced-development/modules/module-link-directions/page.mdx b/www/apps/book/app/advanced-development/module-links/directions/page.mdx similarity index 93% rename from www/apps/book/app/advanced-development/modules/module-link-directions/page.mdx rename to www/apps/book/app/advanced-development/module-links/directions/page.mdx index 722abeda0ebe6..b6ba91df6c299 100644 --- a/www/apps/book/app/advanced-development/modules/module-link-directions/page.mdx +++ b/www/apps/book/app/advanced-development/module-links/directions/page.mdx @@ -4,7 +4,7 @@ export const metadata = { # {metadata.title} -In this chapter, you'll learn about difference in module link directions, and which to use based on your use case. +In this chapter, you'll learn about the difference in module link directions, and which to use based on your use case. ## Link Direction diff --git a/www/apps/book/app/advanced-development/modules/module-links/page.mdx b/www/apps/book/app/advanced-development/module-links/page.mdx similarity index 75% rename from www/apps/book/app/advanced-development/modules/module-links/page.mdx rename to www/apps/book/app/advanced-development/module-links/page.mdx index 8f9690bc1ce11..02d7e3fa865ae 100644 --- a/www/apps/book/app/advanced-development/modules/module-links/page.mdx +++ b/www/apps/book/app/advanced-development/module-links/page.mdx @@ -1,30 +1,16 @@ -import { BetaBadge } from "docs-ui" - export const metadata = { title: `${pageNumber} Module Link`, } -# {metadata.title} +# {metadata.title} In this chapter, you’ll learn what a module link is. ## What is a Module Link? -A module link forms an association between two data models of different modules, while maintaining module isolation. - -You can then retrieve data across the linked modules, and manage their linked records. - - - -You want to create a relation between data models from different modules. +Since modules are isolated, you can't access another module's data models to add a relation to it or extend it. - - - - -You want to create a relationship between data models in the same module. Use data model relationships instead. - - +Instead, you use a module link. A module link forms an association between two data models of different modules, while maintaining module isolation. --- @@ -58,12 +44,14 @@ In this example, you define a module link between the `hello` module's `MyCustom ### 2. Sync Links -Medusa stores links as pivot tables in the database. So, to reflect your link in the database, run the `db:sync-links` command: +After defining the link, run the `db:sync-links` command: ```bash npx medusa db:sync-links ``` +The Medusa application creates a new table for your link to store the IDs of linked records. + Use this command whenever you make changes to your links. For example, run this command if you remove your link definition file. @@ -74,6 +62,33 @@ You can also use the `db:migrate` command, which both runs the migrations and sy --- +## How Module Links Work? + +When you define a module link, the Medusa application creates a table in the database for that link. + +Then, when you create links between records of the data models, the IDs of these data models are stored as a new record in the link's table. + +![Diagram illustration for links](https://res.cloudinary.com/dza7lstvk/image/upload/v1726482168/Medusa%20Book/Custom_Link_Illustration_fsisfa.jpg) + +--- + +## When to Use Module Links + + + +- You want to create a relation between data models from different modules. +- You want to extend the data model of another module. + + + + + +You want to create a relationship between data models in the same module. Use data model relationships instead. + + + +--- + ## Define a List Link By default, the defined link establishes a one-to-one relation: a record of a data model is linked to one record of the other data model. @@ -105,23 +120,6 @@ In this example, a record of `product` can be linked to more than one record of --- -## Extend Data Models with Module Links - -Module links are most useful when you want to add properties to a data model of another module. - -For example, to add custom properties to the `Product` data model of the Product Module, you: - -1. Create a module. -2. Create in the module a data model that holds the custom properties you want to add to the `Product` data model. -2. Define a module link that links your module to the Product Module. - -Then, in the next chapters, you'll learn how to: - -- Link each product to a record of your data model. -- Retrieve your data model's properties when you retrieve products. - ---- - ## Set Delete Cascades on Link To enable delete cascade on a link so that when a record is deleted, its linked records are also deleted, pass the `deleteCascades` property in the object passed to `defineLink`. diff --git a/www/apps/book/app/advanced-development/modules/query/page.mdx b/www/apps/book/app/advanced-development/module-links/query/page.mdx similarity index 100% rename from www/apps/book/app/advanced-development/modules/query/page.mdx rename to www/apps/book/app/advanced-development/module-links/query/page.mdx diff --git a/www/apps/book/app/advanced-development/modules/remote-link/page.mdx b/www/apps/book/app/advanced-development/module-links/remote-link/page.mdx similarity index 100% rename from www/apps/book/app/advanced-development/modules/remote-link/page.mdx rename to www/apps/book/app/advanced-development/module-links/remote-link/page.mdx diff --git a/www/apps/book/app/advanced-development/modules/container/page.mdx b/www/apps/book/app/advanced-development/modules/container/page.mdx index 61c03c7b3f31c..e87f30f38501a 100644 --- a/www/apps/book/app/advanced-development/modules/container/page.mdx +++ b/www/apps/book/app/advanced-development/modules/container/page.mdx @@ -8,11 +8,13 @@ In this chapter, you'll learn about the module's container and how to resolve re ## Module's Container -Each module has a local container only used by the resources of that module. +Since modules are isolated, each module has a local container only used by the resources of that module. -So, resources in the module, such as services or loaders, can only resolve other resources registered in the module's container, such as: +So, resources in the module, such as services or loaders, can only resolve other resources registered in the module's container. -- `logger`: A utility to log message in the Medusa application's logs. +### List of Registered Resources + +Find a list of resources or dependencies registered in a module's container in [this Learning Resources reference](!resoures!/medusa-container-resources). --- diff --git a/www/apps/book/app/advanced-development/modules/db-operations/page.mdx b/www/apps/book/app/advanced-development/modules/db-operations/page.mdx new file mode 100644 index 0000000000000..acb89f4d1eac0 --- /dev/null +++ b/www/apps/book/app/advanced-development/modules/db-operations/page.mdx @@ -0,0 +1,464 @@ +import { CodeTabs, CodeTab } from "docs-ui" + +export const metadata = { + title: `${pageNumber} Perform Database Operations in a Service`, +} + +# {metadata.title} + +In this chapter, you'll learn how to perform database operations in a module's service. + + + +This chapter is intended for more advanced database use-cases where you need more control over queries and operations. For basic database operations, such as creating or retrieving data of a model, use the [Service Factory](../service-factory/page.mdx) instead. + + + +## Run Queries + +[MikroORM's entity manager](https://mikro-orm.io/docs/entity-manager) is a class that has methods to run queries on the database and perform operations. + +Medusa provides an `InjectManager` decorator imported from `@medusajs/utils` that injects a service's method with a [forked entity manager](https://mikro-orm.io/docs/identity-map#forking-entity-manager). + +So, to run database queries in a service: + +1. Add the `InjectManager` decorator to the method. +2. Add as a last parameter an optional `sharedContext` parameter that has the `MedusaContext` decorator imported from `@medusajs/utils`. This context holds database-related context, including the manager injected by `InjectManager` + +For example, in your service, add the following methods: + +export const methodsHighlight = [ + ["4", "getCount", "Retrieves the number of records in `my_custom` using the `count` method."], + ["8", "getCountSql", "Retrieves the number of records in `my_custom` using the `execute` method."] +] + +```ts highlights={methodsHighlight} +// other imports... +import { + InjectManager, + MedusaContext +} from "@medusajs/framework/utils" + +class HelloModuleService { + // ... + + @InjectManager() + async getCount( + @MedusaContext() sharedContext?: Context + ): Promise { + return await sharedContext.manager.count("my_custom") + } + + @InjectManager() + async getCountSql( + @MedusaContext() sharedContext?: Context + ): Promise { + const data = await sharedContext.manager.execute( + "SELECT COUNT(*) as num FROM my_custom" + ) + + return parseInt(data[0].num) + } +} +``` + +You add two methods `getCount` and `getCountSql` that have the `InjectManager` decorator. Each of the methods also accept the `sharedContext` parameter which has the `MedusaContext` decorator. + +The entity manager is injected to the `sharedContext.manager` property, which is an instance of [EntityManager from the @mikro-orm/knex package](https://mikro-orm.io/api/5.9/knex/class/EntityManager). + +You use the manager in the `getCount` method to retrieve the number of records in a table, and in the `getCountSql` to run a PostgreSQL query that retrieves the count. + + + +Refer to [MikroORM's reference](https://mikro-orm.io/api/5.9/knex/class/EntityManager) for a full list of the entity manager's methods. + + + +--- + +## Execute Operations in Transactions + +To wrap database operations in a transaction, you create two methods: + +1. A private or protected method that's wrapped in a transaction. To wrap it in a transaction, you use the `InjectTransactionManager` decorator imported from `@medusajs/utils`. +2. A public method that calls the transactional method. You use on it the `InjectManager` decorator as explained in the previous section. + +Both methods must accept as a last parameter an optional `sharedContext` parameter that has the `MedusaContext` decorator imported from `@medusajs/utils`. It holds database-related contexts passed through the Medusa application. + +For example: + +export const opHighlights = [ + ["11", "InjectTransactionManager", "A decorator that injects the a transactional entity manager into the `sharedContext` parameter."], + ["17", "MedusaContext", "A decorator to use Medusa's shared context."], + ["20", "nativeUpdate", "Update a record."], + ["31", "execute", "Retrieve the updated record."], + ["38", "InjectManager", "A decorator that injects a forked entity manager into the context."], +] + +```ts highlights={opHighlights} +import { + InjectManager, + InjectTransactionManager, + MedusaContext +} from "@medusajs/framework/utils" +import { Context } from "@medusajs/framework/types" +import { EntityManager } from "@mikro-orm/knex" + +class HelloModuleService { + // ... + @InjectTransactionManager() + protected async update_( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ): Promise { + const transactionManager = sharedContext.transactionManager + await transactionManager.nativeUpdate( + "my_custom", + { + id: input.id + }, + { + name: input.name + } + ) + + // retrieve again + const updatedRecord = await transactionManager.execute( + `SELECT * FROM my_custom WHERE id = '${input.id}'` + ) + + return updatedRecord + } + + @InjectManager() + async update( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ) { + return await this.update_(input, sharedContext) + } +} +``` + +The `HelloModuleService` has two methods: + +- A protected `update_` that performs the database operations inside a transaction. +- A public `update` that executes the transactional protected method. + +The shared context's `transactionManager` property holds the transactional entity manager (injected by `InjectTransactionManager`) that you use to perform database operations. + + + +Refer to [MikroORM's reference](https://mikro-orm.io/api/5.9/knex/class/EntityManager) for a full list of the entity manager's methods. + + + +### Why Wrap a Transactional Method + +The variables in the transactional method (for example, `update_`) hold values that are uncomitted to the database. They're only committed once the method finishes execution. + +So, if in your method you perform database operations, then use their result to perform other actions, such as connect to a third-party service, you'll be working with uncommitted data. + +By placing only the database operations in a method that has the `InjectTransactionManager` and using it in a wrapper method, the wrapper method receives the committed result of the transactional method. + + + +This is also useful if you perform heavy data normalization outside of the database operations. In that case, you don't hold the transaction for a longer time than needed. + + + +For example, the `update` method could be changed to the following: + +```ts +// other imports... +import { EntityManager } from "@mikro-orm/knex" + +class HelloModuleService { + // ... + @InjectManager() + async update( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ) { + const newData = await this.update_(input, sharedContext) + + await sendNewDataToSystem(newData) + + return newData + } +} +``` +In this case, only the `update_` method is wrapped in a transaction. The returned value `newData` holds the committed result, which can be used for other operations, such as passed to a `sendNewDataToSystem` method. + +### Using Methods in Transactional Methods + +If your transactional method uses other methods that accept a Medusa context, pass the shared context to those method. + +For example: + +```ts +// other imports... +import { EntityManager } from "@mikro-orm/knex" + +class HelloModuleService { + // ... + @InjectTransactionManager() + protected async anotherMethod( + @MedusaContext() sharedContext?: Context + ) { + // ... + } + + @InjectTransactionManager() + protected async update_( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ): Promise { + anotherMethod(sharedContext) + } +} +``` + +You use the `anotherMethod` transactional method in the `update_` transactional method, so you pass it the shared context. + +The `anotherMethod` now runs in the same transaction as the `update_` method. + +--- + +## Configure Transactions + +To configure the transaction, such as its [isolation level](https://www.postgresql.org/docs/current/transaction-iso.html), use the `baseRepository` dependency registered in your module's container. + +The `baseRepository` is an instance of a repository class that provides methods to create transactions, run database operations, and more. + +The `baseRepository` has a `transaction` method that allows you to run a function within a transaction and configure that transaction. + +For example, resolve the `baseRepository` in your service's constructor: + + + + +```ts highlights={[["14"]]} +import { MedusaService } from "@medusajs/framework/utils" +import MyCustom from "./models/my-custom" +import { DAL } from "@medusajs/framework/types" + +type InjectedDependencies = { + baseRepository: DAL.RepositoryService +} + +class HelloModuleService extends MedusaService({ + MyCustom, +}){ + protected baseRepository_: DAL.RepositoryService + + constructor({ baseRepository }: InjectedDependencies) { + super(...arguments) + this.baseRepository_ = baseRepository + } +} + +export default HelloModuleService +``` + + + +```ts highlights={[["10"]]} +import { DAL } from "@medusajs/framework/types" + +type InjectedDependencies = { + baseRepository: DAL.RepositoryService +} + +class HelloModuleService { + protected baseRepository_: DAL.RepositoryService + + constructor({ manager }: InjectedDependencies) { + this.baseRepository_ = baseRepository + } +} + +export default HelloModuleService +``` + + + + +Then, add the following method that uses it: + +export const repoHighlights = [ + ["20", "transaction", "Wrap the function parameter in a transaction."] +] + +```ts highlights={repoHighlights} +// ... +import { + InjectManager, + InjectTransactionManager, + MedusaContext +} from "@medusajs/framework/utils" +import { Context } from "@medusajs/framework/types" +import { EntityManager } from "@mikro-orm/knex" + +class HelloModuleService { + // ... + @InjectTransactionManager() + protected async update_( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ): Promise { + return await this.baseRepository_.transaction( + async (transactionManager) => { + await transactionManager.nativeUpdate( + "my_custom", + { + id: input.id + }, + { + name: input.name + } + ) + + // retrieve again + const updatedRecord = await transactionManager.execute( + `SELECT * FROM my_custom WHERE id = '${input.id}'` + ) + + return updatedRecord + }, + { + transaction: sharedContext.transactionManager + } + ) + } + + @InjectManager() + async update( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ) { + return await this.update_(input, sharedContext) + } +} +``` + +The `update_` method uses the `baseRepository_.transaction` method to wrap a function in a transaction. + +The function parameter receives a transactional entity manager as a parameter. Use it to perform the database operations. + +The `baseRepository_.transaction` method also receives as a second parameter an object of options. You must pass in it the `transaction` property and set its value to the `sharedContext.transactionManager` property so that the function wrapped in the transaction uses the injected transaction manager. + + + +Refer to [MikroORM's reference](https://mikro-orm.io/api/5.9/knex/class/EntityManager) for a full list of the entity manager's methods. + + + +### Transaction Options + +The second parameter of the `baseRepository_.transaction` method is an object of options that accepts the following properties: + +1. `transaction`: Set the transactional entity manager passed to the function. You must provide this option as explained in the previous section. + +```ts highlights={[["16"]]} +// other imports... +import { EntityManager } from "@mikro-orm/knex" + +class HelloModuleService { + // ... + @InjectTransactionManager() + async update_( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ): Promise { + return await this.baseRepository_.transaction( + async (transactionManager) => { + // ... + }, + { + transaction: sharedContext.transactionManager + } + ) + } +} +``` + +2. `isolationLevel`: Sets the transaction's [isolation level](https://www.postgresql.org/docs/current/transaction-iso.html). Its values can be: + - `read committed` + - `read uncommitted` + - `snapshot` + - `repeatable read` + - `serializable` + +```ts highlights={[["19"]]} +// other imports... +import { IsolationLevel } from "@mikro-orm/core" + +class HelloModuleService { + // ... + @InjectTransactionManager() + async update_( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ): Promise { + return await this.baseRepository_.transaction( + async (transactionManager) => { + // ... + }, + { + isolationLevel: IsolationLevel.READ_COMMITTED + } + ) + } +} +``` + +3. `enableNestedTransactions`: (default: `false`) whether to allow using nested transactions. + - If `transaction` is provided and this is disabled, the manager in `transaction` is re-used. + +```ts highlights={[["16"]]} +class HelloModuleService { + // ... + @InjectTransactionManager() + async update_( + input: { + id: string, + name: string + }, + @MedusaContext() sharedContext?: Context + ): Promise { + return await this.baseRepository_.transaction( + async (transactionManager) => { + // ... + }, + { + enableNestedTransactions: false + } + ) + } +} +``` diff --git a/www/apps/book/app/advanced-development/modules/isolation/page.mdx b/www/apps/book/app/advanced-development/modules/isolation/page.mdx index 634b10346b5ab..46cc9cfc9fb22 100644 --- a/www/apps/book/app/advanced-development/modules/isolation/page.mdx +++ b/www/apps/book/app/advanced-development/modules/isolation/page.mdx @@ -8,8 +8,8 @@ In this chapter, you'll learn how modules are isolated, and what that means for -- Modules can't access resources, such as services, from other modules. -- You can use Medusa's tools, as explained in the next chapters, to extend a modules' features or implement features across modules. +- Modules can't access resources, such as services or data models, from other modules. +- Use Medusa's linking concepts, as explained in the [Module Links chapters](../../module-links/page.mdx), to extend a module's data models and retrieve data across modules. @@ -21,12 +21,93 @@ For example, your custom module can't resolve the Product Module's main service --- -## How to Implement Custom Features Across Modules? +## Why are Modules Isolated -In your Medusa application, you want to implement features that span across modules, or you want to extend an existing module's features and customize them for your own use case. +Some of the module isolation's benefits include: -For example, you want to extend the Product Module to add new properties to the `Product` data model. +- Integrate your module into any Medusa application without side-effects to your setup. +- Replace existing modules with your custom implementation, if your use case is drastically different. +- Use modules in other environments, such as Edge functions and Next.js apps. -Medusa provides the tools to implement these use cases while maintaining isolation between modules. +--- + +## How to Extend Data Model of Another Module? + +To extend the data model of another module, such as the `product` data model of the Product Module, use Medusa's linking concepts as explained in the [Module Links chapters](../../module-links/page.mdx). + +--- + +## How to Use Services of Other Modules? + +If you're building a feature that uses functionalities from different modules, use a workflow whose steps resolve the modules' services to perform these functionalities. + +Workflows ensure data consistency through their roll-back mechanism and tracking of each execution's status, steps, input, and output. + +### Example + +For example, consider you have two modules: + +1. A module that stores and manages brands in your application. +2. A module that integrates a third-party Content Management System (CMS). + +To sync brands from your application to the third-party system, create the following steps: + +export const stepsHighlights = [ + ["1", "retrieveBrandsStep", "A step that retrieves brands using a brand module."], + ["14", "createBrandsInCmsStep", "A step that creates brands using a CMS module."], + ["25", "", "Add a compensation function to the step if an error occurs."] +] + +```ts title="Example Steps" highlights={stepsHighlights} +const retrieveBrandsStep = createStep( + "retrieve-brands", + async (_, { container }) => { + const brandModuleService = container.resolve( + "brandModuleService" + ) + + const brands = await brandModuleService.listBrands() + + return new StepResponse(brands) + } +) + +const createBrandsInCmsStep = createStep( + "create-brands-in-cms", + async ({ brands }, { container }) => { + const cmsModuleService = container.resolve( + "cmsModuleService" + ) + + const cmsBrands = await cmsModuleService.createBrands(brands) + + return new StepResponse(cmsBrands, cmsBrands) + }, + async (brands, { container }) => { + const cmsModuleService = container.resolve( + "cmsModuleService" + ) + + await cmsModuleService.deleteBrands( + brands.map((brand) => brand.id) + ) + } +) +``` + +The `retrieveBrandsStep` retrieves the brands from a brand module, and the `createBrandsInCmsStep` creates the brands in a third-party system using a CMS module. + +Then, create the following workflow that uses these steps: + +```ts title="Example Workflow" +export const syncBrandsWorkflow = createWorkflow( + "sync-brands", + () => { + const brands = retrieveBrandsStep() + + updateBrandsInCmsStep({ brands }) + } +) +``` -The next chapters explain these tools and how to use them in your custom development. +You can then use this workflow in an API route, scheduled job, or other resources that use this functionality. diff --git a/www/apps/book/app/advanced-development/modules/multiple-services/page.mdx b/www/apps/book/app/advanced-development/modules/multiple-services/page.mdx new file mode 100644 index 0000000000000..ed4cf770f09b8 --- /dev/null +++ b/www/apps/book/app/advanced-development/modules/multiple-services/page.mdx @@ -0,0 +1,130 @@ +export const metadata = { + title: `${pageNumber} Multiple Services in a Module`, +} + +# {metadata.title} + +In this chapter, you'll learn how to use multiple services in a module. + +## Module's Main and Internal Services + +A module has one main service only, which is the service exported in the module's definition. + +However, you may use other services in your module to better organize your code or split functionalities. These are called internal services that can be resolved within your module, but not in external resources. + +--- + +## How to Add an Internal Service + +### 1. Create Service + +To add an internal service, create it in the `services` directory of your module. + +For example, create the file `src/modules/hello/services/client.ts` with the following content: + +```ts title="src/modules/hello/services/client.ts" +export class ClientService { + async getMessage(): Promise { + return "Hello, World!" + } +} +``` + +### 2. Export Service in Index + +Next, create an `index.ts` file under the `services` directory of the module that exports your internal services. + +For example, create the file `src/modules/hello/services/index.ts` with the following content: + +```ts title="src/modules/hello/services/index.ts" +export * from "./client" +``` + +This exports the `ClientService`. + +### 3. Resolve Internal Service + +Internal services exported in the `services/index.ts` file of your module are now registered in the container and can be resolved in other services in the module as well as loaders. + +For example, in your main service: + +```ts title="src/modules/hello/service.ts" highlights={[["5"], ["13"]]} +// other imports... +import { ClientService } from "./services" + +type InjectedDependencies = { + clientService: ClientService +} + +class HelloModuleService extends MedusaService({ + MyCustom, +}){ + protected clientService_: ClientService + + constructor({ clientService }: InjectedDependencies) { + super(...arguments) + this.clientService_ = clientService + } +} +``` + +You can now use your internal service in your main service. + +--- + +## Resolve Resources in Internal Service + +Resolve dependencies from your module's container in the constructor of your internal service. + +For example: + +```ts +import { Logger } from "@medusajs/framework/types" + +type InjectedDependencies = { + logger: Logger +} + +export class ClientService { + protected logger_: Logger + + constructor({ logger }: InjectedDependencies) { + this.logger_ = logger + } +} +``` + +--- + +## Access Module Options + +Your internal service can't access the module's options. + +To retrieve the module's options, use the `configModule` registered in the module's container, which is the configurations in `medusa-config.js`. + +For example: + +```ts +import { ConfigModule } from "@medusajs/framework/types" +import { HELLO_MODULE } from ".." + +export type InjectedDependencies = { + configModule: ConfigModule +} + +export class ClientService { + protected options: Record + + constructor({ configModule }: InjectedDependencies) { + const moduleDef = configModule.modules[HELLO_MODULE] + + if (typeof moduleDef !== "boolean") { + this.options = moduleDef.options + } + } +} +``` + +The `configModule` has a `modules` property that includes all registered modules. Retrieve the module's configuration using its registration key. + +If its value is not a `boolean`, set the service's options to the module configuration's `options` property. diff --git a/www/apps/book/app/advanced-development/modules/options/page.mdx b/www/apps/book/app/advanced-development/modules/options/page.mdx index f76f39bd113d5..85131ff9b089a 100644 --- a/www/apps/book/app/advanced-development/modules/options/page.mdx +++ b/www/apps/book/app/advanced-development/modules/options/page.mdx @@ -1,5 +1,3 @@ -import { CodeTabs, CodeTab } from "docs-ui" - export const metadata = { title: `${pageNumber} Module Options`, } diff --git a/www/apps/book/app/advanced-development/modules/page.mdx b/www/apps/book/app/advanced-development/modules/page.mdx new file mode 100644 index 0000000000000..8811f4b9d4959 --- /dev/null +++ b/www/apps/book/app/advanced-development/modules/page.mdx @@ -0,0 +1,15 @@ +export const metadata = { + title: `${pageNumber} Modules Advanced Guides`, +} + +# {metadata.title} + +In the next chapters, you'll learn more about developing modules and related resources. + +By the end of this chapter, you'll know more about: + +1. A module's container and how a module is isolated. +2. Passing options to a module. +3. The service factory and the methods it generates. +4. Using a module's service to query and perform actions on the database. +5. Using multiple services in a module. diff --git a/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx b/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx index d4607c959b9f3..4bc4fb72f0217 100644 --- a/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx +++ b/www/apps/book/app/advanced-development/modules/service-constraints/page.mdx @@ -8,7 +8,13 @@ This chapter lists constraints to keep in mind when creating a service. ## Use Async Methods -Medusa wraps adds wrappers around your service's methods and executes them as async methods. +Medusa wraps service method executions to inject useful context or transactions. However, since Medusa can't detect whether the method is asynchronus, it always executes methods in the wrapper with the `await` keyword. + +For example, if you have a synchronous `getMessage` method, and you use it other resources like workflows, Medusa executes it as an async method: + +```ts +await helloModuleService.getMessage() +``` So, make sure your service's methods are always async to avoid unexpected errors or behavior. diff --git a/www/apps/book/app/advanced-development/modules/service-factory/page.mdx b/www/apps/book/app/advanced-development/modules/service-factory/page.mdx index b4d2dbfb833d8..ee2c1728509be 100644 --- a/www/apps/book/app/advanced-development/modules/service-factory/page.mdx +++ b/www/apps/book/app/advanced-development/modules/service-factory/page.mdx @@ -12,7 +12,7 @@ In this chapter, you’ll learn about what the service factory is and how to use Medusa provides a service factory that your module’s main service can extend. -The service factory generates data management methods for your data models, so you don't have to implement these methods manually. +The service factory generates data management methods for your data models in the database, so you don't have to implement these methods manually. @@ -54,7 +54,7 @@ In the example above, since the `HelloModuleService` extends `MedusaService`, it ### Generated Methods -The service factory generates data-management methods for each of the data models provided in the first parameter. +The service factory generates methods to manage the records of each of the data models provided in the first parameter in the database. The method's names are the operation's name, suffixed by the data model's key in the object parameter passed to `MedusaService`. diff --git a/www/apps/book/app/basics/modules-and-services/page.mdx b/www/apps/book/app/basics/modules-and-services/page.mdx index 568a7cb833c3d..68cc092b2f033 100644 --- a/www/apps/book/app/basics/modules-and-services/page.mdx +++ b/www/apps/book/app/basics/modules-and-services/page.mdx @@ -10,20 +10,12 @@ In this chapter, you’ll learn about modules, their main service, and how to cr A module is a package of reusable commerce or architectural functionalities. It's integrated as a building block in your Medusa application, without implications on the existing setup. -You create a module to introduce custom features, extend existing ones, or integrate third-party services. +A module has a service, which is a class that can connect to the database or third-party systems to provide custom features. The service's methods are then used by other resources, such as API routes. --- ## How to Create a Module? - - -1. Create module's main service. -2. Create module definition. -3. Add module to Medusa's configurations. - - - Modules are created in a sub-directory of `src/modules`. For example, create the directory `src/modules/hello`. @@ -154,7 +146,8 @@ You’ll receive the following response: -- You're implementing a custom commerce feature. For example, you're implementing digital products. +- You're adding new tables to the database, as explained in later chapters. +- You're integrating a third-party system for commerce or architectural features. - You want to re-use your custom commerce functionalities across Medusa applications or use them in other environments, such as Edge functions and Next.js apps. diff --git a/www/apps/book/app/more-resources/examples/page.mdx b/www/apps/book/app/more-resources/examples/page.mdx index 84b211d801f54..fff457caba245 100644 --- a/www/apps/book/app/more-resources/examples/page.mdx +++ b/www/apps/book/app/more-resources/examples/page.mdx @@ -16,7 +16,7 @@ This chapter provides links to example sections on different Medusa topics. - [Retrieve logged-in customer's details](../../advanced-development/api-routes/protected-routes/page.mdx#retrieve-logged-in-customers-details) - [Retrieve logged-in user's details](../../advanced-development/api-routes/protected-routes/page.mdx#retrieve-logged-in-admin-users-details) - [Custom error handler](../../advanced-development/api-routes/errors/page.mdx#override-error-handler) -- [Using Query in an API route](../../advanced-development/modules/query/page.mdx#query-example) +- [Using Query in an API route](../../advanced-development/module-links/query/page.mdx#query-example) - [Upload files in a custom API route](!resources!/recipes/digital-products/examples/standard#step-7-upload-digital-product-media-api-route) - [Customize cart-completion API route](!resources!/recipes/digital-products/examples/standard#step-11-customize-cart-completion) diff --git a/www/apps/book/generated/edit-dates.mjs b/www/apps/book/generated/edit-dates.mjs index c9b65ef8251b8..97465a1e0cc6b 100644 --- a/www/apps/book/generated/edit-dates.mjs +++ b/www/apps/book/generated/edit-dates.mjs @@ -77,9 +77,16 @@ export const generatedEditDates = { "app/advanced-development/api-routes/validation/page.mdx": "2024-09-11T10:46:31.476Z", "app/advanced-development/api-routes/errors/page.mdx": "2024-09-30T08:43:53.121Z", "app/advanced-development/admin/constraints/page.mdx": "2024-09-10T11:39:51.165Z", - "app/advanced-development/modules/query/page.mdx": "2024-09-30T08:43:53.127Z", "app/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-09-30T08:43:53.139Z", "app/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-09-30T08:43:53.139Z", + "app/advanced-development/module-links/custom-columns/page.mdx": "2024-09-16T15:51:33.570Z", + "app/advanced-development/module-links/directions/page.mdx": "2024-09-16T15:37:51.441Z", + "app/advanced-development/module-links/page.mdx": "2024-09-16T15:36:48.190Z", + "app/advanced-development/module-links/query/page.mdx": "2024-09-16T12:42:27.579Z", + "app/advanced-development/module-links/remote-link/page.mdx": "2024-09-16T12:42:27.581Z", + "app/advanced-development/modules/db-operations/page.mdx": "2024-09-16T14:38:29.150Z", + "app/advanced-development/modules/multiple-services/page.mdx": "2024-09-16T14:41:32.975Z", + "app/advanced-development/modules/page.mdx": "2024-09-16T14:33:48.217Z", "app/debugging-and-testing/instrumentation/page.mdx": "2024-09-17T08:53:15.910Z", "app/advanced-development/api-routes/additional-data/page.mdx": "2024-09-30T08:43:53.120Z", "app/advanced-development/workflows/page.mdx": "2024-09-18T08:00:57.364Z", diff --git a/www/apps/book/next.config.mjs b/www/apps/book/next.config.mjs index 6e84fe1cf8a2b..4ecc7d776a983 100644 --- a/www/apps/book/next.config.mjs +++ b/www/apps/book/next.config.mjs @@ -131,7 +131,27 @@ const nextConfig = { return [ { source: "/advanced-development/modules/remote-query", - destination: "/advanced-development/modules/query", + destination: "/advanced-development/module-links/query", + permanent: true, + }, + { + source: "/advanced-development/modules/query", + destination: "/advanced-development/module-links/query", + permanent: true, + }, + { + source: "/advanced-development/modules/module-links", + destination: "/advanced-development/module-links", + permanent: true, + }, + { + source: "/advanced-development/modules/module-link-directions", + destination: "/advanced-development/module-links/directions", + permanent: true, + }, + { + source: "/advanced-development/modules/remote-link", + destination: "/advanced-development/module-links/remote-link", permanent: true, }, { diff --git a/www/apps/book/sidebar.mjs b/www/apps/book/sidebar.mjs index e6128aff1609b..ba11e80aca245 100644 --- a/www/apps/book/sidebar.mjs +++ b/www/apps/book/sidebar.mjs @@ -255,14 +255,25 @@ export const sidebar = numberSidebarItems( ], }, { - type: "sub-category", + type: "link", + path: "/advanced-development/modules", title: "Modules", children: [ + { + type: "link", + path: "/advanced-development/modules/isolation", + title: "Module Isolation", + }, { type: "link", path: "/advanced-development/modules/container", title: "Module's Container", }, + { + type: "link", + path: "/advanced-development/modules/options", + title: "Module Options", + }, { type: "link", path: "/advanced-development/modules/service-factory", @@ -275,33 +286,40 @@ export const sidebar = numberSidebarItems( }, { type: "link", - path: "/advanced-development/modules/isolation", - title: "Module Isolation", + path: "/advanced-development/modules/db-operations", + title: "Database Operations", }, { type: "link", - path: "/advanced-development/modules/module-links", - title: "Module Links", + path: "/advanced-development/modules/multiple-services", + title: "Multiple Services", }, + ], + }, + { + type: "link", + path: "/advanced-development/module-links", + title: "Module Links", + children: [ { type: "link", - path: "/advanced-development/modules/module-link-directions", + path: "/advanced-development/module-links/directions", title: "Module Link Direction", }, { type: "link", - path: "/advanced-development/modules/remote-link", + path: "/advanced-development/module-links/remote-link", title: "Remote Link", }, { type: "link", - path: "/advanced-development/modules/query", + path: "/advanced-development/module-links/query", title: "Query", }, { type: "link", - path: "/advanced-development/modules/options", - title: "Module Options", + path: "/advanced-development/module-links/custom-columns", + title: "Custom Columns", }, ], }, diff --git a/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx b/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx index aecc1c9f5a8af..84aa982c36044 100644 --- a/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx +++ b/www/apps/resources/app/commerce-modules/product/guides/price/page.mdx @@ -8,7 +8,7 @@ export const metadata = { # {metadata.title} -In this document, you'll learn how to retrieve product variant prices in the Medusa application using the [Query](!docs!/advanced-development/modules/query). +In this document, you'll learn how to retrieve product variant prices in the Medusa application using the [Query](!docs!/advanced-development/module-links/query). diff --git a/www/apps/resources/app/medusa-container-resources/page.mdx b/www/apps/resources/app/medusa-container-resources/page.mdx index 0b62afbe8ea07..e3f4161cf1a4a 100644 --- a/www/apps/resources/app/medusa-container-resources/page.mdx +++ b/www/apps/resources/app/medusa-container-resources/page.mdx @@ -1,16 +1,20 @@ import { Table } from "docs-ui" export const metadata = { - title: `Medusa Container Resources`, + title: `Medusa and Module Container Dependencies`, } # {metadata.title} -This documentation page includes the list of resources registered in the Medusa container of your Medusa application. +This documentation page includes the list of dependencies registered in the container of the Medusa application and a module. + +## Medusa Container Dependencies + +The following list of dependencies are resources that can be resolved by all resources (such as API route or workflow) except of a module's. -Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/utils` to resolve these resources' names. +Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/utils` where specified. @@ -121,8 +125,134 @@ Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/util - - For custom modules, the registration name is the key of the module in the `modules` configuration. - - For Medusa's commerce modules, you can use the `Modules` enum imported from `@medusajs/framework/utils`. + - For custom modules, the registration name is the key of the module in the `modules` configuration in `medusa-config.js`. + - For Medusa's commerce modules, use the `Modules` enum imported from `@medusajs/framework/utils`. + + + + + + +--- + +## Module Container Dependencies + +The following resources are resources that can be resolved by a module's services and loaders. + + + +Use the `ContainerRegistrationKeys` enum imported from `@medusajs/framework/utils` where specified. + + + + + + + + + Resource + + + + + Description + + + + + + Registration Name + + + + + + + + + Logger + + + + + An instance of Medusa CLI’s logger. You can use it to log messages to the terminal. + + + + + `logger` or `ContainerRegistrationKeys.LOGGER` + + + + + + + + Entity Manager + + + + + An instance of [MikroORM's entity manager](https://mikro-orm.io/api/5.9/knex/class/EntityManager). + + + + + `manager` or `ContainerRegistrationKeys.MANAGER` + + + + + + + + Base Repository + + + + + An instance of the base repository, used to run transactions or perform other database operations. + + + + + `baseRepository` + + + + + + + + Configurations + + + + + The configurations exported from `medusa-config.js`. + + + + + `configModule` or `ContainerRegistrationKeys.CONFIG_MODULE` + + + + + + + + Modules' services + + + + + All services exported by the `services/index.ts` file of a module. + + + + + Each service is registered by its camel-case name. For example, if the service's class name is `ClientService`, its registration name is `clientService`. diff --git a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx index ea4681b00c4b0..9bea15afd882e 100644 --- a/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx +++ b/www/apps/resources/app/recipes/digital-products/examples/standard/page.mdx @@ -170,7 +170,7 @@ class DigitalProductModuleService extends MedusaService({ export default DigitalProductModuleService ``` -The service extends the [service factory](https://docs.medusajs.com/v2/advanced-development/modules/service-factory), which provides basic data-management features. +The service extends the [service factory](!docs!/advanced-development/modules/service-factory), which provides basic data-management features. ### Create Module Definition @@ -255,7 +255,7 @@ This defines a link between `DigitalProductOrder` and the Order Module’s `Orde ### Further Read -- [How to Define Module Links](!docs!/advanced-development/modules/module-links) +- [How to Define Module Links](!docs!/advanced-development/module-links) --- @@ -362,7 +362,7 @@ Make sure to replace `{token}` with the JWT token you retrieved. ### Further Reads - [How to Create an API Route](!docs!/basics/api-routes) -- [Learn more about Query](!docs!/advanced-development/modules/query) +- [Learn more about Query](!docs!/advanced-development/module-links/query) --- @@ -611,7 +611,7 @@ You’ll test out the workflow in the next section. - [How to Create a Workflow](!docs!/basics/workflows) - [What is the Compensation Function](!docs!/advanced-development/workflows/compensation-function) -- [Learn more about the remote link function](!docs!/advanced-development/modules/remote-link) +- [Learn more about the remote link function](!docs!/advanced-development/module-links/remote-link) --- diff --git a/www/apps/resources/app/recipes/digital-products/page.mdx b/www/apps/resources/app/recipes/digital-products/page.mdx index a8889295586d2..98209ed713ec6 100644 --- a/www/apps/resources/app/recipes/digital-products/page.mdx +++ b/www/apps/resources/app/recipes/digital-products/page.mdx @@ -69,7 +69,7 @@ Then, you can link your custom data model to data models from other modules. For icon: AcademicCapSolid, }, { - href: "!docs!/advanced-development/modules/module-links", + href: "!docs!/advanced-development/module-links", title: "Module Links", text: "Learn how to link data models of different modules.", icon: AcademicCapSolid, @@ -129,13 +129,13 @@ Use the remote link to create a link between two records, and use Query to fetch -[Learn more about module links](!docs!/advanced-development/modules/module-links). +[Learn more about module links](!docs!/advanced-development/module-links). diff --git a/www/apps/resources/app/recipes/marketplace/page.mdx b/www/apps/resources/app/recipes/marketplace/page.mdx index fc71406ac5fe3..1378bf16ce55c 100644 --- a/www/apps/resources/app/recipes/marketplace/page.mdx +++ b/www/apps/resources/app/recipes/marketplace/page.mdx @@ -57,7 +57,7 @@ Since a vendor has products, orders, and other models based on your use case, de For example, if you defined a vendor data model in a marketplace module, you can define a module link between the vendor and the Product Module's product data model. -This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/modules/query). +This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/module-links/query). diff --git a/www/apps/resources/app/service-factory-reference/methods/listAndCount/page.mdx b/www/apps/resources/app/service-factory-reference/methods/listAndCount/page.mdx index 089f0fdb179ad..350f99c57672e 100644 --- a/www/apps/resources/app/service-factory-reference/methods/listAndCount/page.mdx +++ b/www/apps/resources/app/service-factory-reference/methods/listAndCount/page.mdx @@ -54,7 +54,7 @@ The method returns an array with two items: -This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/modules/query). +This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/module-links/query). diff --git a/www/apps/resources/app/service-factory-reference/methods/retrieve/page.mdx b/www/apps/resources/app/service-factory-reference/methods/retrieve/page.mdx index f813519919938..c4d81f61cc9fa 100644 --- a/www/apps/resources/app/service-factory-reference/methods/retrieve/page.mdx +++ b/www/apps/resources/app/service-factory-reference/methods/retrieve/page.mdx @@ -30,7 +30,7 @@ The method returns the record as an object. -This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/modules/query). +This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/module-links/query). diff --git a/www/apps/resources/generated/sidebar.mjs b/www/apps/resources/generated/sidebar.mjs index 3d3d10d732fea..bf4dffab9aee9 100644 --- a/www/apps/resources/generated/sidebar.mjs +++ b/www/apps/resources/generated/sidebar.mjs @@ -8745,7 +8745,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "link", "path": "/medusa-container-resources", - "title": "Medusa Container Resources", + "title": "Container Dependencies", "children": [] }, { diff --git a/www/apps/resources/sidebar.mjs b/www/apps/resources/sidebar.mjs index 3bac0ff6d4adc..83a07e9535560 100644 --- a/www/apps/resources/sidebar.mjs +++ b/www/apps/resources/sidebar.mjs @@ -2200,7 +2200,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "link", path: "/medusa-container-resources", - title: "Medusa Container Resources", + title: "Container Dependencies", }, { type: "link", From 732f64177dc37cb54b4fe94c1485eb172c9a0c59 Mon Sep 17 00:00:00 2001 From: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Date: Tue, 1 Oct 2024 15:30:23 +0200 Subject: [PATCH 8/9] fix: Validate `identifier` payload for reset password (#9302) Closes CC-526 --- .../http/__tests__/auth/admin/auth.spec.ts | 16 ++++++++++++---- .../[auth_provider]/reset-password/route.ts | 5 +++-- packages/medusa/src/api/auth/middlewares.ts | 7 ++++++- packages/medusa/src/api/auth/validators.ts | 6 ++++++ 4 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 packages/medusa/src/api/auth/validators.ts diff --git a/integration-tests/http/__tests__/auth/admin/auth.spec.ts b/integration-tests/http/__tests__/auth/admin/auth.spec.ts index 641cd124b26b8..f54787cbdf8c2 100644 --- a/integration-tests/http/__tests__/auth/admin/auth.spec.ts +++ b/integration-tests/http/__tests__/auth/admin/auth.spec.ts @@ -139,15 +139,23 @@ medusaIntegrationTestRunner({ describe("Reset password flows", () => { it("should generate a reset password token", async () => { const response = await api.post("/auth/user/emailpass/reset-password", { - email: "admin@medusa.js", + identifier: "admin@medusa.js", }) expect(response.status).toEqual(201) }) + it("should fail if identifier is not provided", async () => { + const errResponse = await api + .post("/auth/user/emailpass/reset-password", {}) + .catch((e) => e) + + expect(errResponse.response.status).toEqual(400) + }) + it("should fail to generate token for non-existing user, but still respond with 201", async () => { const response = await api.post("/auth/user/emailpass/reset-password", { - email: "non-existing-user@medusa.js", + identifier: "non-existing-user@medusa.js", }) expect(response.status).toEqual(201) @@ -156,7 +164,7 @@ medusaIntegrationTestRunner({ it("should fail to generate token for existing user but no provider, but still respond with 201", async () => { const response = await api.post( "/auth/user/non-existing-provider/reset-password", - { email: "admin@medusa.js" } + { identifier: "admin@medusa.js" } ) expect(response.status).toEqual(201) @@ -165,7 +173,7 @@ medusaIntegrationTestRunner({ it("should fail to generate token for existing user but no provider, but still respond with 201", async () => { const response = await api.post( "/auth/user/non-existing-provider/reset-password", - { email: "admin@medusa.js" } + { identifier: "admin@medusa.js" } ) expect(response.status).toEqual(201) diff --git a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/reset-password/route.ts b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/reset-password/route.ts index a97234c58b0d7..dfa373ffa2b15 100644 --- a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/reset-password/route.ts +++ b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/reset-password/route.ts @@ -4,13 +4,14 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "../../../../../types/routing" +import { ResetPasswordRequestType } from "../../../validators" export const POST = async ( - req: AuthenticatedMedusaRequest, + req: AuthenticatedMedusaRequest, res: MedusaResponse ) => { const { auth_provider, actor_type } = req.params - const { identifier } = req.body + const { identifier } = req.validatedBody const { http } = req.scope.resolve( ContainerRegistrationKeys.CONFIG_MODULE diff --git a/packages/medusa/src/api/auth/middlewares.ts b/packages/medusa/src/api/auth/middlewares.ts index dd16f4fdebee3..cb6b46fec0c2e 100644 --- a/packages/medusa/src/api/auth/middlewares.ts +++ b/packages/medusa/src/api/auth/middlewares.ts @@ -1,6 +1,8 @@ import { authenticate, MiddlewareRoute } from "@medusajs/framework/http" +import { validateAndTransformBody } from "../utils/validate-body" import { validateScopeProviderAssociation } from "./utils/validate-scope-provider-association" import { validateToken } from "./utils/validate-token" +import { ResetPasswordRequest } from "./validators" export const authRoutesMiddlewares: MiddlewareRoute[] = [ { @@ -41,7 +43,10 @@ export const authRoutesMiddlewares: MiddlewareRoute[] = [ { method: ["POST"], matcher: "/auth/:actor_type/:auth_provider/reset-password", - middlewares: [validateScopeProviderAssociation()], + middlewares: [ + validateScopeProviderAssociation(), + validateAndTransformBody(ResetPasswordRequest), + ], }, { method: ["POST"], diff --git a/packages/medusa/src/api/auth/validators.ts b/packages/medusa/src/api/auth/validators.ts new file mode 100644 index 0000000000000..bd4a124e2a175 --- /dev/null +++ b/packages/medusa/src/api/auth/validators.ts @@ -0,0 +1,6 @@ +import { z } from "zod" + +export const ResetPasswordRequest = z.object({ + identifier: z.string(), +}) +export type ResetPasswordRequestType = z.infer From 13a3c1bd7700f09a4c1e08c4a0906bebc241f357 Mon Sep 17 00:00:00 2001 From: Adrien de Peretti Date: Tue, 1 Oct 2024 16:34:48 +0200 Subject: [PATCH 9/9] fix(utils): knex import (#9408) --- packages/core/utils/src/modules-sdk/create-pg-connection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/utils/src/modules-sdk/create-pg-connection.ts b/packages/core/utils/src/modules-sdk/create-pg-connection.ts index c7035866f7828..cea6fb0148033 100644 --- a/packages/core/utils/src/modules-sdk/create-pg-connection.ts +++ b/packages/core/utils/src/modules-sdk/create-pg-connection.ts @@ -1,5 +1,5 @@ import { ModuleServiceInitializeOptions } from "@medusajs/types" -import { knex } from "@mikro-orm/knex" +import { knex } from "@mikro-orm/postgresql" type Options = ModuleServiceInitializeOptions["database"] @@ -19,7 +19,7 @@ export function createPgConnection(options: Options) { searchPath: schema, connection: { connectionString: clientUrl, - ssl, + ssl: ssl as any, idle_in_transaction_session_timeout: (driverOptions?.idle_in_transaction_session_timeout as number) ?? undefined, // prevent null to be passed