From 48e00169d2df7f924a9596c9df241820ae8f4d0a Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 3 Oct 2024 15:12:00 +0530 Subject: [PATCH] breaking: move shared HTTP utils to the framework (#9402) Fixes: FRMW-2728, FRMW-2729 After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path. - applyParamsAsFilters - clearFiltersByKey - applyDefaultFilters - setContext - getQueryConfig - httpCompression - maybeApplyLinkFilter - refetchEntities - unlessPath - validateBody - validateQuery Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com> --- .../create-medusa-app/src/commands/create.ts | 5 +- .../create-medusa-app/src/utils/create-db.ts | 26 +- .../cli/create-medusa-app/src/utils/facts.ts | 2 +- .../src/utils/nextjs-utils.ts | 6 +- .../src/utils/node-version.ts | 4 +- .../src/utils/postgres-client.ts | 1 + packages/cli/medusa-cli/package.json | 1 + packages/cli/medusa-cli/src/commands/new.ts | 5 +- .../src/local-npm-registry/cleanup-tasks.js | 22 +- .../src/utils/get-dependant-packages.js | 2 +- .../src/utils/promisified-spawn.js | 2 +- .../cli/medusa-dev-cli/src/utils/version.js | 6 +- .../src/__tests__/command-oas.test.ts | 30 +- .../oas/medusa-oas-cli/src/command-docs.ts | 50 +- .../cli/oas/medusa-oas-cli/src/command-oas.ts | 39 +- packages/cli/oas/medusa-oas-cli/src/types.ts | 2 +- .../oas/medusa-oas-cli/src/utils/fs-utils.ts | 3 +- .../medusa-oas-cli/src/utils/yaml-utils.ts | 10 +- .../core-flows/src/api-key/steps/index.ts | 1 - .../core-flows/src/api-key/workflows/index.ts | 1 - packages/core/core-flows/src/auth/index.ts | 1 - packages/core/core-flows/src/cart/index.ts | 1 - .../core/core-flows/src/cart/steps/index.ts | 1 - .../src/cart/workflows/update-tax-lines.ts | 3 +- .../src/customer/workflows/index.ts | 1 - .../core-flows/src/fulfillment/steps/index.ts | 1 - .../core-flows/src/payment/workflows/index.ts | 1 - .../core-flows/src/sales-channel/index.ts | 1 - .../core-flows/src/shipping-profile/index.ts | 1 - .../core-flows/src/user/workflows/index.ts | 1 - packages/core/framework/package.json | 2 +- packages/core/framework/src/container.ts | 11 +- .../src/http}/__tests__/validate-body.spec.ts | 14 +- .../http}/__tests__/validate-query.spec.ts | 121 +-- packages/core/framework/src/http/index.ts | 7 + .../middlewares}/apply-default-filters.ts | 7 +- .../middlewares/apply-params-as-filters.ts | 13 + .../http/middlewares/clear-filters-by-key.ts | 11 + .../middlewares/ensure-publishable-api-key.ts | 3 +- .../src/http/middlewares/error-handler.ts | 5 +- .../framework/src/http/middlewares/index.ts | 4 + .../src/http/middlewares}/set-context.ts | 5 +- packages/core/framework/src/http/types.ts | 14 +- .../src/http}/utils/get-query-config.ts | 9 +- .../src/http/utils}/http-compression.ts | 19 +- .../http}/utils/maybe-apply-link-filter.ts | 11 +- .../src/http/utils/refetch-entities.ts} | 8 +- .../framework/src/http/utils/unless-path.ts | 22 + .../src/http}/utils/validate-body.ts | 6 +- .../src/http}/utils/validate-query.ts | 23 +- packages/core/framework/src/index.ts | 1 + packages/core/framework/src/jobs/index.ts | 2 +- .../core/framework/src/medusa-app-loader.ts | 7 +- .../core/framework/src/mikro-orm-cli/bin.ts | 5 +- .../framework/src/workflows-sdk/composer.ts | 2 +- packages/core/framework/src/zod/index.ts | 1 + .../framework/src/zod/zod-helpers.ts} | 0 packages/core/framework/tsconfig.json | 5 +- packages/core/js-sdk/src/admin/upload.ts | 11 +- packages/core/js-sdk/src/store/index.ts | 26 +- .../core/modules-sdk/src/loaders/index.ts | 1 - packages/core/types/src/auth/provider.ts | 2 +- packages/core/types/src/auth/service.ts | 2 +- packages/core/types/src/cart/service.ts | 2 +- packages/core/types/src/common/common.ts | 26 +- packages/core/types/src/common/medusa-cli.ts | 2 +- packages/core/types/src/file-service/index.ts | 10 +- .../core/types/src/fulfillment/provider.ts | 2 +- .../types/src/http/api-key/admin/responses.ts | 2 +- .../types/src/http/campaign/admin/index.ts | 1 - .../src/http/campaign/admin/responses.ts | 2 +- .../types/src/http/cart/store/entities.ts | 5 +- .../core/types/src/http/cart/store/index.ts | 2 +- .../types/src/http/cart/store/payloads.ts | 2 +- .../types/src/http/cart/store/responses.ts | 31 +- .../types/src/http/collection/store/index.ts | 2 +- .../src/http/collection/store/queries.ts | 7 +- .../core/types/src/http/common/response.ts | 19 +- .../core/types/src/http/currency/index.ts | 2 +- .../types/src/http/currency/store/entities.ts | 4 +- .../types/src/http/currency/store/index.ts | 2 +- .../types/src/http/currency/store/queries.ts | 15 +- .../src/http/currency/store/responses.ts | 4 +- .../src/http/customer-group/admin/index.ts | 2 +- .../types/src/http/customer-group/index.ts | 3 +- .../types/src/http/customer/admin/index.ts | 2 +- .../src/http/customer/admin/responses.ts | 6 +- .../types/src/http/customer/store/entities.ts | 7 +- .../types/src/http/customer/store/index.ts | 2 +- .../types/src/http/customer/store/queries.ts | 7 +- .../src/http/customer/store/responses.ts | 9 +- .../types/src/http/exchange/admin/entities.ts | 4 +- .../core/types/src/http/exchange/common.ts | 6 +- .../core/types/src/http/exchange/index.ts | 2 +- .../types/src/http/file/admin/entities.ts | 2 +- .../core/types/src/http/file/admin/index.ts | 2 +- .../types/src/http/file/admin/payloads.ts | 2 +- .../types/src/http/file/admin/responses.ts | 6 +- .../fulfillment-provider/admin/entities.ts | 2 +- .../src/http/fulfillment-provider/common.ts | 2 +- .../src/http/fulfillment/admin/queries.ts | 2 +- .../types/src/http/inventory/admin/queries.ts | 4 +- .../src/http/inventory/admin/responses.ts | 8 +- .../types/src/http/invite/admin/entities.ts | 2 +- .../core/types/src/http/invite/admin/index.ts | 2 +- .../types/src/http/invite/admin/payloads.ts | 2 +- .../types/src/http/invite/admin/queries.ts | 6 +- .../types/src/http/invite/admin/responses.ts | 20 +- .../types/src/http/order/admin/entities.ts | 13 +- .../core/types/src/http/order/admin/index.ts | 2 +- .../types/src/http/order/admin/queries.ts | 4 +- .../types/src/http/order/store/entities.ts | 8 +- .../core/types/src/http/order/store/index.ts | 2 +- .../types/src/http/order/store/queries.ts | 17 +- .../types/src/http/order/store/responses.ts | 4 +- .../types/src/http/payment/admin/entities.ts | 2 +- .../types/src/http/payment/admin/index.ts | 2 +- .../types/src/http/payment/admin/queries.ts | 15 +- .../types/src/http/payment/store/entities.ts | 2 +- .../types/src/http/payment/store/index.ts | 2 +- .../types/src/http/payment/store/payloads.ts | 2 +- .../types/src/http/payment/store/responses.ts | 6 +- .../src/http/price-list/admin/responses.ts | 2 +- .../types/src/http/product-category/common.ts | 2 +- .../http/product-category/store/entities.ts | 17 +- .../types/src/http/product/admin/queries.ts | 32 +- .../types/src/http/product/admin/responses.ts | 13 +- .../types/src/http/product/store/entitites.ts | 15 +- .../types/src/http/product/store/queries.ts | 3 +- .../src/http/promotion/admin/entities.ts | 16 +- .../src/http/promotion/admin/payloads.ts | 10 +- .../src/http/promotion/admin/responses.ts | 18 +- .../core/types/src/http/promotion/common.ts | 14 +- .../types/src/http/region/admin/entities.ts | 7 +- .../core/types/src/http/region/admin/index.ts | 2 +- .../types/src/http/region/admin/responses.ts | 6 +- .../types/src/http/region/store/entities.ts | 7 +- .../core/types/src/http/region/store/index.ts | 2 +- .../types/src/http/region/store/queries.ts | 8 +- .../types/src/http/region/store/responses.ts | 8 +- .../src/http/reservation/admin/entities.ts | 2 +- .../src/http/reservation/admin/responses.ts | 2 +- .../src/http/return-reason/admin/payloads.ts | 3 +- .../types/src/http/return-reason/index.ts | 2 +- .../src/http/return-reason/store/entities.ts | 4 +- .../src/http/return-reason/store/index.ts | 2 +- .../src/http/return-reason/store/responses.ts | 6 +- .../types/src/http/return/admin/entities.ts | 4 +- .../core/types/src/http/return/admin/index.ts | 2 +- .../types/src/http/return/admin/responses.ts | 2 +- packages/core/types/src/http/return/index.ts | 2 +- .../types/src/http/return/store/entities.ts | 5 +- .../core/types/src/http/return/store/index.ts | 2 +- .../types/src/http/return/store/payloads.ts | 2 +- .../types/src/http/return/store/responses.ts | 4 +- .../http/shipping-option/admin/responses.ts | 3 +- .../types/src/http/shipping-option/index.ts | 2 +- .../http/shipping-option/store/entities.ts | 2 +- .../src/http/shipping-option/store/index.ts | 2 +- .../src/http/shipping-option/store/queries.ts | 13 +- .../http/shipping-option/store/responses.ts | 4 +- .../src/http/stock-locations/admin/queries.ts | 27 +- .../types/src/http/tax-rate/admin/queries.ts | 27 +- .../src/http/tax-rate/admin/responses.ts | 11 +- packages/core/types/src/http/user/index.ts | 3 +- .../http/workflow-execution/admin/index.ts | 1 - .../workflow-execution/admin/responses.ts | 2 +- .../src/http/workflow-execution/index.ts | 2 +- packages/core/types/src/order/common.ts | 139 ++-- packages/core/types/src/search/interface.ts | 138 ++-- packages/core/types/src/search/settings.ts | 28 +- packages/core/types/src/tax/provider.ts | 4 +- .../core/types/src/transaction-base/index.ts | 3 +- .../workflow/fulfillment/shipping-profiles.ts | 5 +- .../utils/src/auth/abstract-auth-provider.ts | 38 +- .../src/common}/__tests__/omit-deep.spec.ts | 12 +- .../remove-undefined-properties.spec.ts | 14 +- .../core/utils/src/common/get-node-version.ts | 4 +- packages/core/utils/src/common/index.ts | 2 + .../utils/src/common}/omit-deep.ts | 2 +- .../common}/remove-undefined-properties.ts | 2 +- packages/core/utils/src/dml/entity-builder.ts | 2 +- .../core/utils/src/dml/properties/base.ts | 38 +- .../core/utils/src/fulfillment/provider.ts | 125 ++- .../core/utils/src/search/abstract-service.ts | 110 +-- .../src/utils/composer/__tests__/compose.ts | 2 +- .../src/utils/composer/parallelize.ts | 2 +- .../src/utils/composer/transform.ts | 4 +- packages/medusa-test-utils/package.json | 1 + packages/medusa/package.json | 4 +- .../api/admin/api-keys/[id]/revoke/route.ts | 2 +- .../src/api/admin/api-keys/[id]/route.ts | 2 +- .../api-keys/[id]/sales-channels/route.ts | 2 +- .../src/api/admin/api-keys/middlewares.ts | 6 +- .../medusa/src/api/admin/api-keys/route.ts | 2 +- .../admin/campaigns/[id]/promotions/route.ts | 2 +- .../src/api/admin/campaigns/[id]/route.ts | 2 +- .../src/api/admin/campaigns/middlewares.ts | 6 +- .../medusa/src/api/admin/campaigns/route.ts | 2 +- .../src/api/admin/claims/[id]/cancel/route.ts | 2 +- .../[id]/claim-items/[action_id]/route.ts | 2 +- .../admin/claims/[id]/claim-items/route.ts | 2 +- .../[id]/inbound/items/[action_id]/route.ts | 4 +- .../admin/claims/[id]/inbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 2 +- .../[id]/inbound/shipping-method/route.ts | 2 +- .../[id]/outbound/items/[action_id]/route.ts | 2 +- .../admin/claims/[id]/outbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 2 +- .../[id]/outbound/shipping-method/route.ts | 2 +- .../api/admin/claims/[id]/request/route.ts | 2 +- .../medusa/src/api/admin/claims/[id]/route.ts | 4 +- .../src/api/admin/claims/middlewares.ts | 6 +- packages/medusa/src/api/admin/claims/route.ts | 2 +- .../admin/collections/[id]/products/route.ts | 2 +- .../src/api/admin/collections/[id]/route.ts | 2 +- .../src/api/admin/collections/middlewares.ts | 6 +- .../medusa/src/api/admin/collections/route.ts | 2 +- .../src/api/admin/currencies/[code]/route.ts | 2 +- .../src/api/admin/currencies/middlewares.ts | 4 +- .../medusa/src/api/admin/currencies/route.ts | 2 +- .../customer-groups/[id]/customers/route.ts | 2 +- .../api/admin/customer-groups/[id]/route.ts | 2 +- .../api/admin/customer-groups/middlewares.ts | 6 +- .../src/api/admin/customer-groups/route.ts | 2 +- .../[id]/addresses/[address_id]/route.ts | 2 +- .../admin/customers/[id]/addresses/route.ts | 2 +- .../src/api/admin/customers/[id]/route.ts | 2 +- .../src/api/admin/customers/middlewares.ts | 6 +- .../medusa/src/api/admin/customers/route.ts | 2 +- .../src/api/admin/draft-orders/[id]/route.ts | 2 +- .../src/api/admin/draft-orders/middlewares.ts | 4 +- .../src/api/admin/draft-orders/route.ts | 2 +- .../src/api/admin/draft-orders/validators.ts | 2 +- .../api/admin/exchanges/[id]/cancel/route.ts | 2 +- .../[id]/inbound/items/[action_id]/route.ts | 4 +- .../exchanges/[id]/inbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 2 +- .../[id]/inbound/shipping-method/route.ts | 2 +- .../[id]/outbound/items/[action_id]/route.ts | 2 +- .../exchanges/[id]/outbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 2 +- .../[id]/outbound/shipping-method/route.ts | 2 +- .../api/admin/exchanges/[id]/request/route.ts | 2 +- .../src/api/admin/exchanges/[id]/route.ts | 4 +- .../src/api/admin/exchanges/middlewares.ts | 6 +- .../medusa/src/api/admin/exchanges/route.ts | 2 +- .../fulfillment-providers/middlewares.ts | 4 +- .../api/admin/fulfillment-providers/route.ts | 2 +- .../api/admin/fulfillment-sets/[id]/route.ts | 2 +- .../[id]/service-zones/[zone_id]/route.ts | 2 +- .../[id]/service-zones/route.ts | 2 +- .../api/admin/fulfillment-sets/middlewares.ts | 6 +- .../admin/fulfillments/[id]/cancel/route.ts | 2 +- .../admin/fulfillments/[id]/shipment/route.ts | 2 +- .../src/api/admin/fulfillments/middlewares.ts | 6 +- .../src/api/admin/fulfillments/route.ts | 2 +- .../location-levels/[location_id]/route.ts | 2 +- .../[id]/location-levels/batch/route.ts | 2 +- .../[id]/location-levels/route.ts | 2 +- .../api/admin/inventory-items/[id]/route.ts | 2 +- .../api/admin/inventory-items/middlewares.ts | 9 +- .../src/api/admin/inventory-items/route.ts | 2 +- .../api/admin/invites/[id]/resend/route.ts | 2 +- .../src/api/admin/invites/[id]/route.ts | 2 +- .../src/api/admin/invites/accept/route.ts | 2 +- .../src/api/admin/invites/middlewares.ts | 6 +- .../medusa/src/api/admin/invites/route.ts | 2 +- .../src/api/admin/notifications/[id]/route.ts | 4 +- .../api/admin/notifications/middlewares.ts | 2 +- .../src/api/admin/notifications/route.ts | 4 +- .../admin/order-edits/[id]/confirm/route.ts | 2 +- .../[id]/items/[action_id]/route.ts | 2 +- .../[id]/items/item/[item_id]/route.ts | 2 +- .../api/admin/order-edits/[id]/items/route.ts | 2 +- .../admin/order-edits/[id]/request/route.ts | 2 +- .../src/api/admin/order-edits/[id]/route.ts | 2 +- .../[id]/shipping-method/[action_id]/route.ts | 2 +- .../order-edits/[id]/shipping-method/route.ts | 2 +- .../src/api/admin/order-edits/middlewares.ts | 2 +- .../medusa/src/api/admin/order-edits/route.ts | 2 +- .../api/admin/orders/[id]/archive/route.ts | 2 +- .../src/api/admin/orders/[id]/cancel/route.ts | 2 +- .../api/admin/orders/[id]/changes/route.ts | 2 +- .../api/admin/orders/[id]/complete/route.ts | 2 +- .../[fulfillment_id]/cancel/route.ts | 2 +- .../mark-as-delivered/route.ts | 4 +- .../[fulfillment_id]/shipments/route.ts | 2 +- .../admin/orders/[id]/fulfillments/route.ts | 2 +- .../api/admin/orders/[id]/preview/route.ts | 2 +- .../medusa/src/api/admin/orders/[id]/route.ts | 2 +- .../src/api/admin/orders/middlewares.ts | 6 +- packages/medusa/src/api/admin/orders/route.ts | 2 +- .../[id]/mark-as-paid/route.ts | 4 +- .../admin/payment-collections/[id]/route.ts | 2 +- .../admin/payment-collections/middlewares.ts | 6 +- .../api/admin/payment-collections/route.ts | 4 +- .../api/admin/payments/[id]/capture/route.ts | 2 +- .../api/admin/payments/[id]/refund/route.ts | 2 +- .../src/api/admin/payments/[id]/route.ts | 2 +- .../src/api/admin/payments/middlewares.ts | 9 +- .../admin/payments/payment-providers/route.ts | 2 +- .../medusa/src/api/admin/payments/route.ts | 2 +- .../price-lists/[id]/prices/batch/route.ts | 2 +- .../admin/price-lists/[id]/products/route.ts | 2 +- .../src/api/admin/price-lists/[id]/route.ts | 2 +- .../src/api/admin/price-lists/middlewares.ts | 6 +- .../price-lists/queries/get-price-list.ts | 2 +- .../medusa/src/api/admin/price-lists/route.ts | 2 +- .../api/admin/price-preferences/[id]/route.ts | 4 +- .../admin/price-preferences/middlewares.ts | 6 +- .../src/api/admin/price-preferences/route.ts | 5 +- .../product-categories/[id]/products/route.ts | 4 +- .../admin/product-categories/[id]/route.ts | 4 +- .../admin/product-categories/middlewares.ts | 6 +- .../src/api/admin/product-categories/route.ts | 4 +- .../src/api/admin/product-tags/[id]/route.ts | 4 +- .../src/api/admin/product-tags/middlewares.ts | 6 +- .../src/api/admin/product-tags/route.ts | 5 +- .../src/api/admin/product-types/[id]/route.ts | 2 +- .../api/admin/product-types/middlewares.ts | 6 +- .../src/api/admin/product-types/route.ts | 2 +- .../api/admin/product-variants/middlewares.ts | 2 +- .../src/api/admin/product-variants/route.ts | 2 +- .../[id]/options/[option_id]/route.ts | 4 +- .../api/admin/products/[id]/options/route.ts | 8 +- .../src/api/admin/products/[id]/route.ts | 4 +- .../[inventory_item_id]/route.ts | 2 +- .../[variant_id]/inventory-items/route.ts | 2 +- .../[id]/variants/[variant_id]/route.ts | 4 +- .../products/[id]/variants/batch/route.ts | 2 +- .../variants/inventory-items/batch/route.ts | 2 +- .../api/admin/products/[id]/variants/route.ts | 7 +- .../src/api/admin/products/batch/route.ts | 2 +- .../src/api/admin/products/export/route.ts | 2 +- .../import/[transaction_id]/confirm/route.ts | 2 +- .../src/api/admin/products/import/route.ts | 2 +- .../src/api/admin/products/middlewares.ts | 14 +- .../medusa/src/api/admin/products/route.ts | 5 +- .../utils/maybe-apply-price-lists-filter.ts | 2 +- .../promotions/[id]/[rule_type]/route.ts | 2 +- .../promotions/[id]/buy-rules/batch/route.ts | 2 +- .../src/api/admin/promotions/[id]/route.ts | 2 +- .../promotions/[id]/rules/batch/route.ts | 2 +- .../[id]/target-rules/batch/route.ts | 2 +- .../src/api/admin/promotions/helpers.ts | 10 +- .../src/api/admin/promotions/middlewares.ts | 9 +- .../medusa/src/api/admin/promotions/route.ts | 2 +- .../[rule_type]/route.ts | 2 +- .../[rule_type]/[rule_attribute_id]/route.ts | 2 +- .../api/admin/refund-reasons/[id]/route.ts | 4 +- .../api/admin/refund-reasons/middlewares.ts | 6 +- .../src/api/admin/refund-reasons/route.ts | 3 +- .../src/api/admin/regions/[id]/route.ts | 2 +- .../src/api/admin/regions/middlewares.ts | 6 +- .../medusa/src/api/admin/regions/route.ts | 2 +- .../src/api/admin/reservations/[id]/route.ts | 8 +- .../src/api/admin/reservations/middlewares.ts | 6 +- .../src/api/admin/reservations/route.ts | 2 +- .../api/admin/return-reasons/[id]/route.ts | 4 +- .../api/admin/return-reasons/middlewares.ts | 6 +- .../src/api/admin/return-reasons/route.ts | 2 +- .../api/admin/returns/[id]/cancel/route.ts | 2 +- .../[id]/dismiss-items/[action_id]/route.ts | 2 +- .../admin/returns/[id]/dismiss-items/route.ts | 2 +- .../[id]/receive-items/[action_id]/route.ts | 2 +- .../admin/returns/[id]/receive-items/route.ts | 2 +- .../returns/[id]/receive/confirm/route.ts | 2 +- .../api/admin/returns/[id]/receive/route.ts | 2 +- .../[id]/request-items/[action_id]/route.ts | 2 +- .../admin/returns/[id]/request-items/route.ts | 2 +- .../api/admin/returns/[id]/request/route.ts | 2 +- .../src/api/admin/returns/[id]/route.ts | 2 +- .../[id]/shipping-method/[action_id]/route.ts | 2 +- .../returns/[id]/shipping-method/route.ts | 2 +- .../src/api/admin/returns/middlewares.ts | 6 +- .../medusa/src/api/admin/returns/route.ts | 2 +- .../sales-channels/[id]/products/route.ts | 2 +- .../api/admin/sales-channels/[id]/route.ts | 2 +- .../api/admin/sales-channels/middlewares.ts | 9 +- .../src/api/admin/sales-channels/route.ts | 2 +- .../api/admin/shipping-options/[id]/route.ts | 2 +- .../[id]/rules/batch/route.ts | 2 +- .../api/admin/shipping-options/middlewares.ts | 9 +- .../src/api/admin/shipping-options/route.ts | 2 +- .../api/admin/shipping-profiles/[id]/route.ts | 2 +- .../admin/shipping-profiles/middlewares.ts | 6 +- .../src/api/admin/shipping-profiles/route.ts | 2 +- .../[id]/fulfillment-providers/route.ts | 2 +- .../[id]/fulfillment-sets/route.ts | 2 +- .../api/admin/stock-locations/[id]/route.ts | 2 +- .../[id]/sales-channels/route.ts | 2 +- .../api/admin/stock-locations/middlewares.ts | 9 +- .../src/api/admin/stock-locations/route.ts | 2 +- .../medusa/src/api/admin/stores/[id]/route.ts | 4 +- .../src/api/admin/stores/middlewares.ts | 6 +- packages/medusa/src/api/admin/stores/route.ts | 2 +- .../src/api/admin/tax-rates/[id]/route.ts | 2 +- .../tax-rates/[id]/rules/[rule_id]/route.ts | 2 +- .../api/admin/tax-rates/[id]/rules/route.ts | 2 +- .../src/api/admin/tax-rates/middlewares.ts | 6 +- .../medusa/src/api/admin/tax-rates/route.ts | 2 +- .../src/api/admin/tax-regions/[id]/route.ts | 2 +- .../src/api/admin/tax-regions/middlewares.ts | 6 +- .../medusa/src/api/admin/tax-regions/route.ts | 2 +- .../src/api/admin/uploads/[id]/route.ts | 4 +- .../src/api/admin/uploads/middlewares.ts | 2 +- .../medusa/src/api/admin/uploads/route.ts | 2 +- .../medusa/src/api/admin/users/[id]/route.ts | 2 +- .../medusa/src/api/admin/users/me/route.ts | 2 +- .../medusa/src/api/admin/users/middlewares.ts | 6 +- packages/medusa/src/api/admin/users/route.ts | 2 +- .../medusa/src/api/admin/users/validators.ts | 1 - .../admin/workflows-executions/[id]/route.ts | 2 +- .../[step_id]/subscribe/route.ts | 2 +- .../[workflow_id]/[transaction_id]/route.ts | 2 +- .../[workflow_id]/run/route.ts | 2 +- .../[workflow_id]/steps/failure/route.ts | 9 +- .../[workflow_id]/steps/success/route.ts | 9 +- .../[workflow_id]/subscribe/route.ts | 2 +- .../admin/workflows-executions/middlewares.ts | 4 +- .../api/admin/workflows-executions/route.ts | 2 +- .../[auth_provider]/callback/route.ts | 2 +- .../[auth_provider]/register/route.ts | 2 +- .../[auth_provider]/reset-password/route.ts | 2 +- .../[actor_type]/[auth_provider]/route.ts | 2 +- .../[auth_provider]/update/route.ts | 6 +- packages/medusa/src/api/auth/middlewares.ts | 7 +- packages/medusa/src/api/auth/session/route.ts | 2 +- .../src/api/auth/token/refresh/route.ts | 2 +- .../src/api/hooks/payment/[provider]/route.ts | 2 +- .../api/store/carts/[id]/complete/route.ts | 4 +- .../carts/[id]/line-items/[line_id]/route.ts | 4 +- .../api/store/carts/[id]/line-items/route.ts | 2 +- .../api/store/carts/[id]/promotions/route.ts | 2 +- .../medusa/src/api/store/carts/[id]/route.ts | 2 +- .../carts/[id]/shipping-methods/route.ts | 2 +- .../src/api/store/carts/[id]/taxes/route.ts | 2 +- .../medusa/src/api/store/carts/middlewares.ts | 4 +- packages/medusa/src/api/store/carts/route.ts | 2 +- .../src/api/store/collections/[id]/route.ts | 2 +- .../src/api/store/collections/middlewares.ts | 2 +- .../medusa/src/api/store/collections/route.ts | 2 +- .../src/api/store/currencies/[code]/route.ts | 2 +- .../src/api/store/currencies/middlewares.ts | 2 +- .../medusa/src/api/store/currencies/route.ts | 2 +- .../me/addresses/[address_id]/route.ts | 2 +- .../api/store/customers/me/addresses/route.ts | 2 +- .../src/api/store/customers/me/route.ts | 2 +- .../src/api/store/customers/middlewares.ts | 10 +- .../medusa/src/api/store/customers/route.ts | 2 +- .../medusa/src/api/store/orders/[id]/route.ts | 2 +- .../medusa/src/api/store/orders/helpers.ts | 2 +- .../src/api/store/orders/middlewares.ts | 2 +- packages/medusa/src/api/store/orders/route.ts | 2 +- .../[id]/payment-sessions/route.ts | 2 +- .../api/store/payment-collections/helpers.ts | 2 +- .../store/payment-collections/middlewares.ts | 6 +- .../api/store/payment-collections/route.ts | 2 +- .../store/payment-providers/middlewares.ts | 2 +- .../src/api/store/payment-providers/route.ts | 2 +- .../store/product-categories/[id]/route.ts | 4 +- .../store/product-categories/middlewares.ts | 2 +- .../src/api/store/product-categories/route.ts | 2 +- .../src/api/store/products/[id]/route.ts | 6 +- .../medusa/src/api/store/products/helpers.ts | 14 +- .../src/api/store/products/middlewares.ts | 12 +- .../medusa/src/api/store/products/route.ts | 2 +- .../src/api/store/regions/[id]/route.ts | 2 +- .../src/api/store/regions/middlewares.ts | 2 +- .../medusa/src/api/store/regions/route.ts | 2 +- .../api/store/return-reasons/[id]/route.ts | 2 +- .../api/store/return-reasons/middlewares.ts | 2 +- .../src/api/store/return-reasons/route.ts | 2 +- .../src/api/store/return/middlewares.ts | 6 +- packages/medusa/src/api/store/return/route.ts | 2 +- .../api/store/shipping-options/middlewares.ts | 2 +- .../src/api/store/shipping-options/route.ts | 2 +- .../api/utils/__tests__/zod-helper.spec.ts | 134 --- .../common/apply-params-as-filters.ts | 16 - .../common/clear-filters-by-key.ts | 12 - .../ensure-pub-key-sales-channel-match.ts | 2 +- .../src/api/utils/middlewares/common/index.ts | 2 - .../common/maybe-attach-pub-key-scopes.ts | 2 +- .../medusa/src/api/utils/middlewares/index.ts | 1 - .../products/normalize-data-for-context.ts | 7 +- .../products/set-pricing-context.ts | 7 +- .../middlewares/products/set-tax-context.ts | 4 +- .../products/variant-inventory-quantity.ts | 2 +- packages/medusa/src/api/utils/unless-path.ts | 15 - packages/medusa/src/index.js | 8 - packages/medusa/src/index.ts | 4 + packages/medusa/src/loaders/index.ts | 2 +- packages/medusa/src/types/common.ts | 36 - packages/medusa/src/types/global.ts | 2 +- packages/medusa/src/types/index.ts | 3 + packages/medusa/src/types/routing.ts | 99 --- .../__tests__/define-routes-config.spec.ts | 2 +- packages/medusa/src/utils/api/index.ts | 1 - .../medusa/src/utils/clean-response-data.ts | 3 +- packages/medusa/src/utils/index.ts | 2 - .../migrations/.snapshot-medusa-api-key.json | 16 +- .../src/migrations/Migration20240604080145.ts | 12 +- .../providers/default-provider.ts | 4 +- .../auth-module-service/index.spec.ts | 2 +- .../modules/auth/src/loaders/providers.ts | 4 +- .../src/migrations/.snapshot-medusa-auth.json | 20 +- .../modules/auth/src/models/auth-identity.ts | 2 +- .../auth/src/services/auth-provider.ts | 4 +- packages/modules/auth/src/types/index.ts | 8 +- packages/modules/cache-inmemory/README.md | 4 +- packages/modules/cache-redis/README.md | 7 +- .../src/migrations/.snapshot-medusa-cart.json | 186 ++--- packages/modules/cart/src/models/address.ts | 2 +- packages/modules/cart/src/models/cart.ts | 4 +- packages/modules/cart/src/models/index.ts | 1 - .../cart/src/models/line-item-adjustment.ts | 2 +- .../cart/src/models/line-item-tax-line.ts | 2 +- packages/modules/cart/src/models/line-item.ts | 6 +- .../src/models/shipping-method-adjustment.ts | 2 +- .../src/models/shipping-method-tax-line.ts | 2 +- .../cart/src/models/shipping-method.ts | 6 +- packages/modules/cart/src/services/index.ts | 2 +- .../migrations/.snapshot-medusa-customer.json | 60 +- .../src/migrations/Migration20240524123112.ts | 40 +- packages/modules/event-bus-local/README.md | 6 +- packages/modules/event-bus-redis/README.md | 16 +- .../modules/file/src/loaders/providers.ts | 2 +- .../.snapshot-medusa-fulfillment.json | 303 ++----- .../.snapshot-medusa-inventory.json | 68 +- .../.snapshot-medusa-notification.json | 26 +- .../src/migrations/Migration20240830094712.ts | 12 +- .../migrations/.snapshot-medusa-order.json | 777 +++++------------- .../src/migrations/Migration20240902195921.ts | 20 +- .../migrations/.snapshot-medusa-payment.json | 161 +--- .../modules/payment/src/services/index.ts | 1 - .../migrations/.snapshot-medusa-pricing.json | 114 +-- .../src/migrations/Migration20240322094407.ts | 18 +- .../src/migrations/Migration20240704094505.ts | 18 +- .../migrations/.snapshot-medusa-products.json | 215 ++--- .../src/migrations/Migration202408271511.ts | 4 +- .../.snapshot-medusa-promotion.json | 215 ++--- .../payment-stripe/src/services/index.ts | 1 - .../migrations/.snapshot-medusa-region.json | 20 +- packages/modules/region/src/services/index.ts | 3 +- .../.snapshot-medusa-sales-channel-tst.json | 12 +- .../.snapshot-medusa-stock-location.json | 28 +- .../src/migrations/Migration20240307161216.ts | 32 +- .../migrations/.snapshot-medusa-store.json | 28 +- packages/modules/tax/src/loaders/providers.ts | 2 +- .../src/migrations/.snapshot-medusa-tax.json | 80 +- .../src/migrations/Migration20240710135844.ts | 28 +- .../src/migrations/Migration20240924114005.ts | 4 +- .../modules/tax/src/models/tax-rate-rule.ts | 2 +- packages/modules/tax/src/models/tax-region.ts | 6 +- .../src/migrations/.snapshot-medusa-user.json | 32 +- yarn.lock | 2 + 557 files changed, 2365 insertions(+), 3499 deletions(-) rename packages/{medusa/src/api/utils => core/framework/src/http}/__tests__/validate-body.spec.ts (73%) rename packages/{medusa/src/api/utils => core/framework/src/http}/__tests__/validate-query.spec.ts (87%) rename packages/{medusa/src/api/utils/middlewares/common => core/framework/src/http/middlewares}/apply-default-filters.ts (85%) create mode 100644 packages/core/framework/src/http/middlewares/apply-params-as-filters.ts create mode 100644 packages/core/framework/src/http/middlewares/clear-filters-by-key.ts rename packages/{medusa/src/api/utils/middlewares/common => core/framework/src/http/middlewares}/set-context.ts (73%) rename packages/{medusa/src => core/framework/src/http}/utils/get-query-config.ts (97%) rename packages/{medusa/src/utils/api => core/framework/src/http/utils}/http-compression.ts (66%) rename packages/{medusa/src/api => core/framework/src/http}/utils/maybe-apply-link-filter.ts (91%) rename packages/{medusa/src/api/utils/refetch-entity.ts => core/framework/src/http/utils/refetch-entities.ts} (87%) create mode 100644 packages/core/framework/src/http/utils/unless-path.ts rename packages/{medusa/src/api => core/framework/src/http}/utils/validate-body.ts (87%) rename packages/{medusa/src/api => core/framework/src/http}/utils/validate-query.ts (86%) create mode 100644 packages/core/framework/src/zod/index.ts rename packages/{medusa/src/api/utils/zod-helper.ts => core/framework/src/zod/zod-helpers.ts} (100%) rename packages/{medusa/src/utils => core/utils/src/common}/__tests__/omit-deep.spec.ts (89%) rename packages/{medusa/src/utils => core/utils/src/common}/__tests__/remove-undefined-properties.spec.ts (87%) rename packages/{medusa/src/utils => core/utils/src/common}/omit-deep.ts (93%) rename packages/{medusa/src/utils => core/utils/src/common}/remove-undefined-properties.ts (95%) delete mode 100644 packages/medusa/src/api/utils/__tests__/zod-helper.spec.ts delete mode 100644 packages/medusa/src/api/utils/middlewares/common/apply-params-as-filters.ts delete mode 100644 packages/medusa/src/api/utils/middlewares/common/clear-filters-by-key.ts delete mode 100644 packages/medusa/src/api/utils/middlewares/common/index.ts delete mode 100644 packages/medusa/src/api/utils/unless-path.ts delete mode 100644 packages/medusa/src/index.js create mode 100644 packages/medusa/src/index.ts delete mode 100644 packages/medusa/src/types/common.ts create mode 100644 packages/medusa/src/types/index.ts delete mode 100644 packages/medusa/src/types/routing.ts delete mode 100644 packages/medusa/src/utils/api/index.ts diff --git a/packages/cli/create-medusa-app/src/commands/create.ts b/packages/cli/create-medusa-app/src/commands/create.ts index 248ac4f4a1..19ba1c206d 100644 --- a/packages/cli/create-medusa-app/src/commands/create.ts +++ b/packages/cli/create-medusa-app/src/commands/create.ts @@ -25,7 +25,10 @@ import { installNextjsStarter, startNextjsStarter, } from "../utils/nextjs-utils.js" -import { getNodeVersion, MIN_SUPPORTED_NODE_VERSION } from "../utils/node-version.js" +import { + getNodeVersion, + MIN_SUPPORTED_NODE_VERSION, +} from "../utils/node-version.js" const slugify = slugifyType.default diff --git a/packages/cli/create-medusa-app/src/utils/create-db.ts b/packages/cli/create-medusa-app/src/utils/create-db.ts index 51f3249c20..f05305129d 100644 --- a/packages/cli/create-medusa-app/src/utils/create-db.ts +++ b/packages/cli/create-medusa-app/src/utils/create-db.ts @@ -1,6 +1,9 @@ import { EOL } from "os" import pg from "pg" -import postgresClient, { DEFAULT_HOST, DEFAULT_PORT } from "./postgres-client.js" +import postgresClient, { + DEFAULT_HOST, + DEFAULT_PORT, +} from "./postgres-client.js" import inquirer from "inquirer" import logMessage from "./log-message.js" import formatConnectionString from "./format-connection-string.js" @@ -16,8 +19,13 @@ export default async function createDb({ client, db }: CreateDbOptions) { await client.query(`CREATE DATABASE "${db}"`) } -async function doesDbExist (client: pg.Client, dbName: string): Promise { - const result = await client.query(`SELECT datname FROM pg_catalog.pg_database WHERE datname='${dbName}';`) +async function doesDbExist( + client: pg.Client, + dbName: string +): Promise { + const result = await client.query( + `SELECT datname FROM pg_catalog.pg_database WHERE datname='${dbName}';` + ) return !!result.rowCount } @@ -75,14 +83,14 @@ async function getForDbName({ const defaultConnectionOptions = { host: DEFAULT_HOST, - port: DEFAULT_PORT + port: DEFAULT_PORT, } try { client = await postgresClient({ user: postgresUsername, password: postgresPassword, - ...defaultConnectionOptions + ...defaultConnectionOptions, }) } catch (e) { if (verbose) { @@ -129,7 +137,7 @@ async function getForDbName({ user: postgresUsername, password: postgresPassword, database: userDbName, - ...defaultConnectionOptions + ...defaultConnectionOptions, }) } catch (e) { logMessage({ @@ -148,7 +156,9 @@ async function getForDbName({ message: `A database already exists with the name ${dbName}, please enter a name for the database:`, default: dbName, validate: (input) => { - return typeof input === "string" && input.length > 0 && input !== dbName + return ( + typeof input === "string" && input.length > 0 && input !== dbName + ) }, }, ]) @@ -167,7 +177,7 @@ async function getForDbName({ return { client, dbConnectionString, - dbName + dbName, } } diff --git a/packages/cli/create-medusa-app/src/utils/facts.ts b/packages/cli/create-medusa-app/src/utils/facts.ts index fda62a0df6..b2e37095e6 100644 --- a/packages/cli/create-medusa-app/src/utils/facts.ts +++ b/packages/cli/create-medusa-app/src/utils/facts.ts @@ -32,7 +32,7 @@ const facts = [ "The event bus module is responsible for triggering events and relaying them to subscribers.", "The cache module is responsible for caching data that requires heavy computation.", "A workflow is a series of steps that are defined once and executed anywhere. Workflows are created under the src/workflows directory.", - "A workflow's steps can be retried or rolled back in case of an error." + "A workflow's steps can be retried or rolled back in case of an error.", ] export const getFact = () => { diff --git a/packages/cli/create-medusa-app/src/utils/nextjs-utils.ts b/packages/cli/create-medusa-app/src/utils/nextjs-utils.ts index 1f63ad71e2..6d7fddcdd9 100644 --- a/packages/cli/create-medusa-app/src/utils/nextjs-utils.ts +++ b/packages/cli/create-medusa-app/src/utils/nextjs-utils.ts @@ -1,7 +1,7 @@ import inquirer from "inquirer" import { exec } from "child_process" import execute from "./execute.js" -import { FactBoxOptions, displayFactBox } from "./facts.js" +import { displayFactBox, FactBoxOptions } from "./facts.js" import fs from "fs" import path from "path" import { customAlphabet } from "nanoid" @@ -37,7 +37,7 @@ export async function installNextjsStarter({ abortController, factBoxOptions, verbose = false, - processManager + processManager, }: InstallOptions): Promise { factBoxOptions.interval = displayFactBox({ ...factBoxOptions, @@ -72,7 +72,7 @@ export async function installNextjsStarter({ ) const execOptions = { signal: abortController?.signal, - cwd: nextjsDirectory + cwd: nextjsDirectory, } await processManager.runProcess({ process: async () => { diff --git a/packages/cli/create-medusa-app/src/utils/node-version.ts b/packages/cli/create-medusa-app/src/utils/node-version.ts index fa09891d5b..ac29653f54 100644 --- a/packages/cli/create-medusa-app/src/utils/node-version.ts +++ b/packages/cli/create-medusa-app/src/utils/node-version.ts @@ -1,7 +1,7 @@ export function getNodeVersion(): number { - const [major] = process.versions.node.split('.').map(Number) + const [major] = process.versions.node.split(".").map(Number) return major } -export const MIN_SUPPORTED_NODE_VERSION = 20 \ No newline at end of file +export const MIN_SUPPORTED_NODE_VERSION = 20 diff --git a/packages/cli/create-medusa-app/src/utils/postgres-client.ts b/packages/cli/create-medusa-app/src/utils/postgres-client.ts index 502895efdf..28ad9db254 100644 --- a/packages/cli/create-medusa-app/src/utils/postgres-client.ts +++ b/packages/cli/create-medusa-app/src/utils/postgres-client.ts @@ -1,4 +1,5 @@ import pg from "pg" + const { Client } = pg export const DEFAULT_HOST = "localhost" diff --git a/packages/cli/medusa-cli/package.json b/packages/cli/medusa-cli/package.json index 6ee62202f1..a18e287cb1 100644 --- a/packages/cli/medusa-cli/package.json +++ b/packages/cli/medusa-cli/package.json @@ -47,6 +47,7 @@ }, "dependencies": { "@medusajs/utils": "1.11.9", + "@types/express": "^4.17.17", "chalk": "^4.0.0", "configstore": "5.0.1", "dotenv": "^16.4.5", diff --git a/packages/cli/medusa-cli/src/commands/new.ts b/packages/cli/medusa-cli/src/commands/new.ts index cc105bd9a1..e1fb047145 100644 --- a/packages/cli/medusa-cli/src/commands/new.ts +++ b/packages/cli/medusa-cli/src/commands/new.ts @@ -22,10 +22,7 @@ import reporter from "../reporter" import { getPackageManager, setPackageManager } from "../util/package-manager" import { PanicId } from "../reporter/panic-handler" import { clearProject } from "../util/clear-project" -import { - getNodeVersion, - MIN_SUPPORTED_NODE_VERSION, -} from "@medusajs/utils" +import { getNodeVersion, MIN_SUPPORTED_NODE_VERSION } from "@medusajs/utils" const removeUndefined = (obj) => { return Object.fromEntries( diff --git a/packages/cli/medusa-dev-cli/src/local-npm-registry/cleanup-tasks.js b/packages/cli/medusa-dev-cli/src/local-npm-registry/cleanup-tasks.js index 3241653a1e..7e4403af7b 100644 --- a/packages/cli/medusa-dev-cli/src/local-npm-registry/cleanup-tasks.js +++ b/packages/cli/medusa-dev-cli/src/local-npm-registry/cleanup-tasks.js @@ -1,19 +1,19 @@ -const signalExit = require(`signal-exit`); +const signalExit = require(`signal-exit`) -const cleanupTasks = new Set(); +const cleanupTasks = new Set() exports.registerCleanupTask = (taskFn) => { - cleanupTasks.add(taskFn); + cleanupTasks.add(taskFn) return () => { - const result = taskFn(); - cleanupTasks.delete(taskFn); - return result; - }; -}; + const result = taskFn() + cleanupTasks.delete(taskFn) + return result + } +} signalExit(() => { if (cleanupTasks.size) { - console.log(`Process exitted in middle of publishing - cleaning up`); - cleanupTasks.forEach((taskFn) => taskFn()); + console.log(`Process exitted in middle of publishing - cleaning up`) + cleanupTasks.forEach((taskFn) => taskFn()) } -}); +}) diff --git a/packages/cli/medusa-dev-cli/src/utils/get-dependant-packages.js b/packages/cli/medusa-dev-cli/src/utils/get-dependant-packages.js index 41aec215ad..6f8047847b 100644 --- a/packages/cli/medusa-dev-cli/src/utils/get-dependant-packages.js +++ b/packages/cli/medusa-dev-cli/src/utils/get-dependant-packages.js @@ -15,7 +15,7 @@ const getDependantPackages = ({ packagesToPublish.add(packageName) const dependants = depTree[packageName] if (dependants) { - dependants.forEach(dependant => + dependants.forEach((dependant) => getDependantPackages({ packageName: dependant, depTree, diff --git a/packages/cli/medusa-dev-cli/src/utils/promisified-spawn.js b/packages/cli/medusa-dev-cli/src/utils/promisified-spawn.js index 4ed41c93d3..1744ecf20e 100644 --- a/packages/cli/medusa-dev-cli/src/utils/promisified-spawn.js +++ b/packages/cli/medusa-dev-cli/src/utils/promisified-spawn.js @@ -5,7 +5,7 @@ const defaultSpawnArgs = { stdio: `inherit`, } -exports.setDefaultSpawnStdio = stdio => { +exports.setDefaultSpawnStdio = (stdio) => { defaultSpawnArgs.stdio = stdio } diff --git a/packages/cli/medusa-dev-cli/src/utils/version.js b/packages/cli/medusa-dev-cli/src/utils/version.js index 3d5cf9bee8..939cdfe747 100644 --- a/packages/cli/medusa-dev-cli/src/utils/version.js +++ b/packages/cli/medusa-dev-cli/src/utils/version.js @@ -1,4 +1,4 @@ exports.getVersionInfo = () => { - const { version: devCliVersion } = require(`../../package.json`); - return `Medusa Dev CLI version: ${devCliVersion}`; -}; + const { version: devCliVersion } = require(`../../package.json`) + return `Medusa Dev CLI version: ${devCliVersion}` +} diff --git a/packages/cli/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts b/packages/cli/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts index f2d99738c4..7ca6029bce 100644 --- a/packages/cli/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts +++ b/packages/cli/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts @@ -10,13 +10,23 @@ import execa from "execa" /** * OAS output directory - * + * * @privateRemarks * This should be the only directory OAS is loaded from for Medusa V2. * For now, we only use it if the --v2 flag it passed to the CLI tool. */ const oasOutputPath = path.resolve( - __dirname, "..", "..", "..", "..", "..", "..", "www", "utils", "generated", "oas-output" + __dirname, + "..", + "..", + "..", + "..", + "..", + "..", + "www", + "utils", + "generated", + "oas-output" ) const basePath = path.resolve(__dirname, `../../`) @@ -128,7 +138,13 @@ describe("command oas", () => { beforeAll(async () => { const outDir = path.resolve(tmpDir, uid()) - await runCLI("oas", ["--type", "combined", "--out-dir", outDir, "--local"]) + await runCLI("oas", [ + "--type", + "combined", + "--out-dir", + outDir, + "--local", + ]) const generatedFilePath = path.resolve(outDir, "combined.oas.json") oas = (await readJson(generatedFilePath)) as OpenAPIObject }) @@ -227,7 +243,7 @@ describe("command oas", () => { outDir, "--paths", additionalPath, - "--local" + "--local", ]) const generatedFilePath = path.resolve(outDir, "store.oas.json") oas = (await readJson(generatedFilePath)) as OpenAPIObject @@ -363,7 +379,7 @@ components: outDir, "--base", filePath, - "--local" + "--local", ]) const generatedFilePath = path.resolve(outDir, "store.oas.json") oas = (await readJson(generatedFilePath)) as OpenAPIObject @@ -473,7 +489,7 @@ components: const routes = Object.keys(oas.paths) expect(routes.includes("/admin/products")).toBeTruthy() expect(routes.includes("/store/products")).toBeFalsy() - }) + }) }) describe("public OAS with base", () => { @@ -579,7 +595,7 @@ components: ]) const generatedFilePath = path.resolve(outDir, "store.oas.json") oas = (await readJson(generatedFilePath)) as OpenAPIObject - }) + }) it("should add new path to existing paths", async () => { const routes = Object.keys(oas.paths) diff --git a/packages/cli/oas/medusa-oas-cli/src/command-docs.ts b/packages/cli/oas/medusa-oas-cli/src/command-docs.ts index 8e016f58b0..226c0a7c9b 100644 --- a/packages/cli/oas/medusa-oas-cli/src/command-docs.ts +++ b/packages/cli/oas/medusa-oas-cli/src/command-docs.ts @@ -1,4 +1,7 @@ -import { PreviewDocsOptions, previewDocs } from "@redocly/cli/lib/commands/preview-docs" +import { + previewDocs, + PreviewDocsOptions, +} from "@redocly/cli/lib/commands/preview-docs" import { commandWrapper } from "@redocly/cli/lib/wrapper" import { Command, Option, OptionValues } from "commander" import execa from "execa" @@ -12,7 +15,12 @@ import { } from "./utils/circular-patch-utils" import { getTmpDirectory, isFile } from "./utils/fs-utils" import { readJson } from "./utils/json-utils" -import { jsonObjectToYamlString, readYaml, writeYaml, writeYamlFromJson } from "./utils/yaml-utils" +import { + jsonObjectToYamlString, + readYaml, + writeYaml, + writeYamlFromJson, +} from "./utils/yaml-utils" import yargs from "yargs" /** @@ -64,7 +72,7 @@ export const commandOptions: Option[] = [ new Option( "--main-file-name ", "The name of the main YAML file." - ).default("openapi.yaml") + ).default("openapi.yaml"), ] export function getCommand(): Command { @@ -140,7 +148,10 @@ export async function execute(cliParams: OptionValues): Promise { if (dryRun) { console.log(`⚫️ Dry run - no files generated`) // check out possible changes in redocly config - await execa("git", ["checkout", path.join(basePath, "redocly", "redocly-config.yaml")]) + await execa("git", [ + "checkout", + path.join(basePath, "redocly", "redocly-config.yaml"), + ]) return } if (shouldPreview) { @@ -150,7 +161,10 @@ export async function execute(cliParams: OptionValues): Promise { if (shouldSplit) { await generateReference(srcFileSanitized, outDir) } else { - await writeYaml(path.join(outDir, finalOASFile), await fs.readFile(srcFileSanitized, "utf8")) + await writeYaml( + path.join(outDir, finalOASFile), + await fs.readFile(srcFileSanitized, "utf8") + ) } if (shouldBuildHTML) { const outHTMLFile = path.resolve(outDir, "index.html") @@ -236,17 +250,31 @@ const fixCirclularReferences = async (srcFile: string): Promise => { ${hint} ### ` - const redoclyConfigPath = path.join(basePath, "redocly", "redocly-config.yaml") - const originalContent = await readYaml(redoclyConfigPath) as CircularReferenceConfig + const redoclyConfigPath = path.join( + basePath, + "redocly", + "redocly-config.yaml" + ) + const originalContent = (await readYaml( + redoclyConfigPath + )) as CircularReferenceConfig Object.keys(recommendation).forEach((recKey) => { originalContent.decorators["medusa/circular-patch"].schemas[recKey] = [ - ...(originalContent.decorators["medusa/circular-patch"].schemas[recKey] || []), - ...recommendation[recKey] + ...(originalContent.decorators["medusa/circular-patch"].schemas[ + recKey + ] || []), + ...recommendation[recKey], ] }) - await writeYaml(redoclyConfigPath, jsonObjectToYamlString(originalContent)) - console.log(`🟡 Added the following unhandled circular references to redocly-config.ts:` + hintMessage) + await writeYaml( + redoclyConfigPath, + jsonObjectToYamlString(originalContent) + ) + console.log( + `🟡 Added the following unhandled circular references to redocly-config.ts:` + + hintMessage + ) } } console.log(`🟢 All circular references are handled`) diff --git a/packages/cli/oas/medusa-oas-cli/src/command-oas.ts b/packages/cli/oas/medusa-oas-cli/src/command-oas.ts index cf214df3f1..43a02835b8 100644 --- a/packages/cli/oas/medusa-oas-cli/src/command-oas.ts +++ b/packages/cli/oas/medusa-oas-cli/src/command-oas.ts @@ -15,9 +15,7 @@ import { isFile } from "./utils/fs-utils" * Constants */ // Medusa core package directory -const medusaPackagePath = path.dirname( - require.resolve("@medusajs/medusa") -) +const medusaPackagePath = path.dirname(require.resolve("@medusajs/medusa")) const basePath = path.resolve(__dirname, "../") /** @@ -48,7 +46,7 @@ export const commandOptions: Option[] = [ new Option( "--local", "Generate OAS from local files rather than public OAS. This is useful for generating references in the Medusa monorepo." - ) + ), ] export function getCommand() { @@ -105,11 +103,17 @@ export async function execute(cliParams: OptionValues) { console.log(`🟣 Generating OAS - ${apiType}`) if (apiType === "combined") { - const adminOAS = !local ? await getPublicOas("admin") : await getOASFromCodebase("admin") - const storeOAS = !local ? await getPublicOas("store") : await getOASFromCodebase("store") + const adminOAS = !local + ? await getPublicOas("admin") + : await getOASFromCodebase("admin") + const storeOAS = !local + ? await getPublicOas("store") + : await getOASFromCodebase("store") oas = await combineOAS(adminOAS, storeOAS) } else { - oas = !local ? await getPublicOas(apiType) : await getOASFromCodebase(apiType) + oas = !local + ? await getPublicOas(apiType) + : await getOASFromCodebase(apiType) } if (additionalPaths.length || baseFile) { @@ -133,14 +137,21 @@ export async function execute(cliParams: OptionValues) { /** * Methods */ -async function getOASFromCodebase( - apiType: ApiType -): Promise { +async function getOASFromCodebase(apiType: ApiType): Promise { /** * OAS output directory */ const oasOutputPath = path.resolve( - __dirname, "..", "..", "..", "..", "..", "www", "utils", "generated", "oas-output" + __dirname, + "..", + "..", + "..", + "..", + "..", + "www", + "utils", + "generated", + "oas-output" ) const gen = await swaggerInline( [ @@ -158,11 +169,9 @@ async function getOASFromCodebase( return (await OpenAPIParser.parse(JSON.parse(gen))) as OpenAPIObject } -async function getPublicOas( - apiType: ApiType, -) { +async function getPublicOas(apiType: ApiType) { const url = `https://docs.medusajs.com/v2/api/api/download/${apiType}` - return await OpenAPIParser.parse(url) as OpenAPIObject + return (await OpenAPIParser.parse(url)) as OpenAPIObject } async function getOASFromPaths( diff --git a/packages/cli/oas/medusa-oas-cli/src/types.ts b/packages/cli/oas/medusa-oas-cli/src/types.ts index 571bd3c74a..5f1564dc00 100644 --- a/packages/cli/oas/medusa-oas-cli/src/types.ts +++ b/packages/cli/oas/medusa-oas-cli/src/types.ts @@ -8,4 +8,4 @@ type CircularReferenceConfig = { schemas: CircularReferenceSchema } } -} \ No newline at end of file +} diff --git a/packages/cli/oas/medusa-oas-cli/src/utils/fs-utils.ts b/packages/cli/oas/medusa-oas-cli/src/utils/fs-utils.ts index e7f19a1dd2..21e1df8567 100644 --- a/packages/cli/oas/medusa-oas-cli/src/utils/fs-utils.ts +++ b/packages/cli/oas/medusa-oas-cli/src/utils/fs-utils.ts @@ -1,6 +1,5 @@ import { access, lstat, mkdtemp } from "fs/promises" -import path from "path" -import { sep } from "path" +import path, { sep } from "path" import { tmpdir } from "os" export async function isFile(filePath: string): Promise { diff --git a/packages/cli/oas/medusa-oas-cli/src/utils/yaml-utils.ts b/packages/cli/oas/medusa-oas-cli/src/utils/yaml-utils.ts index 9608b475d9..c3813fe073 100644 --- a/packages/cli/oas/medusa-oas-cli/src/utils/yaml-utils.ts +++ b/packages/cli/oas/medusa-oas-cli/src/utils/yaml-utils.ts @@ -6,11 +6,17 @@ export const readYaml = async (filePath): Promise => { return yaml.load(yamlString) } -export const writeYaml = async (filePath: string, yamlContent: string): Promise => { +export const writeYaml = async ( + filePath: string, + yamlContent: string +): Promise => { await fs.writeFile(filePath, yamlContent, "utf8") } -export const writeYamlFromJson = async (filePath, jsonObject): Promise => { +export const writeYamlFromJson = async ( + filePath, + jsonObject +): Promise => { const yamlString = yaml.dump(jsonObject) await fs.writeFile(filePath, yamlString, "utf8") } diff --git a/packages/core/core-flows/src/api-key/steps/index.ts b/packages/core/core-flows/src/api-key/steps/index.ts index f67ddf957f..bcf83a711c 100644 --- a/packages/core/core-flows/src/api-key/steps/index.ts +++ b/packages/core/core-flows/src/api-key/steps/index.ts @@ -4,4 +4,3 @@ export * from "./link-sales-channels-to-publishable-key" export * from "./revoke-api-keys" export * from "./update-api-keys" export * from "./validate-sales-channel-exists" - diff --git a/packages/core/core-flows/src/api-key/workflows/index.ts b/packages/core/core-flows/src/api-key/workflows/index.ts index 94a04b7e9f..bebe4fe6f3 100644 --- a/packages/core/core-flows/src/api-key/workflows/index.ts +++ b/packages/core/core-flows/src/api-key/workflows/index.ts @@ -3,4 +3,3 @@ export * from "./delete-api-keys" export * from "./link-sales-channels-to-publishable-key" export * from "./revoke-api-keys" export * from "./update-api-keys" - diff --git a/packages/core/core-flows/src/auth/index.ts b/packages/core/core-flows/src/auth/index.ts index e58562ad24..68de82c9f9 100644 --- a/packages/core/core-flows/src/auth/index.ts +++ b/packages/core/core-flows/src/auth/index.ts @@ -1,3 +1,2 @@ export * from "./steps" export * from "./workflows" - diff --git a/packages/core/core-flows/src/cart/index.ts b/packages/core/core-flows/src/cart/index.ts index e58562ad24..68de82c9f9 100644 --- a/packages/core/core-flows/src/cart/index.ts +++ b/packages/core/core-flows/src/cart/index.ts @@ -1,3 +1,2 @@ export * from "./steps" export * from "./workflows" - diff --git a/packages/core/core-flows/src/cart/steps/index.ts b/packages/core/core-flows/src/cart/steps/index.ts index 2987307867..7673cf56d8 100644 --- a/packages/core/core-flows/src/cart/steps/index.ts +++ b/packages/core/core-flows/src/cart/steps/index.ts @@ -28,4 +28,3 @@ export * from "./update-line-items" export * from "./validate-cart-payments" export * from "./validate-cart-shipping-options" export * from "./validate-variant-prices" - diff --git a/packages/core/core-flows/src/cart/workflows/update-tax-lines.ts b/packages/core/core-flows/src/cart/workflows/update-tax-lines.ts index 6925c59bf9..5ab9d6bcc8 100644 --- a/packages/core/core-flows/src/cart/workflows/update-tax-lines.ts +++ b/packages/core/core-flows/src/cart/workflows/update-tax-lines.ts @@ -83,7 +83,8 @@ export const updateTaxLinesWorkflow = createWorkflow( transform({ input, cart }, (data) => ({ cart: data.cart, items: data.input.items || data.cart.items, - shipping_methods: data.input.shipping_methods || data.cart.shipping_methods, + shipping_methods: + data.input.shipping_methods || data.cart.shipping_methods, force_tax_calculation: data.input.force_tax_calculation, })) ) diff --git a/packages/core/core-flows/src/customer/workflows/index.ts b/packages/core/core-flows/src/customer/workflows/index.ts index 35fbedce24..44a5988746 100644 --- a/packages/core/core-flows/src/customer/workflows/index.ts +++ b/packages/core/core-flows/src/customer/workflows/index.ts @@ -6,4 +6,3 @@ export * from "./delete-customers" export * from "./remove-customer-account" export * from "./update-addresses" export * from "./update-customers" - diff --git a/packages/core/core-flows/src/fulfillment/steps/index.ts b/packages/core/core-flows/src/fulfillment/steps/index.ts index a5f3485c52..29226f6874 100644 --- a/packages/core/core-flows/src/fulfillment/steps/index.ts +++ b/packages/core/core-flows/src/fulfillment/steps/index.ts @@ -15,4 +15,3 @@ export * from "./update-fulfillment" export * from "./update-shipping-profiles" export * from "./upsert-shipping-options" export * from "./validate-shipment" - diff --git a/packages/core/core-flows/src/payment/workflows/index.ts b/packages/core/core-flows/src/payment/workflows/index.ts index ab1ba44e2f..0c5985b6c6 100644 --- a/packages/core/core-flows/src/payment/workflows/index.ts +++ b/packages/core/core-flows/src/payment/workflows/index.ts @@ -1,3 +1,2 @@ export * from "./capture-payment" export * from "./refund-payment" - diff --git a/packages/core/core-flows/src/sales-channel/index.ts b/packages/core/core-flows/src/sales-channel/index.ts index e58562ad24..68de82c9f9 100644 --- a/packages/core/core-flows/src/sales-channel/index.ts +++ b/packages/core/core-flows/src/sales-channel/index.ts @@ -1,3 +1,2 @@ export * from "./steps" export * from "./workflows" - diff --git a/packages/core/core-flows/src/shipping-profile/index.ts b/packages/core/core-flows/src/shipping-profile/index.ts index e58562ad24..68de82c9f9 100644 --- a/packages/core/core-flows/src/shipping-profile/index.ts +++ b/packages/core/core-flows/src/shipping-profile/index.ts @@ -1,3 +1,2 @@ export * from "./steps" export * from "./workflows" - diff --git a/packages/core/core-flows/src/user/workflows/index.ts b/packages/core/core-flows/src/user/workflows/index.ts index 1856a7688a..c35a8faccf 100644 --- a/packages/core/core-flows/src/user/workflows/index.ts +++ b/packages/core/core-flows/src/user/workflows/index.ts @@ -3,4 +3,3 @@ export * from "./create-users" export * from "./delete-users" export * from "./remove-user-account" export * from "./update-users" - diff --git a/packages/core/framework/package.json b/packages/core/framework/package.json index 3c88458ce5..c756103c9f 100644 --- a/packages/core/framework/package.json +++ b/packages/core/framework/package.json @@ -59,7 +59,6 @@ "@mikro-orm/postgresql": "5.9.7", "@swc/core": "^1.7.28", "@swc/jest": "^0.2.36", - "@types/express": "^4.17.17", "@types/jsonwebtoken": "^8.5.9", "awilix": "^8.0.1", "ioredis": "^5.4.1", @@ -78,6 +77,7 @@ "@medusajs/utils": "^1.11.9", "@medusajs/workflows-sdk": "^0.1.6", "@opentelemetry/api": "^1.9.0", + "@types/express": "^4.17.17", "connect-redis": "5.2.0", "cookie-parser": "^1.4.6", "cors": "^2.8.5", diff --git a/packages/core/framework/src/container.ts b/packages/core/framework/src/container.ts index 6180ae8ae0..61120c7df1 100644 --- a/packages/core/framework/src/container.ts +++ b/packages/core/framework/src/container.ts @@ -1,18 +1,13 @@ import { createMedusaContainer } from "@medusajs/utils" import { AwilixContainer, ResolveOptions } from "awilix" -import { TransformObjectMethodToAsync } from "@medusajs/types"; - -/** - * The following interface acts as a bucket that other modules or the - * utils package can fill using declaration merging - */ -export interface ModuleImplementations {} +import { ModuleImplementations } from "@medusajs/types" /** * The Medusa Container extends [Awilix](https://github.com/jeffijoe/awilix) to * provide dependency injection functionalities. */ -export type MedusaContainer> = +// export type MedusaContainer> = +export type MedusaContainer = Omit & { resolve( key: K, diff --git a/packages/medusa/src/api/utils/__tests__/validate-body.spec.ts b/packages/core/framework/src/http/__tests__/validate-body.spec.ts similarity index 73% rename from packages/medusa/src/api/utils/__tests__/validate-body.spec.ts rename to packages/core/framework/src/http/__tests__/validate-body.spec.ts index feadbcef9f..417ee75945 100644 --- a/packages/medusa/src/api/utils/__tests__/validate-body.spec.ts +++ b/packages/core/framework/src/http/__tests__/validate-body.spec.ts @@ -1,8 +1,14 @@ import zod from "zod" -import { MedusaError } from "@medusajs/framework/utils" -import { createLinkBody } from "../validators" -import { validateAndTransformBody } from "../validate-body" -import { MedusaRequest, MedusaResponse } from "../../../types/routing" +import { MedusaError } from "@medusajs/utils" +import { validateAndTransformBody } from "../utils/validate-body" +import { MedusaRequest, MedusaResponse } from "../types" + +const createLinkBody = () => { + return zod.object({ + add: zod.array(zod.string()).optional(), + remove: zod.array(zod.string()).optional(), + }) +} describe("validateAndTransformBody", () => { afterEach(() => { diff --git a/packages/medusa/src/api/utils/__tests__/validate-query.spec.ts b/packages/core/framework/src/http/__tests__/validate-query.spec.ts similarity index 87% rename from packages/medusa/src/api/utils/__tests__/validate-query.spec.ts rename to packages/core/framework/src/http/__tests__/validate-query.spec.ts index 779f634b68..b1799c261a 100644 --- a/packages/medusa/src/api/utils/__tests__/validate-query.spec.ts +++ b/packages/core/framework/src/http/__tests__/validate-query.spec.ts @@ -1,8 +1,57 @@ -import { MedusaError } from "@medusajs/framework/utils" -import { NextFunction, Request, Response } from "express" +import z from "zod" +import { MedusaError } from "@medusajs/utils" +import { validateAndTransformQuery } from "../utils/validate-query" +import { MedusaRequest, MedusaResponse, MedusaNextFunction } from "../types" -import { createFindParams } from "../validators" -import { validateAndTransformQuery } from "../validate-query" +export const createSelectParams = () => { + return z.object({ + fields: z.string().optional(), + }) +} + +const createFindParams = ({ + offset, + limit, + order, +}: { + offset?: number + limit?: number + order?: string +} = {}) => { + const selectParams = createSelectParams() + + return selectParams.merge( + z.object({ + offset: z.preprocess( + (val) => { + if (val && typeof val === "string") { + return parseInt(val) + } + return val + }, + z + .number() + .optional() + .default(offset ?? 0) + ), + limit: z.preprocess( + (val) => { + if (val && typeof val === "string") { + return parseInt(val) + } + return val + }, + z + .number() + .optional() + .default(limit ?? 20) + ), + order: order + ? z.string().optional().default(order) + : z.string().optional(), + }) + ) +} describe("validateAndTransformQuery", () => { afterEach(() => { @@ -12,9 +61,9 @@ describe("validateAndTransformQuery", () => { it("should transform the input query", async () => { let mockRequest = { query: {}, - } as Request - const mockResponse = {} as Response - const nextFunction: NextFunction = jest.fn() + } as MedusaRequest + const mockResponse = {} as MedusaResponse + const nextFunction: MedusaNextFunction = jest.fn() const expectations = ({ offset, @@ -104,15 +153,13 @@ describe("validateAndTransformQuery", () => { inputOrder: undefined, }) - ////////////////////////////// - mockRequest = { query: { limit: "10", offset: "5", order: "created_at", }, - } as unknown as Request + } as unknown as MedusaRequest middleware = validateAndTransformQuery(createFindParams(), queryConfig) @@ -125,15 +172,13 @@ describe("validateAndTransformQuery", () => { transformedOrder: { created_at: "ASC" }, }) - ////////////////////////////// - mockRequest = { query: { limit: "10", offset: "5", order: "created_at", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaults: [ @@ -166,9 +211,9 @@ describe("validateAndTransformQuery", () => { query: { fields: "id", }, - } as unknown as Request - const mockResponse = {} as Response - const nextFunction: NextFunction = jest.fn() + } as unknown as MedusaRequest + const mockResponse = {} as MedusaResponse + const nextFunction: MedusaNextFunction = jest.fn() let queryConfig: any = { defaultFields: [ @@ -200,13 +245,11 @@ describe("validateAndTransformQuery", () => { }) ) - ////////////////////////////// - mockRequest = { query: { fields: "+test_prop,-prop-test-something", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaultFields: [ @@ -249,13 +292,11 @@ describe("validateAndTransformQuery", () => { }) ) - ////////////////////////////// - mockRequest = { query: { fields: "+test_prop,-updated_at", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaults: [ @@ -296,9 +337,9 @@ describe("validateAndTransformQuery", () => { query: { fields: "*product.variants,+product.id", }, - } as unknown as Request - const mockResponse = {} as Response - const nextFunction: NextFunction = jest.fn() + } as unknown as MedusaRequest + const mockResponse = {} as MedusaResponse + const nextFunction: MedusaNextFunction = jest.fn() let queryConfig: any = { defaults: [ @@ -367,13 +408,11 @@ describe("validateAndTransformQuery", () => { }) ) - ////////////////////////////// - mockRequest = { query: { fields: "store.name", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaultFields: [ @@ -423,9 +462,9 @@ describe("validateAndTransformQuery", () => { query: { fields: "+test_prop", }, - } as unknown as Request - const mockResponse = {} as Response - const nextFunction: NextFunction = jest.fn() + } as unknown as MedusaRequest + const mockResponse = {} as MedusaResponse + const nextFunction: MedusaNextFunction = jest.fn() let queryConfig: any = { defaultFields: [ @@ -468,13 +507,11 @@ describe("validateAndTransformQuery", () => { ) ) - ////////////////////////////// - mockRequest = { query: { fields: "product", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaultFields: [ @@ -517,13 +554,11 @@ describe("validateAndTransformQuery", () => { ) ) - ////////////////////////////// - mockRequest = { query: { fields: "store", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaultFields: [ @@ -562,13 +597,11 @@ describe("validateAndTransformQuery", () => { ) ) - ////////////////////////////// - mockRequest = { query: { fields: "*product", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaults: [ @@ -605,13 +638,11 @@ describe("validateAndTransformQuery", () => { ) ) - ////////////////////////////// - mockRequest = { query: { fields: "*product.variants", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaults: [ @@ -649,13 +680,11 @@ describe("validateAndTransformQuery", () => { ) ) - ////////////////////////////// - mockRequest = { query: { fields: "*product", }, - } as unknown as Request + } as unknown as MedusaRequest queryConfig = { defaults: [ diff --git a/packages/core/framework/src/http/index.ts b/packages/core/framework/src/http/index.ts index 9900db069b..57229d120a 100644 --- a/packages/core/framework/src/http/index.ts +++ b/packages/core/framework/src/http/index.ts @@ -2,4 +2,11 @@ export * from "./express-loader" export * from "./router" export * from "./types" export * from "./middlewares" +export * from "./utils/http-compression" +export * from "./utils/validate-body" +export * from "./utils/validate-query" +export * from "./utils/get-query-config" export * from "./utils/define-middlewares" +export * from "./utils/maybe-apply-link-filter" +export * from "./utils/refetch-entities" +export * from "./utils/unless-path" diff --git a/packages/medusa/src/api/utils/middlewares/common/apply-default-filters.ts b/packages/core/framework/src/http/middlewares/apply-default-filters.ts similarity index 85% rename from packages/medusa/src/api/utils/middlewares/common/apply-default-filters.ts rename to packages/core/framework/src/http/middlewares/apply-default-filters.ts index 064be4b303..6cbbd0b688 100644 --- a/packages/medusa/src/api/utils/middlewares/common/apply-default-filters.ts +++ b/packages/core/framework/src/http/middlewares/apply-default-filters.ts @@ -1,11 +1,10 @@ -import { isObject, isPresent } from "@medusajs/framework/utils" -import { NextFunction } from "express" -import { MedusaRequest } from "../../../../types/routing" +import { isObject, isPresent } from "@medusajs/utils" +import { MedusaNextFunction, MedusaRequest } from "../types" export function applyDefaultFilters( filtersToApply: TFilter ) { - return async (req: MedusaRequest, _, next: NextFunction) => { + return async (req: MedusaRequest, _, next: MedusaNextFunction) => { for (const [filter, filterValue] of Object.entries(filtersToApply)) { let valueToApply = filterValue diff --git a/packages/core/framework/src/http/middlewares/apply-params-as-filters.ts b/packages/core/framework/src/http/middlewares/apply-params-as-filters.ts new file mode 100644 index 0000000000..5dfd21f8b8 --- /dev/null +++ b/packages/core/framework/src/http/middlewares/apply-params-as-filters.ts @@ -0,0 +1,13 @@ +import { MedusaNextFunction, MedusaRequest } from "../types" + +export function applyParamsAsFilters(mappings: { [param: string]: string }) { + return async (req: MedusaRequest, _, next: MedusaNextFunction) => { + for (const [param, paramValue] of Object.entries(req.params)) { + if (mappings[param]) { + req.filterableFields[mappings[param]] = paramValue + } + } + + return next() + } +} diff --git a/packages/core/framework/src/http/middlewares/clear-filters-by-key.ts b/packages/core/framework/src/http/middlewares/clear-filters-by-key.ts new file mode 100644 index 0000000000..858ae13e6e --- /dev/null +++ b/packages/core/framework/src/http/middlewares/clear-filters-by-key.ts @@ -0,0 +1,11 @@ +import { MedusaNextFunction, MedusaRequest } from "../types" + +export function clearFiltersByKey(keys: string[]) { + return async (req: MedusaRequest, _, next: MedusaNextFunction) => { + keys.forEach((key) => { + delete req.filterableFields[key] + }) + + return next() + } +} diff --git a/packages/core/framework/src/http/middlewares/ensure-publishable-api-key.ts b/packages/core/framework/src/http/middlewares/ensure-publishable-api-key.ts index 34dd18116b..e6693477fa 100644 --- a/packages/core/framework/src/http/middlewares/ensure-publishable-api-key.ts +++ b/packages/core/framework/src/http/middlewares/ensure-publishable-api-key.ts @@ -1,4 +1,3 @@ -import { Query } from "@medusajs/types" import { ApiKeyType, ContainerRegistrationKeys, @@ -31,7 +30,7 @@ export async function ensurePublishableApiKeyMiddleware( } let apiKey - const query: Query = req.scope.resolve(ContainerRegistrationKeys.QUERY) + const query = req.scope.resolve(ContainerRegistrationKeys.QUERY) try { const { data } = await query.graph( diff --git a/packages/core/framework/src/http/middlewares/error-handler.ts b/packages/core/framework/src/http/middlewares/error-handler.ts index b315cd0448..41bf9f70e6 100644 --- a/packages/core/framework/src/http/middlewares/error-handler.ts +++ b/packages/core/framework/src/http/middlewares/error-handler.ts @@ -3,7 +3,6 @@ import { NextFunction, Response } from "express" import { ContainerRegistrationKeys, MedusaError } from "@medusajs/utils" import { formatException } from "./exception-formatter" import { MedusaRequest } from "../types" -import { logger as logger_ } from "../../logger" const QUERY_RUNNER_RELEASED = "QueryRunnerAlreadyReleasedError" const TRANSACTION_STARTED = "TransactionAlreadyStartedError" @@ -20,9 +19,7 @@ export function errorHandler() { res: Response, next: NextFunction ) => { - const logger: typeof logger_ = req.scope.resolve( - ContainerRegistrationKeys.LOGGER - ) + const logger = req.scope.resolve(ContainerRegistrationKeys.LOGGER) err = formatException(err) diff --git a/packages/core/framework/src/http/middlewares/index.ts b/packages/core/framework/src/http/middlewares/index.ts index 91e8a13a28..2c3e6aaf61 100644 --- a/packages/core/framework/src/http/middlewares/index.ts +++ b/packages/core/framework/src/http/middlewares/index.ts @@ -1,3 +1,7 @@ export * from "./authenticate-middleware" export * from "./error-handler" export * from "./exception-formatter" +export * from "./apply-default-filters" +export * from "./apply-params-as-filters" +export * from "./clear-filters-by-key" +export * from "./set-context" diff --git a/packages/medusa/src/api/utils/middlewares/common/set-context.ts b/packages/core/framework/src/http/middlewares/set-context.ts similarity index 73% rename from packages/medusa/src/api/utils/middlewares/common/set-context.ts rename to packages/core/framework/src/http/middlewares/set-context.ts index c4e19f734e..66fd62540d 100644 --- a/packages/medusa/src/api/utils/middlewares/common/set-context.ts +++ b/packages/core/framework/src/http/middlewares/set-context.ts @@ -1,8 +1,7 @@ -import { NextFunction } from "express" -import { MedusaRequest } from "../../../../types/routing" +import { MedusaNextFunction, MedusaRequest } from "../types" export function setContext(context: Record) { - return async (req: MedusaRequest, _, next: NextFunction) => { + return async (req: MedusaRequest, _, next: MedusaNextFunction) => { const ctx: Record = { ...(req.context || {}) } for (const [contextKey, contextValue] of Object.entries(context || {})) { diff --git a/packages/core/framework/src/http/types.ts b/packages/core/framework/src/http/types.ts index 0539590d88..f1be9677a4 100644 --- a/packages/core/framework/src/http/types.ts +++ b/packages/core/framework/src/http/types.ts @@ -1,17 +1,13 @@ import type { NextFunction, Request, Response } from "express" import { ZodObject } from "zod" -import { MedusaPricingContext, RequestQueryFields } from "@medusajs/types" +import { + FindConfig, + MedusaPricingContext, + RequestQueryFields, +} from "@medusajs/types" import { MedusaContainer } from "../container" -export interface FindConfig { - select?: (keyof Entity)[] - skip?: number - take?: number - relations?: string[] - order?: { [K: string]: "ASC" | "DESC" } -} - /** * List of all the supported HTTP methods */ diff --git a/packages/medusa/src/utils/get-query-config.ts b/packages/core/framework/src/http/utils/get-query-config.ts similarity index 97% rename from packages/medusa/src/utils/get-query-config.ts rename to packages/core/framework/src/http/utils/get-query-config.ts index 7aefb1de61..892bcf665c 100644 --- a/packages/medusa/src/utils/get-query-config.ts +++ b/packages/core/framework/src/http/utils/get-query-config.ts @@ -1,13 +1,12 @@ -import { RequestQueryFields } from "@medusajs/framework/types" +import { pick } from "lodash" +import { RequestQueryFields, FindConfig, QueryConfig } from "@medusajs/types" import { - getSetDifference, isDefined, isPresent, MedusaError, + getSetDifference, stringToSelectRelationObject, -} from "@medusajs/framework/utils" -import { pick } from "lodash" -import { FindConfig, QueryConfig } from "../types/common" +} from "@medusajs/utils" export function pickByConfig( obj: TModel | TModel[], diff --git a/packages/medusa/src/utils/api/http-compression.ts b/packages/core/framework/src/http/utils/http-compression.ts similarity index 66% rename from packages/medusa/src/utils/api/http-compression.ts rename to packages/core/framework/src/http/utils/http-compression.ts index 013681e65e..1aeaa95eda 100644 --- a/packages/medusa/src/utils/api/http-compression.ts +++ b/packages/core/framework/src/http/utils/http-compression.ts @@ -1,12 +1,17 @@ -import { - HttpCompressionOptions, - ProjectConfigOptions, -} from "@medusajs/framework/types" import compression from "compression" -import { Request, Response } from "express" +import type { ConfigModule } from "@medusajs/types" +import { ContainerRegistrationKeys } from "@medusajs/utils" -export function shouldCompressResponse(req: Request, res: Response) { - const { projectConfig } = req.scope.resolve("configModule") +import { HttpCompressionOptions, ProjectConfigOptions } from "../../config" +import type { MedusaRequest, MedusaResponse } from "../types" + +export function shouldCompressResponse( + req: MedusaRequest, + res: MedusaResponse +) { + const { projectConfig } = req.scope.resolve( + ContainerRegistrationKeys.CONFIG_MODULE + ) const { enabled } = compressionOptions(projectConfig) if (!enabled) { diff --git a/packages/medusa/src/api/utils/maybe-apply-link-filter.ts b/packages/core/framework/src/http/utils/maybe-apply-link-filter.ts similarity index 91% rename from packages/medusa/src/api/utils/maybe-apply-link-filter.ts rename to packages/core/framework/src/http/utils/maybe-apply-link-filter.ts index ce34aa8ccc..c7f9f73e88 100644 --- a/packages/medusa/src/api/utils/maybe-apply-link-filter.ts +++ b/packages/core/framework/src/http/utils/maybe-apply-link-filter.ts @@ -2,9 +2,8 @@ import { arrayIntersection, ContainerRegistrationKeys, remoteQueryObjectFromString, -} from "@medusajs/framework/utils" -import { NextFunction } from "express" -import { MedusaRequest } from "../../types/routing" +} from "@medusajs/utils" +import { MedusaNextFunction, MedusaRequest } from "../types" export function maybeApplyLinkFilter({ entryPoint, @@ -12,7 +11,11 @@ export function maybeApplyLinkFilter({ filterableField, filterByField = "id", }) { - return async function linkFilter(req: MedusaRequest, _, next: NextFunction) { + return async function linkFilter( + req: MedusaRequest, + _, + next: MedusaNextFunction + ) { const filterableFields = req.filterableFields if (!filterableFields?.[filterableField]) { diff --git a/packages/medusa/src/api/utils/refetch-entity.ts b/packages/core/framework/src/http/utils/refetch-entities.ts similarity index 87% rename from packages/medusa/src/api/utils/refetch-entity.ts rename to packages/core/framework/src/http/utils/refetch-entities.ts index add64ea1b5..07f1850df9 100644 --- a/packages/medusa/src/api/utils/refetch-entity.ts +++ b/packages/core/framework/src/http/utils/refetch-entities.ts @@ -1,10 +1,10 @@ -import { MedusaContainer } from "@medusajs/framework/types" +import { MedusaContainer } from "@medusajs/types" import { - ContainerRegistrationKeys, isString, + ContainerRegistrationKeys, remoteQueryObjectFromString, -} from "@medusajs/framework/utils" -import { MedusaRequest } from "../../types/routing" +} from "@medusajs/utils" +import { MedusaRequest } from "../types" export const refetchEntities = async ( entryPoint: string, diff --git a/packages/core/framework/src/http/utils/unless-path.ts b/packages/core/framework/src/http/utils/unless-path.ts new file mode 100644 index 0000000000..77b6eef0e5 --- /dev/null +++ b/packages/core/framework/src/http/utils/unless-path.ts @@ -0,0 +1,22 @@ +import { + MedusaNextFunction, + MedusaRequest, + MedusaResponse, + MiddlewareFunction, +} from "../types" + +/** + * Due to how our route loader works, where we load all middlewares before routes, ambiguous routes * end up having all middlewares on different routes executed before the route handler is. + */ +/** + * This function allows us to skip middlewares for particular routes, so we can temporarily solve * * this without completely breaking the route loader for everyone. + */ +export const unlessPath = + (onPath: RegExp, middleware: MiddlewareFunction) => + (req: MedusaRequest, res: MedusaResponse, next: MedusaNextFunction) => { + if (onPath.test(req.path)) { + return next() + } else { + return middleware(req, res, next) + } + } diff --git a/packages/medusa/src/api/utils/validate-body.ts b/packages/core/framework/src/http/utils/validate-body.ts similarity index 87% rename from packages/medusa/src/api/utils/validate-body.ts rename to packages/core/framework/src/http/utils/validate-body.ts index e600f44631..31f64ed1a4 100644 --- a/packages/medusa/src/api/utils/validate-body.ts +++ b/packages/core/framework/src/http/utils/validate-body.ts @@ -1,7 +1,7 @@ -import { NextFunction } from "express" import { z } from "zod" -import { MedusaRequest, MedusaResponse } from "../../types/routing" -import { zodValidator } from "./zod-helper" +import { NextFunction } from "express" +import { MedusaRequest, MedusaResponse } from "../types" +import { zodValidator } from "../../zod/zod-helpers" export function validateAndTransformBody( zodSchema: diff --git a/packages/medusa/src/api/utils/validate-query.ts b/packages/core/framework/src/http/utils/validate-query.ts similarity index 86% rename from packages/medusa/src/api/utils/validate-query.ts rename to packages/core/framework/src/http/utils/validate-query.ts index 38f891332d..6e36c46dc0 100644 --- a/packages/medusa/src/api/utils/validate-query.ts +++ b/packages/core/framework/src/http/utils/validate-query.ts @@ -1,19 +1,12 @@ -import { - BaseEntity, - QueryConfig, - RequestQueryFields, -} from "@medusajs/framework/types" -import { NextFunction } from "express" -import { omit } from "lodash" import { z } from "zod" -import { MedusaRequest, MedusaResponse } from "../../types/routing" -import { removeUndefinedProperties } from "../../utils" -import { - prepareListQuery, - prepareRetrieveQuery, -} from "../../utils/get-query-config" -import { zodValidator } from "./zod-helper" -import { MedusaError } from "@medusajs/framework/utils" +import { omit } from "lodash" +import { NextFunction } from "express" +import { removeUndefinedProperties, MedusaError } from "@medusajs/utils" +import { BaseEntity, QueryConfig, RequestQueryFields } from "@medusajs/types" + +import { zodValidator } from "../../zod/zod-helpers" +import { MedusaRequest, MedusaResponse } from "../types" +import { prepareListQuery, prepareRetrieveQuery } from "./get-query-config" /** * Normalize an input query, especially from array like query params to an array type diff --git a/packages/core/framework/src/index.ts b/packages/core/framework/src/index.ts index cc5cf9c261..7954c016c6 100644 --- a/packages/core/framework/src/index.ts +++ b/packages/core/framework/src/index.ts @@ -10,6 +10,7 @@ export * from "./medusa-app-loader" export * from "./subscribers" export * from "./workflows" export * from "./telemetry" +export * from "./zod" export const MEDUSA_CLI_PATH = require.resolve("@medusajs/medusa-cli") diff --git a/packages/core/framework/src/jobs/index.ts b/packages/core/framework/src/jobs/index.ts index 6cb8e40720..42d45b06eb 100644 --- a/packages/core/framework/src/jobs/index.ts +++ b/packages/core/framework/src/jobs/index.ts @@ -1 +1 @@ -export * from './job-loader' \ No newline at end of file +export * from "./job-loader" diff --git a/packages/core/framework/src/medusa-app-loader.ts b/packages/core/framework/src/medusa-app-loader.ts index 64eea7c669..6f3ad8d897 100644 --- a/packages/core/framework/src/medusa-app-loader.ts +++ b/packages/core/framework/src/medusa-app-loader.ts @@ -33,6 +33,7 @@ import { container as mainContainer, MedusaContainer, } from "./container" +import type { Knex } from "@mikro-orm/knex" export class MedusaAppLoader { /** @@ -106,9 +107,9 @@ export class MedusaAppLoader { protected prepareSharedResourcesAndDeps() { const injectedDependencies = { - [ContainerRegistrationKeys.PG_CONNECTION]: this.#container.resolve( - ContainerRegistrationKeys.PG_CONNECTION - ), + [ContainerRegistrationKeys.PG_CONNECTION]: this.#container.resolve< + Knex + >(ContainerRegistrationKeys.PG_CONNECTION), [ContainerRegistrationKeys.LOGGER]: this.#container.resolve( ContainerRegistrationKeys.LOGGER ), diff --git a/packages/core/framework/src/mikro-orm-cli/bin.ts b/packages/core/framework/src/mikro-orm-cli/bin.ts index 5623d462c2..f131f28d65 100644 --- a/packages/core/framework/src/mikro-orm-cli/bin.ts +++ b/packages/core/framework/src/mikro-orm-cli/bin.ts @@ -1,11 +1,11 @@ /** * Custom wrapper on top of MikroORM CLI to override the issue * they have when importing TypeScript files. - * + * * They have hardcoded the module system of TypeScript to CommonJS * and that makes it impossible to use any other module system * like Node16 or NodeNext and so on. - * + * * With this wrapper, we monkey patch the code responsible for register * ts-node and then boot their CLI. Since, the code footprint is * small, we should be okay with managing this wrapper. @@ -51,7 +51,6 @@ require("@jercle/yargonaut") .style("yellow", "required") .helpStyle("green") .errorsStyle("red") - ;(async () => { const argv = await CLIConfigurator.configure() const args = await argv.parse(process.argv.slice(2)) diff --git a/packages/core/framework/src/workflows-sdk/composer.ts b/packages/core/framework/src/workflows-sdk/composer.ts index 8f3c5e9ee9..170a92e8e0 100644 --- a/packages/core/framework/src/workflows-sdk/composer.ts +++ b/packages/core/framework/src/workflows-sdk/composer.ts @@ -1 +1 @@ -export * from "@medusajs/workflows-sdk/composer" \ No newline at end of file +export * from "@medusajs/workflows-sdk/composer" diff --git a/packages/core/framework/src/zod/index.ts b/packages/core/framework/src/zod/index.ts new file mode 100644 index 0000000000..b80e23a066 --- /dev/null +++ b/packages/core/framework/src/zod/index.ts @@ -0,0 +1 @@ +export * from "./zod-helpers" diff --git a/packages/medusa/src/api/utils/zod-helper.ts b/packages/core/framework/src/zod/zod-helpers.ts similarity index 100% rename from packages/medusa/src/api/utils/zod-helper.ts rename to packages/core/framework/src/zod/zod-helpers.ts diff --git a/packages/core/framework/tsconfig.json b/packages/core/framework/tsconfig.json index f9a18581b3..3ab1d9f244 100644 --- a/packages/core/framework/tsconfig.json +++ b/packages/core/framework/tsconfig.json @@ -1,3 +1,6 @@ { - "extends": "../../../_tsconfig.base.json" + "extends": "../../../_tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src" + } } diff --git a/packages/core/js-sdk/src/admin/upload.ts b/packages/core/js-sdk/src/admin/upload.ts index c482d7aef6..5015367356 100644 --- a/packages/core/js-sdk/src/admin/upload.ts +++ b/packages/core/js-sdk/src/admin/upload.ts @@ -59,9 +59,12 @@ export class Upload { } async delete(id: string, headers?: ClientHeaders) { - return this.client.fetch(`/admin/uploads/${id}`, { - method: "DELETE", - headers, - }) + return this.client.fetch( + `/admin/uploads/${id}`, + { + method: "DELETE", + headers, + } + ) } } diff --git a/packages/core/js-sdk/src/store/index.ts b/packages/core/js-sdk/src/store/index.ts index 1ba06eb58a..33ca17da71 100644 --- a/packages/core/js-sdk/src/store/index.ts +++ b/packages/core/js-sdk/src/store/index.ts @@ -204,12 +204,13 @@ export class Store { lineItemId: string, headers?: ClientHeaders ) => { - return this.client.fetch< - HttpTypes.StoreLineItemDeleteResponse - >(`/store/carts/${cartId}/line-items/${lineItemId}`, { - method: "DELETE", - headers, - }) + return this.client.fetch( + `/store/carts/${cartId}/line-items/${lineItemId}`, + { + method: "DELETE", + headers, + } + ) }, addShippingMethod: async ( cartId: string, @@ -432,12 +433,13 @@ export class Store { ) }, deleteAddress: async (addressId: string, headers?: ClientHeaders) => { - return this.client.fetch< - HttpTypes.StoreCustomerAddressDeleteResponse - >(`/store/customers/me/addresses/${addressId}`, { - method: "DELETE", - headers, - }) + return this.client.fetch( + `/store/customers/me/addresses/${addressId}`, + { + method: "DELETE", + headers, + } + ) }, } } diff --git a/packages/core/modules-sdk/src/loaders/index.ts b/packages/core/modules-sdk/src/loaders/index.ts index c6f66e5cd6..f9089e956c 100644 --- a/packages/core/modules-sdk/src/loaders/index.ts +++ b/packages/core/modules-sdk/src/loaders/index.ts @@ -1,4 +1,3 @@ export * from "./module-loader" export * from "./module-provider-loader" export * from "./register-modules" - diff --git a/packages/core/types/src/auth/provider.ts b/packages/core/types/src/auth/provider.ts index 24176b2ddd..5970920521 100644 --- a/packages/core/types/src/auth/provider.ts +++ b/packages/core/types/src/auth/provider.ts @@ -1,7 +1,7 @@ import { - AuthIdentityDTO, AuthenticationInput, AuthenticationResponse, + AuthIdentityDTO, } from "./common" // This interface currently won't allow for linking multiple providers to a single auth entity. That flow is more complex and not supported yet. diff --git a/packages/core/types/src/auth/service.ts b/packages/core/types/src/auth/service.ts index 2dbaa38d6e..d0a02fb97d 100644 --- a/packages/core/types/src/auth/service.ts +++ b/packages/core/types/src/auth/service.ts @@ -2,9 +2,9 @@ import { FindConfig } from "../common" import { IModuleService } from "../modules-sdk" import { Context } from "../shared-context" import { - AuthIdentityDTO, AuthenticationInput, AuthenticationResponse, + AuthIdentityDTO, CreateAuthIdentityDTO, CreateProviderIdentityDTO, FilterableAuthIdentityProps, diff --git a/packages/core/types/src/cart/service.ts b/packages/core/types/src/cart/service.ts index 027ef9e37d..cc2f315326 100644 --- a/packages/core/types/src/cart/service.ts +++ b/packages/core/types/src/cart/service.ts @@ -32,8 +32,8 @@ import { CreateShippingMethodForSingleCartDTO, CreateShippingMethodTaxLineDTO, UpdateAddressDTO, - UpdateCartDTO, UpdateCartDataDTO, + UpdateCartDTO, UpdateLineItemDTO, UpdateLineItemTaxLineDTO, UpdateLineItemWithSelectorDTO, diff --git a/packages/core/types/src/common/common.ts b/packages/core/types/src/common/common.ts index d46c617e89..761ffdee3f 100644 --- a/packages/core/types/src/common/common.ts +++ b/packages/core/types/src/common/common.ts @@ -306,9 +306,31 @@ export type RawRounding = { /** * @ignore */ -export type QueryConfig = { +export type QueryConfig = { + /** + * Default fields and relations to return + */ defaults?: (keyof TEntity | string)[] - allowed?: (keyof TEntity | string)[] + /** + * @deprecated Use `defaults` instead + */ + defaultFields?: (keyof TEntity | string)[] + /** + * @deprecated Use `defaultFields` instead and the relations will be inferred + */ + defaultRelations?: string[] + /** + * Fields and relations that are allowed to be requested + */ + allowed?: string[] + /** + * @deprecated Use `allowed` instead + */ + allowedFields?: string[] + /** + * @deprecated Use `allowedFields` instead and the relations will be inferred + */ + allowedRelations?: string[] defaultLimit?: number isList?: boolean } diff --git a/packages/core/types/src/common/medusa-cli.ts b/packages/core/types/src/common/medusa-cli.ts index 94f755eac5..1fc9db3437 100644 --- a/packages/core/types/src/common/medusa-cli.ts +++ b/packages/core/types/src/common/medusa-cli.ts @@ -3,4 +3,4 @@ import { MedusaContainer } from "./medusa-container" export type ExecArgs = { container: MedusaContainer args: string[] -} \ No newline at end of file +} diff --git a/packages/core/types/src/file-service/index.ts b/packages/core/types/src/file-service/index.ts index 45ae59be49..99db1247a2 100644 --- a/packages/core/types/src/file-service/index.ts +++ b/packages/core/types/src/file-service/index.ts @@ -2,7 +2,7 @@ import stream from "stream" /** * @interface - * + * * Details of a file upload's result. */ export type FileServiceUploadResult = { @@ -19,7 +19,7 @@ export type FileServiceUploadResult = { /** * @interface - * + * * The relevant details to upload a file through a stream. */ export type FileServiceGetUploadStreamResult = { @@ -44,7 +44,7 @@ export type FileServiceGetUploadStreamResult = { /** * @interface - * + * * The details of a file to retrieve. */ export type GetUploadedFileType = { @@ -61,7 +61,7 @@ export type GetUploadedFileType = { /** * @interface - * + * * The details of the file to remove. */ export type DeleteFileType = { @@ -75,7 +75,7 @@ export type DeleteFileType = { /** * @interface - * + * * The details of the file being uploaded through a stream. */ export type UploadStreamDescriptorType = { diff --git a/packages/core/types/src/fulfillment/provider.ts b/packages/core/types/src/fulfillment/provider.ts index df16bb158a..613a496c9f 100644 --- a/packages/core/types/src/fulfillment/provider.ts +++ b/packages/core/types/src/fulfillment/provider.ts @@ -1,7 +1,7 @@ export type FulfillmentOption = { /** * The option's ID. - * + * * @example express */ id: string diff --git a/packages/core/types/src/http/api-key/admin/responses.ts b/packages/core/types/src/http/api-key/admin/responses.ts index 9a6a47a744..c51545a2ea 100644 --- a/packages/core/types/src/http/api-key/admin/responses.ts +++ b/packages/core/types/src/http/api-key/admin/responses.ts @@ -22,4 +22,4 @@ export type AdminApiKeyListResponse = PaginatedResponse<{ api_keys: AdminApiKey[] }> -export type AdminApiKeyDeleteResponse = DeleteResponse<"api_key"> \ No newline at end of file +export type AdminApiKeyDeleteResponse = DeleteResponse<"api_key"> diff --git a/packages/core/types/src/http/campaign/admin/index.ts b/packages/core/types/src/http/campaign/admin/index.ts index 29d37e7aac..2b6212a0b0 100644 --- a/packages/core/types/src/http/campaign/admin/index.ts +++ b/packages/core/types/src/http/campaign/admin/index.ts @@ -1,4 +1,3 @@ export * from "./payloads" export * from "./queries" export * from "./responses" - diff --git a/packages/core/types/src/http/campaign/admin/responses.ts b/packages/core/types/src/http/campaign/admin/responses.ts index 5d81754921..b035a0116e 100644 --- a/packages/core/types/src/http/campaign/admin/responses.ts +++ b/packages/core/types/src/http/campaign/admin/responses.ts @@ -26,4 +26,4 @@ export interface AdminCampaignResponse { campaign: AdminCampaign } -export type AdminCampaignDeleteResponse = DeleteResponse<"campaign"> \ No newline at end of file +export type AdminCampaignDeleteResponse = DeleteResponse<"campaign"> diff --git a/packages/core/types/src/http/cart/store/entities.ts b/packages/core/types/src/http/cart/store/entities.ts index 5a5b291349..64e7916acc 100644 --- a/packages/core/types/src/http/cart/store/entities.ts +++ b/packages/core/types/src/http/cart/store/entities.ts @@ -20,7 +20,8 @@ export interface StoreCart extends Omit { payment_collection?: StorePaymentCollection region?: StoreRegion } -export interface StoreCartLineItem extends Omit { +export interface StoreCartLineItem + extends Omit { product?: StoreProduct variant?: StoreProductVariant cart: StoreCart @@ -39,4 +40,4 @@ export interface StoreCartShippingMethod extends BaseCartShippingMethod { adjustments?: (BaseShippingMethodAdjustment & { shipping_method: StoreCartShippingMethod })[] -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/cart/store/index.ts b/packages/core/types/src/http/cart/store/index.ts index ba78c783ea..427fd44efc 100644 --- a/packages/core/types/src/http/cart/store/index.ts +++ b/packages/core/types/src/http/cart/store/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./payloads" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/cart/store/payloads.ts b/packages/core/types/src/http/cart/store/payloads.ts index 9237abc82b..f354650043 100644 --- a/packages/core/types/src/http/cart/store/payloads.ts +++ b/packages/core/types/src/http/cart/store/payloads.ts @@ -94,4 +94,4 @@ export interface StoreAddAddress { * Holds custom data in key-value pairs. */ metadata?: Record | null -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/cart/store/responses.ts b/packages/core/types/src/http/cart/store/responses.ts index db2e5e16e2..57e91260e1 100644 --- a/packages/core/types/src/http/cart/store/responses.ts +++ b/packages/core/types/src/http/cart/store/responses.ts @@ -6,17 +6,22 @@ export interface StoreCartResponse { cart: StoreCart } -export type StoreCompleteCartResponse = { - type: "cart" - cart: StoreCart - error: { - message: string - name: string - type: string - } -} | { - type: "order" - order: StoreOrder -} +export type StoreCompleteCartResponse = + | { + type: "cart" + cart: StoreCart + error: { + message: string + name: string + type: string + } + } + | { + type: "order" + order: StoreOrder + } -export type StoreLineItemDeleteResponse = DeleteResponseWithParent<"line-item", StoreCart> \ No newline at end of file +export type StoreLineItemDeleteResponse = DeleteResponseWithParent< + "line-item", + StoreCart +> diff --git a/packages/core/types/src/http/collection/store/index.ts b/packages/core/types/src/http/collection/store/index.ts index bedb8f98bc..020c34f02c 100644 --- a/packages/core/types/src/http/collection/store/index.ts +++ b/packages/core/types/src/http/collection/store/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/collection/store/queries.ts b/packages/core/types/src/http/collection/store/queries.ts index 5b8324794d..44e633a9c7 100644 --- a/packages/core/types/src/http/collection/store/queries.ts +++ b/packages/core/types/src/http/collection/store/queries.ts @@ -1,6 +1,7 @@ -import { OperatorMap } from "../../../dal"; -import { BaseCollectionListParams } from "../common"; +import { OperatorMap } from "../../../dal" +import { BaseCollectionListParams } from "../common" -export interface StoreCollectionFilters extends Omit { +export interface StoreCollectionFilters + extends Omit { deleted_at?: OperatorMap } diff --git a/packages/core/types/src/http/common/response.ts b/packages/core/types/src/http/common/response.ts index 2a2fe1eb86..cbbc0972ab 100644 --- a/packages/core/types/src/http/common/response.ts +++ b/packages/core/types/src/http/common/response.ts @@ -15,14 +15,15 @@ export type DeleteResponse = { deleted: boolean } -export type DeleteResponseWithParent = - DeleteResponse & - { - /** - * The parent resource of the item that was deleted, if applicable. - */ - parent?: TParent - } +export type DeleteResponseWithParent< + TObject extends string, + TParent = {} +> = DeleteResponse & { + /** + * The parent resource of the item that was deleted, if applicable. + */ + parent?: TParent +} export type PaginatedResponse = { limit: number @@ -38,4 +39,4 @@ export type BatchResponse = { object: string deleted: boolean } -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/currency/index.ts b/packages/core/types/src/http/currency/index.ts index 9de75f2175..fbfbb0baed 100644 --- a/packages/core/types/src/http/currency/index.ts +++ b/packages/core/types/src/http/currency/index.ts @@ -1,3 +1,3 @@ export * from "./admin" export * from "./common" -export * from "./store" \ No newline at end of file +export * from "./store" diff --git a/packages/core/types/src/http/currency/store/entities.ts b/packages/core/types/src/http/currency/store/entities.ts index 780d46137c..29595f1523 100644 --- a/packages/core/types/src/http/currency/store/entities.ts +++ b/packages/core/types/src/http/currency/store/entities.ts @@ -1,3 +1,3 @@ -import { BaseCurrency } from "../common"; +import { BaseCurrency } from "../common" -export interface StoreCurrency extends BaseCurrency {} \ No newline at end of file +export interface StoreCurrency extends BaseCurrency {} diff --git a/packages/core/types/src/http/currency/store/index.ts b/packages/core/types/src/http/currency/store/index.ts index bedb8f98bc..020c34f02c 100644 --- a/packages/core/types/src/http/currency/store/index.ts +++ b/packages/core/types/src/http/currency/store/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/currency/store/queries.ts b/packages/core/types/src/http/currency/store/queries.ts index 1f12c0a1fa..6b5d7d60c9 100644 --- a/packages/core/types/src/http/currency/store/queries.ts +++ b/packages/core/types/src/http/currency/store/queries.ts @@ -1,8 +1,9 @@ -import { BaseFilterable } from "../../../dal"; -import { FindParams } from "../../common"; +import { BaseFilterable } from "../../../dal" +import { FindParams } from "../../common" -export interface StoreGetCurrencyListParams extends - FindParams, BaseFilterable { - q?: string - code?: string | string[] - } \ No newline at end of file +export interface StoreGetCurrencyListParams + extends FindParams, + BaseFilterable { + q?: string + code?: string | string[] +} diff --git a/packages/core/types/src/http/currency/store/responses.ts b/packages/core/types/src/http/currency/store/responses.ts index 729eed2f7c..b5619b1f71 100644 --- a/packages/core/types/src/http/currency/store/responses.ts +++ b/packages/core/types/src/http/currency/store/responses.ts @@ -1,5 +1,5 @@ -import { PaginatedResponse } from "../../common"; -import { StoreCurrency } from "./entities"; +import { PaginatedResponse } from "../../common" +import { StoreCurrency } from "./entities" export interface StoreCurrencyResponse { currency: StoreCurrency diff --git a/packages/core/types/src/http/customer-group/admin/index.ts b/packages/core/types/src/http/customer-group/admin/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/customer-group/admin/index.ts +++ b/packages/core/types/src/http/customer-group/admin/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/customer-group/index.ts b/packages/core/types/src/http/customer-group/index.ts index 9335a78736..26b8eb9dad 100644 --- a/packages/core/types/src/http/customer-group/index.ts +++ b/packages/core/types/src/http/customer-group/index.ts @@ -1,2 +1 @@ -export * from "./admin"; - +export * from "./admin" diff --git a/packages/core/types/src/http/customer/admin/index.ts b/packages/core/types/src/http/customer/admin/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/customer/admin/index.ts +++ b/packages/core/types/src/http/customer/admin/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/customer/admin/responses.ts b/packages/core/types/src/http/customer/admin/responses.ts index 9fbadae5c3..253dc6b81c 100644 --- a/packages/core/types/src/http/customer/admin/responses.ts +++ b/packages/core/types/src/http/customer/admin/responses.ts @@ -1,4 +1,8 @@ -import { DeleteResponse, DeleteResponseWithParent, PaginatedResponse } from "../../common" +import { + DeleteResponse, + DeleteResponseWithParent, + PaginatedResponse, +} from "../../common" import { AdminCustomer, AdminCustomerAddress } from "./entities" export interface AdminCustomerResponse { diff --git a/packages/core/types/src/http/customer/store/entities.ts b/packages/core/types/src/http/customer/store/entities.ts index 9177b45b29..aeb274566d 100644 --- a/packages/core/types/src/http/customer/store/entities.ts +++ b/packages/core/types/src/http/customer/store/entities.ts @@ -1,9 +1,6 @@ -import { - BaseCustomer, - BaseCustomerAddress, -} from "../common" +import { BaseCustomer, BaseCustomerAddress } from "../common" export interface StoreCustomer extends Omit { addresses: StoreCustomerAddress[] } -export interface StoreCustomerAddress extends BaseCustomerAddress {} \ No newline at end of file +export interface StoreCustomerAddress extends BaseCustomerAddress {} diff --git a/packages/core/types/src/http/customer/store/index.ts b/packages/core/types/src/http/customer/store/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/customer/store/index.ts +++ b/packages/core/types/src/http/customer/store/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/customer/store/queries.ts b/packages/core/types/src/http/customer/store/queries.ts index 1f74bf7f0b..12748d7b4f 100644 --- a/packages/core/types/src/http/customer/store/queries.ts +++ b/packages/core/types/src/http/customer/store/queries.ts @@ -1,8 +1,5 @@ -import { - BaseCustomerAddressFilters, - BaseCustomerFilters, -} from "../common" +import { BaseCustomerAddressFilters, BaseCustomerFilters } from "../common" export interface StoreCustomerFilters extends BaseCustomerFilters {} export interface StoreCustomerAddressFilters - extends BaseCustomerAddressFilters {} \ No newline at end of file + extends BaseCustomerAddressFilters {} diff --git a/packages/core/types/src/http/customer/store/responses.ts b/packages/core/types/src/http/customer/store/responses.ts index 493c18048c..92ff8eb266 100644 --- a/packages/core/types/src/http/customer/store/responses.ts +++ b/packages/core/types/src/http/customer/store/responses.ts @@ -1,5 +1,5 @@ -import { DeleteResponseWithParent, PaginatedResponse } from "../../common"; -import { StoreCustomer, StoreCustomerAddress } from "./entities"; +import { DeleteResponseWithParent, PaginatedResponse } from "../../common" +import { StoreCustomer, StoreCustomerAddress } from "./entities" export interface StoreCustomerResponse { customer: StoreCustomer @@ -12,4 +12,7 @@ export interface StoreCustomerAddressResponse { export interface StoreCustomerAddressListResponse extends PaginatedResponse<{ addresses: StoreCustomerAddress[] }> {} -export type StoreCustomerAddressDeleteResponse = DeleteResponseWithParent<"address", StoreCustomer> \ No newline at end of file +export type StoreCustomerAddressDeleteResponse = DeleteResponseWithParent< + "address", + StoreCustomer +> diff --git a/packages/core/types/src/http/exchange/admin/entities.ts b/packages/core/types/src/http/exchange/admin/entities.ts index a6e411eadb..ec3d377875 100644 --- a/packages/core/types/src/http/exchange/admin/entities.ts +++ b/packages/core/types/src/http/exchange/admin/entities.ts @@ -1,3 +1,3 @@ -import { BaseExchange } from "../common"; +import { BaseExchange } from "../common" -export interface AdminExchange extends BaseExchange {} \ No newline at end of file +export interface AdminExchange extends BaseExchange {} diff --git a/packages/core/types/src/http/exchange/common.ts b/packages/core/types/src/http/exchange/common.ts index efd8194e69..3367298318 100644 --- a/packages/core/types/src/http/exchange/common.ts +++ b/packages/core/types/src/http/exchange/common.ts @@ -1,6 +1,10 @@ import { OperatorMap } from "../../dal" import { FindParams } from "../common" -import { BaseOrder, BaseOrderShippingMethod, BaseOrderTransaction } from "../order/common" +import { + BaseOrder, + BaseOrderShippingMethod, + BaseOrderTransaction, +} from "../order/common" import { AdminReturn, AdminReturnItem } from "../return" export interface BaseExchangeItem { diff --git a/packages/core/types/src/http/exchange/index.ts b/packages/core/types/src/http/exchange/index.ts index 99595b00b3..26b8eb9dad 100644 --- a/packages/core/types/src/http/exchange/index.ts +++ b/packages/core/types/src/http/exchange/index.ts @@ -1 +1 @@ -export * from "./admin" \ No newline at end of file +export * from "./admin" diff --git a/packages/core/types/src/http/file/admin/entities.ts b/packages/core/types/src/http/file/admin/entities.ts index 15c10b326f..2a4fdf03ad 100644 --- a/packages/core/types/src/http/file/admin/entities.ts +++ b/packages/core/types/src/http/file/admin/entities.ts @@ -1,3 +1,3 @@ import { BaseFile } from "../common" -export interface AdminFile extends BaseFile {} \ No newline at end of file +export interface AdminFile extends BaseFile {} diff --git a/packages/core/types/src/http/file/admin/index.ts b/packages/core/types/src/http/file/admin/index.ts index ba78c783ea..427fd44efc 100644 --- a/packages/core/types/src/http/file/admin/index.ts +++ b/packages/core/types/src/http/file/admin/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./payloads" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/file/admin/payloads.ts b/packages/core/types/src/http/file/admin/payloads.ts index ace748de24..cbaa49c033 100644 --- a/packages/core/types/src/http/file/admin/payloads.ts +++ b/packages/core/types/src/http/file/admin/payloads.ts @@ -1,3 +1,3 @@ -import { BaseUploadFile } from "../common"; +import { BaseUploadFile } from "../common" export type AdminUploadFile = BaseUploadFile diff --git a/packages/core/types/src/http/file/admin/responses.ts b/packages/core/types/src/http/file/admin/responses.ts index 073c4654c7..078955df5c 100644 --- a/packages/core/types/src/http/file/admin/responses.ts +++ b/packages/core/types/src/http/file/admin/responses.ts @@ -1,5 +1,5 @@ -import { DeleteResponse } from "../../common"; -import { AdminFile } from "./entities"; +import { DeleteResponse } from "../../common" +import { AdminFile } from "./entities" export interface AdminFileResponse { file: AdminFile @@ -9,4 +9,4 @@ export interface AdminFileListResponse { files: AdminFile[] } -export type AdminFileDeleteResponse = DeleteResponse<"file"> \ No newline at end of file +export type AdminFileDeleteResponse = DeleteResponse<"file"> diff --git a/packages/core/types/src/http/fulfillment-provider/admin/entities.ts b/packages/core/types/src/http/fulfillment-provider/admin/entities.ts index 907ae77be6..1f56c491fc 100644 --- a/packages/core/types/src/http/fulfillment-provider/admin/entities.ts +++ b/packages/core/types/src/http/fulfillment-provider/admin/entities.ts @@ -1,3 +1,3 @@ -import { BaseFulfillmentProvider } from "../common"; +import { BaseFulfillmentProvider } from "../common" export interface AdminFulfillmentProvider extends BaseFulfillmentProvider {} diff --git a/packages/core/types/src/http/fulfillment-provider/common.ts b/packages/core/types/src/http/fulfillment-provider/common.ts index f2a744b519..2ef57ed389 100644 --- a/packages/core/types/src/http/fulfillment-provider/common.ts +++ b/packages/core/types/src/http/fulfillment-provider/common.ts @@ -1,4 +1,4 @@ export interface BaseFulfillmentProvider { id: string is_enabled: boolean -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/fulfillment/admin/queries.ts b/packages/core/types/src/http/fulfillment/admin/queries.ts index 0356bad84c..48fa6c5ae7 100644 --- a/packages/core/types/src/http/fulfillment/admin/queries.ts +++ b/packages/core/types/src/http/fulfillment/admin/queries.ts @@ -3,4 +3,4 @@ export interface AdminGetFulfillmentProvidersParams { stock_location_id?: string | string[] is_enabled?: boolean q?: string -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/inventory/admin/queries.ts b/packages/core/types/src/http/inventory/admin/queries.ts index b0c1205f7a..29ed3f3301 100644 --- a/packages/core/types/src/http/inventory/admin/queries.ts +++ b/packages/core/types/src/http/inventory/admin/queries.ts @@ -1,7 +1,9 @@ import { FindParams } from "../../common" import { BaseFilterable, OperatorMap } from "../../../dal" -export interface AdminInventoryItemParams extends FindParams, BaseFilterable { +export interface AdminInventoryItemParams + extends FindParams, + BaseFilterable { id?: string | string[] q?: string sku?: string | string[] diff --git a/packages/core/types/src/http/inventory/admin/responses.ts b/packages/core/types/src/http/inventory/admin/responses.ts index 2ae2370b9e..350039ab01 100644 --- a/packages/core/types/src/http/inventory/admin/responses.ts +++ b/packages/core/types/src/http/inventory/admin/responses.ts @@ -1,4 +1,8 @@ -import { DeleteResponse, DeleteResponseWithParent, PaginatedResponse } from "../../common" +import { + DeleteResponse, + DeleteResponseWithParent, + PaginatedResponse, +} from "../../common" import { AdminInventoryItem } from "./entities" export interface AdminInventoryItemResponse { @@ -14,4 +18,4 @@ export type AdminInventoryItemDeleteResponse = DeleteResponse<"inventory_item"> export type AdminInventoryLevelDeleteResponse = DeleteResponseWithParent< "inventory-level", AdminInventoryItem -> \ No newline at end of file +> diff --git a/packages/core/types/src/http/invite/admin/entities.ts b/packages/core/types/src/http/invite/admin/entities.ts index 73ef6a82cf..19dd60b1f0 100644 --- a/packages/core/types/src/http/invite/admin/entities.ts +++ b/packages/core/types/src/http/invite/admin/entities.ts @@ -7,4 +7,4 @@ export interface AdminInvite { metadata?: Record created_at?: Date updated_at?: Date -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/invite/admin/index.ts b/packages/core/types/src/http/invite/admin/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/invite/admin/index.ts +++ b/packages/core/types/src/http/invite/admin/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/invite/admin/payloads.ts b/packages/core/types/src/http/invite/admin/payloads.ts index 0c4ecda627..16a91338ca 100644 --- a/packages/core/types/src/http/invite/admin/payloads.ts +++ b/packages/core/types/src/http/invite/admin/payloads.ts @@ -6,4 +6,4 @@ export type AdminAcceptInvite = { export type AdminCreateInvite = { email: string metadata?: Record -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/invite/admin/queries.ts b/packages/core/types/src/http/invite/admin/queries.ts index fc8be1e707..aa38211fa9 100644 --- a/packages/core/types/src/http/invite/admin/queries.ts +++ b/packages/core/types/src/http/invite/admin/queries.ts @@ -1,11 +1,13 @@ import { BaseFilterable, OperatorMap } from "../../../dal" import { FindParams } from "../../common" -export interface AdminGetInvitesParams extends FindParams, BaseFilterable { +export interface AdminGetInvitesParams + extends FindParams, + BaseFilterable { q?: string id?: string | string[] email?: string | string[] created_at?: OperatorMap updated_at?: OperatorMap deleted_at?: OperatorMap -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/invite/admin/responses.ts b/packages/core/types/src/http/invite/admin/responses.ts index c746992f1f..6f16363b39 100644 --- a/packages/core/types/src/http/invite/admin/responses.ts +++ b/packages/core/types/src/http/invite/admin/responses.ts @@ -1,6 +1,6 @@ -import { DeleteResponse, PaginatedResponse } from "../../common"; -import { AdminUser } from "../../user"; -import { AdminInvite } from "./entities"; +import { DeleteResponse, PaginatedResponse } from "../../common" +import { AdminUser } from "../../user" +import { AdminInvite } from "./entities" export interface AdminInviteResponse { invite: AdminInvite @@ -10,10 +10,12 @@ export type AdminInviteListResponse = PaginatedResponse<{ invites: AdminInvite[] }> -export type AdminAcceptInviteResponse = { - user: AdminUser -} | { - message: string -} +export type AdminAcceptInviteResponse = + | { + user: AdminUser + } + | { + message: string + } -export type AdminInviteDeleteResponse = DeleteResponse<"invite"> \ No newline at end of file +export type AdminInviteDeleteResponse = DeleteResponse<"invite"> diff --git a/packages/core/types/src/http/order/admin/entities.ts b/packages/core/types/src/http/order/admin/entities.ts index 1b25ad988a..8ded34c297 100644 --- a/packages/core/types/src/http/order/admin/entities.ts +++ b/packages/core/types/src/http/order/admin/entities.ts @@ -27,8 +27,11 @@ export interface AdminOrder extends Omit { shipping_methods: AdminOrderShippingMethod[] } -export interface AdminOrderChange extends - Omit { +export interface AdminOrderChange + extends Omit< + BaseOrderChange, + "order" | "claim" | "return_order" | "exchange" | "actions" + > { order: AdminOrder claim: AdminClaim return_order: AdminReturn @@ -36,14 +39,16 @@ export interface AdminOrderChange extends actions: AdminOrderChangeAction[] } -export interface AdminOrderChangeAction extends Omit { +export interface AdminOrderChangeAction + extends Omit { order_change: AdminOrderChange order: AdminOrder | null } export interface AdminOrderFulfillment extends BaseOrderFulfillment {} -export interface AdminOrderLineItem extends Omit { +export interface AdminOrderLineItem + extends Omit { variant?: AdminProductVariant product?: AdminProduct } diff --git a/packages/core/types/src/http/order/admin/index.ts b/packages/core/types/src/http/order/admin/index.ts index e6f4f0a616..07f632fbbd 100644 --- a/packages/core/types/src/http/order/admin/index.ts +++ b/packages/core/types/src/http/order/admin/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payload" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/order/admin/queries.ts b/packages/core/types/src/http/order/admin/queries.ts index 00cd997f2d..72385df4f4 100644 --- a/packages/core/types/src/http/order/admin/queries.ts +++ b/packages/core/types/src/http/order/admin/queries.ts @@ -1,8 +1,7 @@ import { OperatorMap } from "../../../dal" import { FulfillmentStatus, PaymentStatus } from "../../../order" import { FindParams } from "../../common" -import { BaseOrderFilters } from "../common" -import { BaseOrderChangesFilters } from "../common" +import { BaseOrderChangesFilters, BaseOrderFilters } from "../common" export interface AdminOrderFilters extends FindParams, BaseOrderFilters { id?: string[] | string @@ -15,5 +14,4 @@ export interface AdminOrderFilters extends FindParams, BaseOrderFilters { updated_at?: OperatorMap } - export interface AdminOrderChangesFilters extends BaseOrderChangesFilters {} diff --git a/packages/core/types/src/http/order/store/entities.ts b/packages/core/types/src/http/order/store/entities.ts index 37ca0f4e45..f82aca5e3a 100644 --- a/packages/core/types/src/http/order/store/entities.ts +++ b/packages/core/types/src/http/order/store/entities.ts @@ -16,7 +16,8 @@ import { BaseOrderShippingMethodTaxLine, } from "../common" -export interface StoreOrder extends Omit { +export interface StoreOrder + extends Omit { shipping_address?: StoreOrderAddress | null billing_address?: StoreOrderAddress | null items: StoreOrderLineItem[] | null @@ -25,7 +26,8 @@ export interface StoreOrder extends Omit { +export interface StoreOrderLineItem + extends Omit { variant?: StoreProductVariant product?: StoreProduct tax_lines?: (BaseOrderLineItemTaxLine & { @@ -52,4 +54,4 @@ export interface StoreOrderShippingMethod extends BaseOrderShippingMethod { shipping_method: StoreOrderShippingMethod } } -export interface StoreOrderFulfillment extends BaseOrderFulfillment {} \ No newline at end of file +export interface StoreOrderFulfillment extends BaseOrderFulfillment {} diff --git a/packages/core/types/src/http/order/store/index.ts b/packages/core/types/src/http/order/store/index.ts index bedb8f98bc..020c34f02c 100644 --- a/packages/core/types/src/http/order/store/index.ts +++ b/packages/core/types/src/http/order/store/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/order/store/queries.ts b/packages/core/types/src/http/order/store/queries.ts index f61b30b303..a48b1e29b7 100644 --- a/packages/core/types/src/http/order/store/queries.ts +++ b/packages/core/types/src/http/order/store/queries.ts @@ -1,9 +1,10 @@ -import { BaseFilterable } from "../../../dal"; -import { OrderStatus } from "../../../order"; -import { FindParams } from "../../common"; +import { BaseFilterable } from "../../../dal" +import { OrderStatus } from "../../../order" +import { FindParams } from "../../common" -export interface StoreOrderFilters extends - FindParams, BaseFilterable { - id?: string | string[] - status?: OrderStatus | OrderStatus[] - } +export interface StoreOrderFilters + extends FindParams, + BaseFilterable { + id?: string | string[] + status?: OrderStatus | OrderStatus[] +} diff --git a/packages/core/types/src/http/order/store/responses.ts b/packages/core/types/src/http/order/store/responses.ts index de0b7ab039..0aec6f7536 100644 --- a/packages/core/types/src/http/order/store/responses.ts +++ b/packages/core/types/src/http/order/store/responses.ts @@ -1,5 +1,5 @@ -import { PaginatedResponse } from "../../common"; -import { StoreOrder } from "./entities"; +import { PaginatedResponse } from "../../common" +import { StoreOrder } from "./entities" export interface StoreOrderResponse { order: StoreOrder diff --git a/packages/core/types/src/http/payment/admin/entities.ts b/packages/core/types/src/http/payment/admin/entities.ts index 5e04b86a24..25ef2336a4 100644 --- a/packages/core/types/src/http/payment/admin/entities.ts +++ b/packages/core/types/src/http/payment/admin/entities.ts @@ -25,4 +25,4 @@ export interface AdminPaymentSession extends BasePaymentSession { payment_collection?: AdminPaymentCollection } export interface AdminRefund extends BaseRefund {} -export interface AdminRefundReason extends RefundReason {} \ No newline at end of file +export interface AdminRefundReason extends RefundReason {} diff --git a/packages/core/types/src/http/payment/admin/index.ts b/packages/core/types/src/http/payment/admin/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/payment/admin/index.ts +++ b/packages/core/types/src/http/payment/admin/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/payment/admin/queries.ts b/packages/core/types/src/http/payment/admin/queries.ts index 899eaf3ea8..67f77f9def 100644 --- a/packages/core/types/src/http/payment/admin/queries.ts +++ b/packages/core/types/src/http/payment/admin/queries.ts @@ -7,11 +7,12 @@ import { } from "../common" import { AdminRefundReason } from "./entities" -export interface AdminPaymentProviderFilters extends - FindParams, BaseFilterable{ - id: string | string[] - is_enabled?: boolean - } +export interface AdminPaymentProviderFilters + extends FindParams, + BaseFilterable { + id: string | string[] + is_enabled?: boolean +} export interface AdminPaymentCollectionFilters extends BasePaymentCollectionFilters {} export interface AdminPaymentSessionFilters extends BasePaymentSessionFilters {} @@ -24,7 +25,9 @@ export interface AdminPaymentFilters extends FindParams, BasePaymentFilters { deleted_at?: OperatorMap } -export interface RefundReasonFilters extends FindParams, BaseFilterable { +export interface RefundReasonFilters + extends FindParams, + BaseFilterable { id?: string | string[] q?: string } diff --git a/packages/core/types/src/http/payment/store/entities.ts b/packages/core/types/src/http/payment/store/entities.ts index 616be10892..5bb6f453b7 100644 --- a/packages/core/types/src/http/payment/store/entities.ts +++ b/packages/core/types/src/http/payment/store/entities.ts @@ -11,4 +11,4 @@ export interface StorePaymentCollection extends BasePaymentCollection { } export interface StorePaymentSession extends BasePaymentSession { payment_collection?: StorePaymentCollection -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/payment/store/index.ts b/packages/core/types/src/http/payment/store/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/payment/store/index.ts +++ b/packages/core/types/src/http/payment/store/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/payment/store/payloads.ts b/packages/core/types/src/http/payment/store/payloads.ts index d8a8011e34..82ccc9b2f9 100644 --- a/packages/core/types/src/http/payment/store/payloads.ts +++ b/packages/core/types/src/http/payment/store/payloads.ts @@ -1,3 +1,3 @@ export interface StoreCreatePaymentCollection { cart_id: string -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/payment/store/responses.ts b/packages/core/types/src/http/payment/store/responses.ts index 6ac98e36fa..bd59df3197 100644 --- a/packages/core/types/src/http/payment/store/responses.ts +++ b/packages/core/types/src/http/payment/store/responses.ts @@ -1,5 +1,5 @@ -import { PaginatedResponse } from "../../common"; -import { StorePaymentCollection, StorePaymentProvider } from "./entities"; +import { PaginatedResponse } from "../../common" +import { StorePaymentCollection, StorePaymentProvider } from "./entities" export interface StorePaymentCollectionResponse { payment_collection: StorePaymentCollection @@ -7,4 +7,4 @@ export interface StorePaymentCollectionResponse { export type StorePaymentProviderListResponse = PaginatedResponse<{ payment_providers: StorePaymentProvider[] -}> \ No newline at end of file +}> diff --git a/packages/core/types/src/http/price-list/admin/responses.ts b/packages/core/types/src/http/price-list/admin/responses.ts index 09cdc9b71b..ecb0cd9d92 100644 --- a/packages/core/types/src/http/price-list/admin/responses.ts +++ b/packages/core/types/src/http/price-list/admin/responses.ts @@ -22,4 +22,4 @@ export interface AdminPriceListBatchResponse { object: "price" deleted: boolean } -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/product-category/common.ts b/packages/core/types/src/http/product-category/common.ts index 86d0f67f6a..667492309c 100644 --- a/packages/core/types/src/http/product-category/common.ts +++ b/packages/core/types/src/http/product-category/common.ts @@ -22,7 +22,7 @@ export interface BaseProductCategory { export interface BaseProductCategoryListParams extends FindParams, - BaseFilterable { + BaseFilterable { q?: string id?: string | string[] name?: string | string[] diff --git a/packages/core/types/src/http/product-category/store/entities.ts b/packages/core/types/src/http/product-category/store/entities.ts index 5b331eb8cc..2d0f254d12 100644 --- a/packages/core/types/src/http/product-category/store/entities.ts +++ b/packages/core/types/src/http/product-category/store/entities.ts @@ -1,9 +1,16 @@ import { StoreProduct } from "../../product/store" import { BaseProductCategory } from "../common" -export interface StoreProductCategory extends - Omit { - products?: StoreProduct[] - parent_category: StoreProductCategory | null - category_children: StoreProductCategory[] +export interface StoreProductCategory + extends Omit< + BaseProductCategory, + | "is_active" + | "is_internal" + | "products" + | "parent_category" + | "category_children" + > { + products?: StoreProduct[] + parent_category: StoreProductCategory | null + category_children: StoreProductCategory[] } diff --git a/packages/core/types/src/http/product/admin/queries.ts b/packages/core/types/src/http/product/admin/queries.ts index e273d21f86..39ea1785c7 100644 --- a/packages/core/types/src/http/product/admin/queries.ts +++ b/packages/core/types/src/http/product/admin/queries.ts @@ -1,22 +1,22 @@ import { BaseFilterable, OperatorMap } from "../../../dal" import { FindParams } from "../../common" -import { - BaseProductListParams, - BaseProductOptionParams, -} from "../common" +import { BaseProductListParams, BaseProductOptionParams } from "../common" -export interface AdminProductOptionParams extends Omit {} -export interface AdminProductVariantParams extends - FindParams, BaseFilterable { - q?: string - id?: string | string[] - manage_inventory?: boolean - allow_backorder?: boolean - created_at?: OperatorMap - updated_at?: OperatorMap - deleted_at?: OperatorMap - } -export interface AdminProductListParams extends Omit { +export interface AdminProductOptionParams + extends Omit {} +export interface AdminProductVariantParams + extends FindParams, + BaseFilterable { + q?: string + id?: string | string[] + manage_inventory?: boolean + allow_backorder?: boolean + created_at?: OperatorMap + updated_at?: OperatorMap + deleted_at?: OperatorMap +} +export interface AdminProductListParams + extends Omit { price_list_id?: string | string[] variants?: AdminProductVariantParams } diff --git a/packages/core/types/src/http/product/admin/responses.ts b/packages/core/types/src/http/product/admin/responses.ts index cc7eeb453f..0749cd3661 100644 --- a/packages/core/types/src/http/product/admin/responses.ts +++ b/packages/core/types/src/http/product/admin/responses.ts @@ -1,4 +1,9 @@ -import { BatchResponse, DeleteResponse, DeleteResponseWithParent, PaginatedResponse } from "../../common" +import { + BatchResponse, + DeleteResponse, + DeleteResponseWithParent, + PaginatedResponse, +} from "../../common" import { AdminProduct, AdminProductOption, @@ -60,7 +65,9 @@ export type AdminProductOptionListResponse = PaginatedResponse<{ export interface AdminProductOptionDeleteResponse extends DeleteResponseWithParent<"product_option", AdminProduct> {} -export type AdminProductVariantInventoryResponse = AdminProductVariantInventoryLink | AdminProductVariantInventoryLink[] +export type AdminProductVariantInventoryResponse = + | AdminProductVariantInventoryLink + | AdminProductVariantInventoryLink[] export interface AdminProductVariantInventoryBatchResponse { created: AdminProductVariantInventoryResponse @@ -73,4 +80,4 @@ export interface AdminProductVariantInventoryLinkDeleteResponse { object: "variant-inventory-item-link" deleted: boolean parent: AdminProductVariant -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/product/store/entitites.ts b/packages/core/types/src/http/product/store/entitites.ts index ed14e21f6d..e621616160 100644 --- a/packages/core/types/src/http/product/store/entitites.ts +++ b/packages/core/types/src/http/product/store/entitites.ts @@ -11,7 +11,11 @@ import { ProductStatus, } from "../common" -export interface StoreProduct extends Omit { +export interface StoreProduct + extends Omit< + BaseProduct, + "categories" | "sales_channels" | "variants" | "options" | "collection" + > { collection?: StoreCollection | null categories?: StoreProductCategory[] | null variants: StoreProductVariant[] | null @@ -20,16 +24,19 @@ export interface StoreProduct extends Omit { +export interface StoreProductVariant + extends Omit { options: StoreProductOptionValue[] | null product?: StoreProduct | null } -export interface StoreProductOption extends Omit { +export interface StoreProductOption + extends Omit { product?: StoreProduct | null values?: StoreProductOptionValue[] } export interface StoreProductImage extends BaseProductImage {} -export interface StoreProductOptionValue extends Omit { +export interface StoreProductOptionValue + extends Omit { option?: StoreProductOption | null } export type StoreProductStatus = ProductStatus diff --git a/packages/core/types/src/http/product/store/queries.ts b/packages/core/types/src/http/product/store/queries.ts index 522503fc02..90f7ea2a1f 100644 --- a/packages/core/types/src/http/product/store/queries.ts +++ b/packages/core/types/src/http/product/store/queries.ts @@ -6,7 +6,8 @@ import { export interface StoreProductOptionParams extends BaseProductOptionParams {} export interface StoreProductVariantParams extends BaseProductVariantParams {} -export interface StoreProductParams extends Omit { +export interface StoreProductParams + extends Omit { tag_id?: string | string[] // The region ID and currency_code are not params, but are used for the pricing context. Maybe move to separate type definition. region_id?: string diff --git a/packages/core/types/src/http/promotion/admin/entities.ts b/packages/core/types/src/http/promotion/admin/entities.ts index 13e68e8846..b1239014dd 100644 --- a/packages/core/types/src/http/promotion/admin/entities.ts +++ b/packages/core/types/src/http/promotion/admin/entities.ts @@ -1,11 +1,11 @@ -import { +import { BaseApplicationMethod, - BasePromotion, - BasePromotionRule, - BaseRuleAttributeOptions, - BaseRuleOperatorOptions, - BaseRuleValueOptions -} from "../common"; + BasePromotion, + BasePromotionRule, + BaseRuleAttributeOptions, + BaseRuleOperatorOptions, + BaseRuleValueOptions, +} from "../common" export interface AdminPromotion extends BasePromotion { application_method?: AdminApplicationMethod @@ -19,4 +19,4 @@ export interface AdminApplicationMethod extends BaseApplicationMethod { export interface AdminPromotionRule extends BasePromotionRule {} export interface AdminRuleAttributeOption extends BaseRuleAttributeOptions {} export interface AdminRuleOperatorOption extends BaseRuleOperatorOptions {} -export interface AdminRuleValueOption extends BaseRuleValueOptions {} \ No newline at end of file +export interface AdminRuleValueOption extends BaseRuleValueOptions {} diff --git a/packages/core/types/src/http/promotion/admin/payloads.ts b/packages/core/types/src/http/promotion/admin/payloads.ts index 65b3d73d51..3d44807bee 100644 --- a/packages/core/types/src/http/promotion/admin/payloads.ts +++ b/packages/core/types/src/http/promotion/admin/payloads.ts @@ -1,9 +1,9 @@ import { - ApplicationMethodAllocationValues, - ApplicationMethodTargetTypeValues, - ApplicationMethodTypeValues, - PromotionRuleOperatorValues, - PromotionTypeValues, + ApplicationMethodAllocationValues, + ApplicationMethodTargetTypeValues, + ApplicationMethodTypeValues, + PromotionRuleOperatorValues, + PromotionTypeValues, } from "../../../promotion" import { AdminCreateCampaign } from "../../campaign" diff --git a/packages/core/types/src/http/promotion/admin/responses.ts b/packages/core/types/src/http/promotion/admin/responses.ts index b338c39e3e..7aed19c8b5 100644 --- a/packages/core/types/src/http/promotion/admin/responses.ts +++ b/packages/core/types/src/http/promotion/admin/responses.ts @@ -1,11 +1,11 @@ -import { BatchResponse, DeleteResponse, PaginatedResponse } from "../../common"; -import { - AdminPromotion, - AdminPromotionRule, - AdminRuleAttributeOption, - AdminRuleOperatorOption, - AdminRuleValueOption -} from "./entities"; +import { BatchResponse, DeleteResponse, PaginatedResponse } from "../../common" +import { + AdminPromotion, + AdminPromotionRule, + AdminRuleAttributeOption, + AdminRuleOperatorOption, + AdminRuleValueOption, +} from "./entities" export interface AdminPromotionResponse { promotion: AdminPromotion @@ -55,4 +55,4 @@ export type AdminRuleValueOptionsListResponse = { export type AdminPromotionRuleBatchResponse = BatchResponse -export type AdminPromotionDeleteResponse = DeleteResponse<"promotion"> \ No newline at end of file +export type AdminPromotionDeleteResponse = DeleteResponse<"promotion"> diff --git a/packages/core/types/src/http/promotion/common.ts b/packages/core/types/src/http/promotion/common.ts index a829b08c18..7d5d4037f5 100644 --- a/packages/core/types/src/http/promotion/common.ts +++ b/packages/core/types/src/http/promotion/common.ts @@ -1,9 +1,9 @@ -import { - ApplicationMethodAllocationValues, - ApplicationMethodTargetTypeValues, - ApplicationMethodTypeValues, - PromotionRuleOperatorValues, - PromotionTypeValues +import { + ApplicationMethodAllocationValues, + ApplicationMethodTargetTypeValues, + ApplicationMethodTypeValues, + PromotionRuleOperatorValues, + PromotionTypeValues, } from "../../promotion" import { AdminCampaign } from "../campaign" @@ -78,4 +78,4 @@ export interface BaseRuleOperatorOptions { export interface BaseRuleValueOptions { value: string label: string -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/region/admin/entities.ts b/packages/core/types/src/http/region/admin/entities.ts index efceaecfa3..7d3c377d1d 100644 --- a/packages/core/types/src/http/region/admin/entities.ts +++ b/packages/core/types/src/http/region/admin/entities.ts @@ -1,9 +1,6 @@ -import { - BaseRegion, - BaseRegionCountry, -} from "../common" +import { BaseRegion, BaseRegionCountry } from "../common" export interface AdminRegion extends Omit { countries?: AdminRegionCountry[] } -export interface AdminRegionCountry extends BaseRegionCountry {} \ No newline at end of file +export interface AdminRegionCountry extends BaseRegionCountry {} diff --git a/packages/core/types/src/http/region/admin/index.ts b/packages/core/types/src/http/region/admin/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/region/admin/index.ts +++ b/packages/core/types/src/http/region/admin/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/region/admin/responses.ts b/packages/core/types/src/http/region/admin/responses.ts index 8bc2717413..5a1a924108 100644 --- a/packages/core/types/src/http/region/admin/responses.ts +++ b/packages/core/types/src/http/region/admin/responses.ts @@ -1,5 +1,5 @@ -import { DeleteResponse, PaginatedResponse } from "../../common"; -import { AdminRegion } from "./entities"; +import { DeleteResponse, PaginatedResponse } from "../../common" +import { AdminRegion } from "./entities" export interface AdminRegionResponse { region: AdminRegion @@ -9,4 +9,4 @@ export type AdminRegionListResponse = PaginatedResponse<{ regions: AdminRegion[] }> -export type AdminRegionDeleteResponse = DeleteResponse<"region"> \ No newline at end of file +export type AdminRegionDeleteResponse = DeleteResponse<"region"> diff --git a/packages/core/types/src/http/region/store/entities.ts b/packages/core/types/src/http/region/store/entities.ts index a0157f33a0..ab223f48b5 100644 --- a/packages/core/types/src/http/region/store/entities.ts +++ b/packages/core/types/src/http/region/store/entities.ts @@ -1,7 +1,4 @@ -import { - BaseRegion, - BaseRegionCountry, -} from "../common" +import { BaseRegion, BaseRegionCountry } from "../common" export interface StoreRegion extends BaseRegion {} -export interface StoreRegionCountry extends BaseRegionCountry {} \ No newline at end of file +export interface StoreRegionCountry extends BaseRegionCountry {} diff --git a/packages/core/types/src/http/region/store/index.ts b/packages/core/types/src/http/region/store/index.ts index bedb8f98bc..020c34f02c 100644 --- a/packages/core/types/src/http/region/store/index.ts +++ b/packages/core/types/src/http/region/store/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/region/store/queries.ts b/packages/core/types/src/http/region/store/queries.ts index 6aa6513394..9b2eafcc8f 100644 --- a/packages/core/types/src/http/region/store/queries.ts +++ b/packages/core/types/src/http/region/store/queries.ts @@ -1,7 +1,5 @@ -import { - BaseRegionCountryFilters, - BaseRegionFilters, -} from "../common" +import { BaseRegionCountryFilters, BaseRegionFilters } from "../common" -export interface StoreRegionFilters extends Omit {} +export interface StoreRegionFilters + extends Omit {} export interface StoreRegionCountryFilters extends BaseRegionCountryFilters {} diff --git a/packages/core/types/src/http/region/store/responses.ts b/packages/core/types/src/http/region/store/responses.ts index fb01c28c35..955ea62940 100644 --- a/packages/core/types/src/http/region/store/responses.ts +++ b/packages/core/types/src/http/region/store/responses.ts @@ -1,8 +1,10 @@ -import { PaginatedResponse } from "../../common"; -import { StoreRegion } from "./entities"; +import { PaginatedResponse } from "../../common" +import { StoreRegion } from "./entities" export type StoreRegionResponse = { region: StoreRegion } -export type StoreRegionListResponse = PaginatedResponse<{ regions: StoreRegion[] }> \ No newline at end of file +export type StoreRegionListResponse = PaginatedResponse<{ + regions: StoreRegion[] +}> diff --git a/packages/core/types/src/http/reservation/admin/entities.ts b/packages/core/types/src/http/reservation/admin/entities.ts index 1dd9300716..b93f1d6abd 100644 --- a/packages/core/types/src/http/reservation/admin/entities.ts +++ b/packages/core/types/src/http/reservation/admin/entities.ts @@ -14,4 +14,4 @@ export interface AdminReservation { deleted_at?: Date | string | null created_at?: Date | string updated_at?: Date | string -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/reservation/admin/responses.ts b/packages/core/types/src/http/reservation/admin/responses.ts index 693d3f8708..95b2cce141 100644 --- a/packages/core/types/src/http/reservation/admin/responses.ts +++ b/packages/core/types/src/http/reservation/admin/responses.ts @@ -9,4 +9,4 @@ export type AdminReservationListResponse = PaginatedResponse<{ reservations: AdminReservation[] }> -export type AdminReservationDeleteResponse = DeleteResponse<"reservation"> \ No newline at end of file +export type AdminReservationDeleteResponse = DeleteResponse<"reservation"> diff --git a/packages/core/types/src/http/return-reason/admin/payloads.ts b/packages/core/types/src/http/return-reason/admin/payloads.ts index c70596b429..8475f2d320 100644 --- a/packages/core/types/src/http/return-reason/admin/payloads.ts +++ b/packages/core/types/src/http/return-reason/admin/payloads.ts @@ -9,5 +9,4 @@ export interface AdminCreateReturnReason extends AdminBaseReturnReasonPayload { parent_return_reason_id?: string } -export interface AdminUpdateReturnReason extends AdminBaseReturnReasonPayload { -} +export interface AdminUpdateReturnReason extends AdminBaseReturnReasonPayload {} diff --git a/packages/core/types/src/http/return-reason/index.ts b/packages/core/types/src/http/return-reason/index.ts index 9ef1c8109b..3bd2bd2cc0 100644 --- a/packages/core/types/src/http/return-reason/index.ts +++ b/packages/core/types/src/http/return-reason/index.ts @@ -1,2 +1,2 @@ export * from "./admin" -export * from "./store" \ No newline at end of file +export * from "./store" diff --git a/packages/core/types/src/http/return-reason/store/entities.ts b/packages/core/types/src/http/return-reason/store/entities.ts index d6e116dcc7..d997eee47b 100644 --- a/packages/core/types/src/http/return-reason/store/entities.ts +++ b/packages/core/types/src/http/return-reason/store/entities.ts @@ -1,3 +1,3 @@ -import { BaseReturnReason } from "../common"; +import { BaseReturnReason } from "../common" -export interface StoreReturnReason extends BaseReturnReason {} \ No newline at end of file +export interface StoreReturnReason extends BaseReturnReason {} diff --git a/packages/core/types/src/http/return-reason/store/index.ts b/packages/core/types/src/http/return-reason/store/index.ts index 57fa23181b..e6c04bce7f 100644 --- a/packages/core/types/src/http/return-reason/store/index.ts +++ b/packages/core/types/src/http/return-reason/store/index.ts @@ -1,2 +1,2 @@ export * from "./entities" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/return-reason/store/responses.ts b/packages/core/types/src/http/return-reason/store/responses.ts index 7e6dffb443..7611eabd05 100644 --- a/packages/core/types/src/http/return-reason/store/responses.ts +++ b/packages/core/types/src/http/return-reason/store/responses.ts @@ -1,5 +1,5 @@ -import { PaginatedResponse } from "../../common"; -import { StoreReturnReason } from "./entities"; +import { PaginatedResponse } from "../../common" +import { StoreReturnReason } from "./entities" export interface StoreReturnReasonResponse { return_reason: StoreReturnReason @@ -7,4 +7,4 @@ export interface StoreReturnReasonResponse { export type StoreReturnReasonListResponse = PaginatedResponse<{ return_reasons: StoreReturnReason[] -}> \ No newline at end of file +}> diff --git a/packages/core/types/src/http/return/admin/entities.ts b/packages/core/types/src/http/return/admin/entities.ts index 50d3141afa..ef57aecda7 100644 --- a/packages/core/types/src/http/return/admin/entities.ts +++ b/packages/core/types/src/http/return/admin/entities.ts @@ -1,6 +1,6 @@ -import { BaseReturn, BaseReturnItem } from "../common"; +import { BaseReturn, BaseReturnItem } from "../common" export interface AdminReturnItem extends BaseReturnItem {} export interface AdminReturn extends BaseReturn { items: AdminReturnItem[] -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/return/admin/index.ts b/packages/core/types/src/http/return/admin/index.ts index 2f1b9df166..1f82a2ead5 100644 --- a/packages/core/types/src/http/return/admin/index.ts +++ b/packages/core/types/src/http/return/admin/index.ts @@ -1,4 +1,4 @@ export * from "./entities" export * from "./payloads" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/return/admin/responses.ts b/packages/core/types/src/http/return/admin/responses.ts index 46a87b088f..f3b3c368b8 100644 --- a/packages/core/types/src/http/return/admin/responses.ts +++ b/packages/core/types/src/http/return/admin/responses.ts @@ -21,4 +21,4 @@ export interface AdminReturnPreviewResponse { return: AdminReturn } -export type AdminReturnDeleteResponse = DeleteResponse<"return"> \ No newline at end of file +export type AdminReturnDeleteResponse = DeleteResponse<"return"> diff --git a/packages/core/types/src/http/return/index.ts b/packages/core/types/src/http/return/index.ts index 9ef1c8109b..3bd2bd2cc0 100644 --- a/packages/core/types/src/http/return/index.ts +++ b/packages/core/types/src/http/return/index.ts @@ -1,2 +1,2 @@ export * from "./admin" -export * from "./store" \ No newline at end of file +export * from "./store" diff --git a/packages/core/types/src/http/return/store/entities.ts b/packages/core/types/src/http/return/store/entities.ts index d0f1ad2a92..676dfe1eda 100644 --- a/packages/core/types/src/http/return/store/entities.ts +++ b/packages/core/types/src/http/return/store/entities.ts @@ -1,6 +1,7 @@ -import { BaseReturn, BaseReturnItem } from "../common"; +import { BaseReturn, BaseReturnItem } from "../common" -export interface StoreReturn extends Omit { +export interface StoreReturn + extends Omit { items: StoreReturnItem[] } export interface StoreReturnItem extends BaseReturnItem {} diff --git a/packages/core/types/src/http/return/store/index.ts b/packages/core/types/src/http/return/store/index.ts index ba78c783ea..427fd44efc 100644 --- a/packages/core/types/src/http/return/store/index.ts +++ b/packages/core/types/src/http/return/store/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./payloads" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/return/store/payloads.ts b/packages/core/types/src/http/return/store/payloads.ts index 348932f6c7..7ad129e503 100644 --- a/packages/core/types/src/http/return/store/payloads.ts +++ b/packages/core/types/src/http/return/store/payloads.ts @@ -17,4 +17,4 @@ export interface StoreCreateReturn { note?: string | null receive_now?: boolean location_id?: string | null -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/return/store/responses.ts b/packages/core/types/src/http/return/store/responses.ts index b8aae4b3ea..0ba61c6c58 100644 --- a/packages/core/types/src/http/return/store/responses.ts +++ b/packages/core/types/src/http/return/store/responses.ts @@ -1,5 +1,5 @@ -import { StoreReturn } from "./entities"; +import { StoreReturn } from "./entities" export interface StoreReturnResponse { return: StoreReturn -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/shipping-option/admin/responses.ts b/packages/core/types/src/http/shipping-option/admin/responses.ts index 9118173e3f..4f0908367f 100644 --- a/packages/core/types/src/http/shipping-option/admin/responses.ts +++ b/packages/core/types/src/http/shipping-option/admin/responses.ts @@ -12,4 +12,5 @@ export type AdminShippingOptionListResponse = PaginatedResponse<{ export interface AdminShippingOptionDeleteResponse extends DeleteResponse<"shipping_option"> {} -export type AdminUpdateShippingOptionRulesResponse = BatchResponse \ No newline at end of file +export type AdminUpdateShippingOptionRulesResponse = + BatchResponse diff --git a/packages/core/types/src/http/shipping-option/index.ts b/packages/core/types/src/http/shipping-option/index.ts index 9ef1c8109b..3bd2bd2cc0 100644 --- a/packages/core/types/src/http/shipping-option/index.ts +++ b/packages/core/types/src/http/shipping-option/index.ts @@ -1,2 +1,2 @@ export * from "./admin" -export * from "./store" \ No newline at end of file +export * from "./store" diff --git a/packages/core/types/src/http/shipping-option/store/entities.ts b/packages/core/types/src/http/shipping-option/store/entities.ts index 32ef95a1ec..a438ed21c0 100644 --- a/packages/core/types/src/http/shipping-option/store/entities.ts +++ b/packages/core/types/src/http/shipping-option/store/entities.ts @@ -26,4 +26,4 @@ export interface StoreShippingOption { is_tax_inclusive: boolean data: Record | null metadata: Record | null -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/shipping-option/store/index.ts b/packages/core/types/src/http/shipping-option/store/index.ts index bedb8f98bc..020c34f02c 100644 --- a/packages/core/types/src/http/shipping-option/store/index.ts +++ b/packages/core/types/src/http/shipping-option/store/index.ts @@ -1,3 +1,3 @@ export * from "./entities" export * from "./queries" -export * from "./responses" \ No newline at end of file +export * from "./responses" diff --git a/packages/core/types/src/http/shipping-option/store/queries.ts b/packages/core/types/src/http/shipping-option/store/queries.ts index fd13b92e3c..e1a55ba6c0 100644 --- a/packages/core/types/src/http/shipping-option/store/queries.ts +++ b/packages/core/types/src/http/shipping-option/store/queries.ts @@ -1,7 +1,8 @@ -import { BaseFilterable } from "../../../dal"; -import { FindParams } from "../../common"; +import { BaseFilterable } from "../../../dal" +import { FindParams } from "../../common" -export interface StoreGetShippingOptionList extends - FindParams, BaseFilterable { - cart_id: string - } \ No newline at end of file +export interface StoreGetShippingOptionList + extends FindParams, + BaseFilterable { + cart_id: string +} diff --git a/packages/core/types/src/http/shipping-option/store/responses.ts b/packages/core/types/src/http/shipping-option/store/responses.ts index e6402d6a30..2c5f446099 100644 --- a/packages/core/types/src/http/shipping-option/store/responses.ts +++ b/packages/core/types/src/http/shipping-option/store/responses.ts @@ -1,5 +1,5 @@ -import { StoreShippingOption } from "."; +import { StoreShippingOption } from "." export interface StoreShippingOptionListResponse { shipping_options: StoreShippingOption[] -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/stock-locations/admin/queries.ts b/packages/core/types/src/http/stock-locations/admin/queries.ts index 68d3aff4d9..e49c1cfbe7 100644 --- a/packages/core/types/src/http/stock-locations/admin/queries.ts +++ b/packages/core/types/src/http/stock-locations/admin/queries.ts @@ -1,16 +1,17 @@ import { BaseFilterable, OperatorMap } from "../../../dal" import { FindParams } from "../../common" -export interface AdminStockLocationListParams extends - FindParams, BaseFilterable { - id?: string | string[] - q?: string - name?: string | string[] - address_id?: string | string[] - sales_channel_id?: string | string[] - $and?: AdminStockLocationListParams[] - $or?: AdminStockLocationListParams[] - created_at?: OperatorMap - updated_at?: OperatorMap - deleted_at?: OperatorMap - } +export interface AdminStockLocationListParams + extends FindParams, + BaseFilterable { + id?: string | string[] + q?: string + name?: string | string[] + address_id?: string | string[] + sales_channel_id?: string | string[] + $and?: AdminStockLocationListParams[] + $or?: AdminStockLocationListParams[] + created_at?: OperatorMap + updated_at?: OperatorMap + deleted_at?: OperatorMap +} diff --git a/packages/core/types/src/http/tax-rate/admin/queries.ts b/packages/core/types/src/http/tax-rate/admin/queries.ts index 6fc1f92736..f3ee81e1d5 100644 --- a/packages/core/types/src/http/tax-rate/admin/queries.ts +++ b/packages/core/types/src/http/tax-rate/admin/queries.ts @@ -1,16 +1,17 @@ import { BaseFilterable, OperatorMap } from "../../../dal" import { FindParams } from "../../common" -export interface AdminTaxRateListParams extends - FindParams, BaseFilterable { - q?: string - tax_region_id?: string | string[] | OperatorMap - is_default?: "true" | "false" - service_zone_id?: string - shipping_profile_id?: string - provider_id?: string - shipping_option_type_id?: string - created_at?: OperatorMap - updated_at?: OperatorMap - deleted_at?: OperatorMap - } +export interface AdminTaxRateListParams + extends FindParams, + BaseFilterable { + q?: string + tax_region_id?: string | string[] | OperatorMap + is_default?: "true" | "false" + service_zone_id?: string + shipping_profile_id?: string + provider_id?: string + shipping_option_type_id?: string + created_at?: OperatorMap + updated_at?: OperatorMap + deleted_at?: OperatorMap +} diff --git a/packages/core/types/src/http/tax-rate/admin/responses.ts b/packages/core/types/src/http/tax-rate/admin/responses.ts index c9a70de3d2..ae603652c9 100644 --- a/packages/core/types/src/http/tax-rate/admin/responses.ts +++ b/packages/core/types/src/http/tax-rate/admin/responses.ts @@ -1,4 +1,8 @@ -import { DeleteResponse, DeleteResponseWithParent, PaginatedResponse } from "../../common" +import { + DeleteResponse, + DeleteResponseWithParent, + PaginatedResponse, +} from "../../common" import { AdminTaxRate } from "./entities" export interface AdminTaxRateResponse { @@ -12,4 +16,7 @@ export type AdminTaxRateListResponse = PaginatedResponse<{ export interface AdminTaxRateDeleteResponse extends DeleteResponse<"tax_rate"> {} -export type AdminTaxRateRuleDeleteResponse = DeleteResponseWithParent<"tax_rate_rule", AdminTaxRate> \ No newline at end of file +export type AdminTaxRateRuleDeleteResponse = DeleteResponseWithParent< + "tax_rate_rule", + AdminTaxRate +> diff --git a/packages/core/types/src/http/user/index.ts b/packages/core/types/src/http/user/index.ts index 9335a78736..26b8eb9dad 100644 --- a/packages/core/types/src/http/user/index.ts +++ b/packages/core/types/src/http/user/index.ts @@ -1,2 +1 @@ -export * from "./admin"; - +export * from "./admin" diff --git a/packages/core/types/src/http/workflow-execution/admin/index.ts b/packages/core/types/src/http/workflow-execution/admin/index.ts index 3b6853ce1c..020c34f02c 100644 --- a/packages/core/types/src/http/workflow-execution/admin/index.ts +++ b/packages/core/types/src/http/workflow-execution/admin/index.ts @@ -1,4 +1,3 @@ export * from "./entities" export * from "./queries" export * from "./responses" - diff --git a/packages/core/types/src/http/workflow-execution/admin/responses.ts b/packages/core/types/src/http/workflow-execution/admin/responses.ts index f8959ff585..41552d9a7f 100644 --- a/packages/core/types/src/http/workflow-execution/admin/responses.ts +++ b/packages/core/types/src/http/workflow-execution/admin/responses.ts @@ -12,4 +12,4 @@ export type AdminWorkflowExecutionListResponse = PaginatedResponse<{ export type AdminWorkflowRunResponse = { acknowledgement: Acknowledgement -} \ No newline at end of file +} diff --git a/packages/core/types/src/http/workflow-execution/index.ts b/packages/core/types/src/http/workflow-execution/index.ts index 99595b00b3..26b8eb9dad 100644 --- a/packages/core/types/src/http/workflow-execution/index.ts +++ b/packages/core/types/src/http/workflow-execution/index.ts @@ -1 +1 @@ -export * from "./admin" \ No newline at end of file +export * from "./admin" diff --git a/packages/core/types/src/order/common.ts b/packages/core/types/src/order/common.ts index 615b160570..b3b0d16d64 100644 --- a/packages/core/types/src/order/common.ts +++ b/packages/core/types/src/order/common.ts @@ -25,7 +25,12 @@ export type ChangeActionType = | "WRITE_OFF_ITEM" | "REINSTATE_ITEM" -export type OrderChangeStatus = "confirmed" | "declined" | "requested" | "pending" | "canceled" +export type OrderChangeStatus = + | "confirmed" + | "declined" + | "requested" + | "pending" + | "canceled" /** * @interface @@ -115,7 +120,7 @@ export type OrderSummaryDTO = { /** * The raw pending difference of the order. - * + * * @ignore */ raw_pending_difference: BigNumberRawValue @@ -279,14 +284,14 @@ export interface OrderShippingMethodTaxLineDTO extends OrderTaxLineDTO { /** * The raw total tax relative to the shipping method. - * + * * @ignore */ raw_total: BigNumberRawValue /** * The raw subtotal tax relative to the shipping method. - * + * * @ignore */ raw_subtotal: BigNumberRawValue @@ -320,14 +325,14 @@ export interface OrderLineItemTaxLineDTO extends OrderTaxLineDTO { /** * The raw total tax relative to the item. - * + * * @ignore */ raw_total: BigNumberRawValue /** * The raw subtotal tax relative to the item. - * + * * @ignore */ raw_subtotal: BigNumberRawValue @@ -444,7 +449,7 @@ export interface OrderShippingMethodDTO { /** * The raw price of the shipping method. - * + * * @ignore */ raw_amount: BigNumberRawValue @@ -535,56 +540,56 @@ export interface OrderShippingMethodDTO { /** * The raw original total of the order shipping method. - * + * * @ignore */ raw_original_total: BigNumberRawValue /** * The raw original subtotal of the order shipping method. - * + * * @ignore */ raw_original_subtotal: BigNumberRawValue /** * The raw original tax total of the order shipping method. - * + * * @ignore */ raw_original_tax_total: BigNumberRawValue /** * The raw total of the order shipping method. - * + * * @ignore */ raw_total: BigNumberRawValue /** * The raw subtotal of the order shipping method. - * + * * @ignore */ raw_subtotal: BigNumberRawValue /** * The raw tax total of the order shipping method. - * + * * @ignore */ raw_tax_total: BigNumberRawValue /** * The raw discount total of the order shipping method. - * + * * @ignore */ raw_discount_total: BigNumberRawValue /** * The raw discount tax total of the order shipping method. - * + * * @ignore */ raw_discount_tax_total: BigNumberRawValue @@ -661,91 +666,91 @@ export interface OrderLineItemTotalsDTO { /** * The raw original total of the order line item. - * + * * @ignore */ raw_original_total: BigNumberRawValue /** * The raw original subtotal of the order line item. - * + * * @ignore */ raw_original_subtotal: BigNumberRawValue /** * The raw original tax total of the order line item. - * + * * @ignore */ raw_original_tax_total: BigNumberRawValue /** * The raw item total of the order line item. - * + * * @ignore */ raw_item_total: BigNumberRawValue /** * The raw item subtotal of the order line item. - * + * * @ignore */ raw_item_subtotal: BigNumberRawValue /** * The raw item tax total of the order line item. - * + * * @ignore */ raw_item_tax_total: BigNumberRawValue /** * The raw total of the order line item. - * + * * @ignore */ raw_total: BigNumberRawValue /** * The raw subtotal of the order line item. - * + * * @ignore */ raw_subtotal: BigNumberRawValue /** * The raw tax total of the order line item. - * + * * @ignore */ raw_tax_total: BigNumberRawValue /** * The raw discount total of the order line item. - * + * * @ignore */ raw_discount_total: BigNumberRawValue /** * The raw discount tax total of the order line item. - * + * * @ignore */ raw_discount_tax_total: BigNumberRawValue /** * The raw refundable total of the order line item.. - * + * * @ignore */ raw_refundable_total: BigNumberRawValue /** * The raw refundable total per unit of the order line item. - * + * * @ignore */ raw_refundable_total_per_unit: BigNumberRawValue @@ -857,7 +862,7 @@ export interface OrderLineItemDTO extends OrderLineItemTotalsDTO { /** * The raw compare at unit price of the line item. - * + * * @ignore */ raw_compare_at_unit_price?: BigNumberRawValue @@ -869,7 +874,7 @@ export interface OrderLineItemDTO extends OrderLineItemTotalsDTO { /** * The raw unit price of the line item. - * + * * @ignore */ raw_unit_price: BigNumberRawValue @@ -881,7 +886,7 @@ export interface OrderLineItemDTO extends OrderLineItemTotalsDTO { /** * The raw quantity of the line item. - * + * * @ignore */ raw_quantity: BigNumberRawValue @@ -949,7 +954,7 @@ export interface OrderItemDTO { /** * The raw quantity of the order line item. - * + * * @ignore */ raw_quantity: BigNumberRawValue @@ -961,7 +966,7 @@ export interface OrderItemDTO { /** * The raw fulfilled quantity of the order line item. - * + * * @ignore */ raw_fulfilled_quantity: BigNumberRawValue @@ -973,7 +978,7 @@ export interface OrderItemDTO { /** * The raw delivered quantity of the order line item. - * + * * @ignore */ raw_delivered_quantity: BigNumberRawValue @@ -985,7 +990,7 @@ export interface OrderItemDTO { /** * The raw shipped quantity of the order line item. - * + * * @ignore */ raw_shipped_quantity: BigNumberRawValue @@ -997,7 +1002,7 @@ export interface OrderItemDTO { /** * The raw quantity of return requested for the order line item. - * + * * @ignore */ raw_return_requested_quantity: BigNumberRawValue @@ -1009,7 +1014,7 @@ export interface OrderItemDTO { /** * The raw quantity of return received for the order line item. - * + * * @ignore */ raw_return_received_quantity: BigNumberRawValue @@ -1021,7 +1026,7 @@ export interface OrderItemDTO { /** * The raw quantity of return dismissed for the order line item. - * + * * @ignore */ raw_return_dismissed_quantity: BigNumberRawValue @@ -1033,7 +1038,7 @@ export interface OrderItemDTO { /** * The raw quantity of written off for the order line item. - * + * * @ignore */ raw_written_off_quantity: BigNumberRawValue @@ -1295,154 +1300,154 @@ export interface OrderDTO { /** * The raw original item total of the order. - * + * * @ignore */ raw_original_item_total: BigNumberRawValue /** * The raw original item subtotal of the order. - * + * * @ignore */ raw_original_item_subtotal: BigNumberRawValue /** * The raw original item tax total of the order. - * + * * @ignore */ raw_original_item_tax_total: BigNumberRawValue /** * The raw item total of the order. - * + * * @ignore */ raw_item_total: BigNumberRawValue /** * The raw item subtotal of the order. - * + * * @ignore */ raw_item_subtotal: BigNumberRawValue /** * The raw item tax total of the order. - * + * * @ignore */ raw_item_tax_total: BigNumberRawValue /** * The raw original total of the order. - * + * * @ignore */ raw_original_total: BigNumberRawValue /** * The raw original subtotal of the order. - * + * * @ignore */ raw_original_subtotal: BigNumberRawValue /** * The raw original tax total of the order. - * + * * @ignore */ raw_original_tax_total: BigNumberRawValue /** * The raw total of the order. - * + * * @ignore */ raw_total: BigNumberRawValue /** * The raw subtotal of the order. (Excluding taxes) - * + * * @ignore */ raw_subtotal: BigNumberRawValue /** * The raw tax total of the order. - * + * * @ignore */ raw_tax_total: BigNumberRawValue /** * The raw discount total of the order. - * + * * @ignore */ raw_discount_total: BigNumberRawValue /** * The raw discount tax total of the order. - * + * * @ignore */ raw_discount_tax_total: BigNumberRawValue /** * The raw gift card total of the order. - * + * * @ignore */ raw_gift_card_total: BigNumberRawValue /** * The raw gift card tax total of the order. - * + * * @ignore */ raw_gift_card_tax_total: BigNumberRawValue /** * The raw shipping total of the order. - * + * * @ignore */ raw_shipping_total: BigNumberRawValue /** * The raw shipping subtotal of the order. - * + * * @ignore */ raw_shipping_subtotal: BigNumberRawValue /** * The raw shipping tax total of the order. - * + * * @ignore */ raw_shipping_tax_total: BigNumberRawValue /** * The raw original shipping total of the order. - * + * * @ignore */ raw_original_shipping_total: BigNumberRawValue /** * The raw original shipping subtotal of the order. - * + * * @ignore */ raw_original_shipping_subtotal: BigNumberRawValue /** * The raw original shipping tax total of the order. - * + * * @ignore */ raw_original_shipping_tax_total: BigNumberRawValue @@ -1615,7 +1620,7 @@ export interface OrderReturnItemDTO { /** * The raw quantity of the item to return. - * + * * @ignore */ raw_quantity: BigNumberRawValue @@ -1627,7 +1632,7 @@ export interface OrderReturnItemDTO { /** * The raw received quantity of the return item. - * + * * @ignore */ raw_received_quantity?: BigNumberRawValue @@ -1689,7 +1694,7 @@ export interface OrderClaimItemDTO { /** * The raw quantity of the order claim item - * + * * @ignore */ raw_quantity: BigNumberRawValue @@ -1781,7 +1786,7 @@ export interface OrderExchangeItemDTO { /** * The raw quantity of the order exchange item - * + * * @ignore */ raw_quantity: BigNumberRawValue @@ -2336,7 +2341,7 @@ export interface OrderTransactionDTO { /** * The raw amount of the transaction - * + * * @ignore */ raw_amount: BigNumberRawValue @@ -2395,7 +2400,7 @@ export interface OrderTransactionDTO { /** * The raw amount of the transaction - * + * * @ignore */ raw_amount: BigNumberRawValue diff --git a/packages/core/types/src/search/interface.ts b/packages/core/types/src/search/interface.ts index 25e03d32ac..f2ce5b5027 100644 --- a/packages/core/types/src/search/interface.ts +++ b/packages/core/types/src/search/interface.ts @@ -1,70 +1,70 @@ export interface ISearchService { - options: Record - - /** - * Used to create an index - * @param indexName the index name - * @param options the options - * @return returns response from search engine provider - */ - createIndex(indexName: string, options: unknown): unknown - - /** - * Used to get an index - * @param indexName - the index name. - * @return returns response from search engine provider - */ - getIndex(indexName: string): unknown - - /** - * Used to index documents by the search engine provider - * @param indexName the index name - * @param documents documents array to be indexed - * @param type of documents to be added (e.g: products, regions, orders, etc) - * @return returns response from search engine provider - */ - addDocuments(indexName: string, documents: unknown, type: string): unknown - - /** - * Used to replace documents - * @param indexName the index name. - * @param documents array of document objects that will replace existing documents - * @param type type of documents to be replaced (e.g: products, regions, orders, etc) - * @return returns response from search engine provider - */ - replaceDocuments(indexName: string, documents: unknown, type: string): unknown - - /** - * Used to delete document - * @param indexName the index name - * @param document_id the id of the document - * @return returns response from search engine provider - */ - deleteDocument(indexName: string, document_id: string | number): unknown - - /** - * Used to delete all documents - * @param indexName the index name - * @return returns response from search engine provider - */ - deleteAllDocuments(indexName: string): unknown - - /** - * Used to search for a document in an index - * @param indexName the index name - * @param query the search query - * @param options - * - any options passed to the request object other than the query and indexName - * - additionalOptions contain any provider specific options - * @return returns response from search engine provider - */ - search(indexName: string, query: string | null, options: unknown): unknown - - /** - * Used to update the settings of an index - * @param indexName the index name - * @param settings settings object - * @return returns response from search engine provider - */ - updateSettings(indexName: string, settings: unknown): unknown - } \ No newline at end of file + options: Record + + /** + * Used to create an index + * @param indexName the index name + * @param options the options + * @return returns response from search engine provider + */ + createIndex(indexName: string, options: unknown): unknown + + /** + * Used to get an index + * @param indexName - the index name. + * @return returns response from search engine provider + */ + getIndex(indexName: string): unknown + + /** + * Used to index documents by the search engine provider + * @param indexName the index name + * @param documents documents array to be indexed + * @param type of documents to be added (e.g: products, regions, orders, etc) + * @return returns response from search engine provider + */ + addDocuments(indexName: string, documents: unknown, type: string): unknown + + /** + * Used to replace documents + * @param indexName the index name. + * @param documents array of document objects that will replace existing documents + * @param type type of documents to be replaced (e.g: products, regions, orders, etc) + * @return returns response from search engine provider + */ + replaceDocuments(indexName: string, documents: unknown, type: string): unknown + + /** + * Used to delete document + * @param indexName the index name + * @param document_id the id of the document + * @return returns response from search engine provider + */ + deleteDocument(indexName: string, document_id: string | number): unknown + + /** + * Used to delete all documents + * @param indexName the index name + * @return returns response from search engine provider + */ + deleteAllDocuments(indexName: string): unknown + + /** + * Used to search for a document in an index + * @param indexName the index name + * @param query the search query + * @param options + * - any options passed to the request object other than the query and indexName + * - additionalOptions contain any provider specific options + * @return returns response from search engine provider + */ + search(indexName: string, query: string | null, options: unknown): unknown + + /** + * Used to update the settings of an index + * @param indexName the index name + * @param settings settings object + * @return returns response from search engine provider + */ + updateSettings(indexName: string, settings: unknown): unknown +} diff --git a/packages/core/types/src/search/settings.ts b/packages/core/types/src/search/settings.ts index e16f09893c..21109b1388 100644 --- a/packages/core/types/src/search/settings.ts +++ b/packages/core/types/src/search/settings.ts @@ -1,16 +1,14 @@ export type IndexSettings = { - /** - * Settings specific to the provider. E.g. `searchableAttributes`. - */ - indexSettings: Record - /** - * Primary key for the index. Used to enforce unique documents in an index. See more in Meilisearch' https://docs.meilisearch.com/learn/core_concepts/primary_key.html. - */ - primaryKey?: string - /** - * Document transformer. Used to transform documents before they are added to the index. - */ - transformer?: (document: any) => any - } - - \ No newline at end of file + /** + * Settings specific to the provider. E.g. `searchableAttributes`. + */ + indexSettings: Record + /** + * Primary key for the index. Used to enforce unique documents in an index. See more in Meilisearch' https://docs.meilisearch.com/learn/core_concepts/primary_key.html. + */ + primaryKey?: string + /** + * Document transformer. Used to transform documents before they are added to the index. + */ + transformer?: (document: any) => any +} diff --git a/packages/core/types/src/tax/provider.ts b/packages/core/types/src/tax/provider.ts index 2016ba6ac9..1c37abb7e7 100644 --- a/packages/core/types/src/tax/provider.ts +++ b/packages/core/types/src/tax/provider.ts @@ -1,10 +1,10 @@ import { ItemTaxLineDTO, ShippingTaxLineDTO, - TaxCalculationContext, - TaxRateDTO, TaxableItemDTO, TaxableShippingDTO, + TaxCalculationContext, + TaxRateDTO, } from "./common" /** diff --git a/packages/core/types/src/transaction-base/index.ts b/packages/core/types/src/transaction-base/index.ts index 0017eb8241..027654b921 100644 --- a/packages/core/types/src/transaction-base/index.ts +++ b/packages/core/types/src/transaction-base/index.ts @@ -1,2 +1 @@ -export * from "./transaction-base"; - +export * from "./transaction-base" diff --git a/packages/core/types/src/workflow/fulfillment/shipping-profiles.ts b/packages/core/types/src/workflow/fulfillment/shipping-profiles.ts index 3c57e881e0..fccf01a59c 100644 --- a/packages/core/types/src/workflow/fulfillment/shipping-profiles.ts +++ b/packages/core/types/src/workflow/fulfillment/shipping-profiles.ts @@ -1,4 +1,7 @@ -import { FilterableShippingProfileProps, ShippingProfileDTO } from "../../fulfillment" +import { + FilterableShippingProfileProps, + ShippingProfileDTO, +} from "../../fulfillment" interface CreateShippingProfile { name: string diff --git a/packages/core/utils/src/auth/abstract-auth-provider.ts b/packages/core/utils/src/auth/abstract-auth-provider.ts index cdf0f626f3..c8f0a4628f 100644 --- a/packages/core/utils/src/auth/abstract-auth-provider.ts +++ b/packages/core/utils/src/auth/abstract-auth-provider.ts @@ -2,7 +2,7 @@ import { AuthenticationInput, AuthenticationResponse, AuthIdentityProviderService, - IAuthProvider + IAuthProvider, } from "@medusajs/types" /** @@ -118,7 +118,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * * The authentication happens either by directly authenticating or returning a redirect URL to continue * the authentication with a third party provider. - * + * * Related Read: [Learn about the different authentication flows in Medusa](https://docs.medusajs.com/v2/resources/commerce-modules/auth/authentication-route). * * @param {AuthenticationInput} data - The details of the authentication request. @@ -217,22 +217,22 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { /** * This method receives credentails to create a new auth identity. It performs any validation necessary * before creating the auth identity. - * + * * For example, in the `emailpass` provider, this method ensures that the provided email doesn't exist * before creating the auth identity. - * + * * This method is only used in a basic authentication flow, such as when using an email and password * to register and authenticate a user. - * + * * Related Read: [Learn about the different authentication flows in Medusa](https://docs.medusajs.com/v2/resources/commerce-modules/auth/authentication-route). - * - * @param {AuthenticationInput} data - The details of the authentication request. + * + * @param {AuthenticationInput} data - The details of the authentication request. * @param {AuthIdentityProviderService} authIdentityProviderService - The service used to retrieve or * create an auth identity. It has two methods: `create` to create an auth identity, * and `retrieve` to retrieve an auth identity. When you authenticate the user, you can create an auth identity * using this service. * @returns The created authentication identity if no errors occur. - * + * * @example * import { * AuthIdentityProviderService, @@ -252,7 +252,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * await authIdentityService.retrieve({ * entity_id: data.body.email, // email or some ID * }) - * + * * return { * success: false, * error: "Identity with email already exists", @@ -266,13 +266,13 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * // can include password or any other relevant information * } * }) - * + * * return { * success: true, * authIdentity: createdAuthIdentity, * } * } - * + * * return { success: false, error: error.message } * } * } @@ -289,9 +289,9 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { /** * This method is used to update an auth identity's details. - * + * * For example, the `emailpass` provider's implementation of this method updates a user's password. - * + * * @param data - Data relevant to identify the auth identity and what to update in it. For example, * the `emailpass` provider expects in this object an `email` and `password` properties. * @param authIdentityProviderService - The service used to retrieve or @@ -299,7 +299,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * and `retrieve` to retrieve an auth identity. When you authenticate the user, you can create an auth identity * using this service. * @returns The updated authentication identity if no errors occur. - * + * * @example * import { * AuthIdentityProviderService, @@ -322,7 +322,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * user: data.user // example * } * ) - * + * * return { success: true, authIdentity } * } catch (error) { * return { success: false, error: error.message } @@ -348,15 +348,15 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * Then, the third-party service redirects to a frontend URL passing it a `code` query parameter. * The frontend should then send a request to the Medusa application's validate callback API route, passing it the code. * That route uses this method to verify the callback's code. - * + * * If the callback is verified successfully, the provider creates an auth identity for the user, or updates the auth identity's user information. - * + * * In the auth identity, use the following properties to store additional data: - * + * * - `provider_metadata`: Store metadata useful for the provider, such as a password hash. * - `user_metadata`: Store metadata of the user's details. For example, if the third-party service returns the user's information such as email * or name, you store this data in this property. - * + * * Related Guide: [Learn about the different authentication flows in Medusa](https://docs.medusajs.com/v2/resources/commerce-modules/auth/authentication-route). * * @param {AuthenticationInput} data - The details of the authentication request. diff --git a/packages/medusa/src/utils/__tests__/omit-deep.spec.ts b/packages/core/utils/src/common/__tests__/omit-deep.spec.ts similarity index 89% rename from packages/medusa/src/utils/__tests__/omit-deep.spec.ts rename to packages/core/utils/src/common/__tests__/omit-deep.spec.ts index 53dd214b9c..5aedbe0a47 100644 --- a/packages/medusa/src/utils/__tests__/omit-deep.spec.ts +++ b/packages/core/utils/src/common/__tests__/omit-deep.spec.ts @@ -30,7 +30,7 @@ describe("omitDeep", () => { }, ], } - + const output = { id: 1, address: { @@ -51,9 +51,9 @@ describe("omitDeep", () => { }, ], } - - expect( - omitDeep(input, ["createdAt", "updatedAt", "__typename"]) - ).toEqual(output) + + expect(omitDeep(input, ["createdAt", "updatedAt", "__typename"])).toEqual( + output + ) }) -}) \ No newline at end of file +}) diff --git a/packages/medusa/src/utils/__tests__/remove-undefined-properties.spec.ts b/packages/core/utils/src/common/__tests__/remove-undefined-properties.spec.ts similarity index 87% rename from packages/medusa/src/utils/__tests__/remove-undefined-properties.spec.ts rename to packages/core/utils/src/common/__tests__/remove-undefined-properties.spec.ts index eb00912f13..0ccfe9183d 100644 --- a/packages/medusa/src/utils/__tests__/remove-undefined-properties.spec.ts +++ b/packages/core/utils/src/common/__tests__/remove-undefined-properties.spec.ts @@ -1,6 +1,6 @@ -import { removeUndefinedProperties } from "../remove-undefined-properties"; +import { removeUndefinedProperties } from "../remove-undefined-properties" -describe("removeUndefinedProperties", () => { +describe("removeUndefinedProperties", () => { it("should remove all undefined properties from an input object", () => { const inputObj = { test: undefined, @@ -20,8 +20,8 @@ describe("removeUndefinedProperties", () => { test4_1: undefined, test4_2: "test4_2", test4_3: null, - } - ] + }, + ], } const cleanObject = removeUndefinedProperties(inputObj) @@ -39,9 +39,9 @@ describe("removeUndefinedProperties", () => { [1, 2], { test4_2: "test4_2", - test4_3: null - } - ] + test4_3: null, + }, + ], }) }) }) diff --git a/packages/core/utils/src/common/get-node-version.ts b/packages/core/utils/src/common/get-node-version.ts index fa09891d5b..ac29653f54 100644 --- a/packages/core/utils/src/common/get-node-version.ts +++ b/packages/core/utils/src/common/get-node-version.ts @@ -1,7 +1,7 @@ export function getNodeVersion(): number { - const [major] = process.versions.node.split('.').map(Number) + const [major] = process.versions.node.split(".").map(Number) return major } -export const MIN_SUPPORTED_NODE_VERSION = 20 \ No newline at end of file +export const MIN_SUPPORTED_NODE_VERSION = 20 diff --git a/packages/core/utils/src/common/index.ts b/packages/core/utils/src/common/index.ts index 196d2cc625..beaa70c27a 100644 --- a/packages/core/utils/src/common/index.ts +++ b/packages/core/utils/src/common/index.ts @@ -2,6 +2,7 @@ export * from "./alter-columns-helper" export * from "./array-difference" export * from "./array-intersection" export * from "./build-query" +export * from "./remove-undefined-properties" export * from "./build-regexp-if-valid" export * from "./camel-to-snake-case" export * from "./container" @@ -73,3 +74,4 @@ export * from "./validate-handle" export * from "./wrap-handler" export * from "./resolve-exports" export * from "./dynamic-import" +export * from "./omit-deep" diff --git a/packages/medusa/src/utils/omit-deep.ts b/packages/core/utils/src/common/omit-deep.ts similarity index 93% rename from packages/medusa/src/utils/omit-deep.ts rename to packages/core/utils/src/common/omit-deep.ts index 848a208331..a86453c0a7 100644 --- a/packages/medusa/src/utils/omit-deep.ts +++ b/packages/core/utils/src/common/omit-deep.ts @@ -1,4 +1,4 @@ -import { isObject } from "@medusajs/framework/utils" +import { isObject } from "./is-object" export function omitDeep( input: object, diff --git a/packages/medusa/src/utils/remove-undefined-properties.ts b/packages/core/utils/src/common/remove-undefined-properties.ts similarity index 95% rename from packages/medusa/src/utils/remove-undefined-properties.ts rename to packages/core/utils/src/common/remove-undefined-properties.ts index 87e0ab9316..cf1c82d060 100644 --- a/packages/medusa/src/utils/remove-undefined-properties.ts +++ b/packages/core/utils/src/common/remove-undefined-properties.ts @@ -1,4 +1,4 @@ -import { isDefined } from "@medusajs/framework/utils" +import { isDefined } from "./is-defined" export function removeUndefinedProperties(inputObj: T): T { const removeProperties = (obj: T) => { diff --git a/packages/core/utils/src/dml/entity-builder.ts b/packages/core/utils/src/dml/entity-builder.ts index 1cb76c32e3..c6aa9ce3fc 100644 --- a/packages/core/utils/src/dml/entity-builder.ts +++ b/packages/core/utils/src/dml/entity-builder.ts @@ -354,7 +354,7 @@ export class EntityBuilder { * * @example * import { model } from "@medusajs/framework/utils" - * + * * const Product = model.define("product", { * id: model.id(), * store: model.belongsTo(() => Store, { diff --git a/packages/core/utils/src/dml/properties/base.ts b/packages/core/utils/src/dml/properties/base.ts index e108b2d226..2ab719c4a1 100644 --- a/packages/core/utils/src/dml/properties/base.ts +++ b/packages/core/utils/src/dml/properties/base.ts @@ -31,17 +31,17 @@ export abstract class BaseProperty implements PropertyType { /** * This method indicates that a property's value can be `null`. - * + * * @example * import { model } from "@medusajs/framework/utils" - * + * * const MyCustom = model.define("my_custom", { * price: model.bigNumber().nullable(), * // ... * }) - * + * * export default MyCustom - * + * * @customNamespace Property Configuration Methods */ nullable() { @@ -50,22 +50,22 @@ export abstract class BaseProperty implements PropertyType { /** * This method defines an index on a property. - * + * * @param {string} name - The index's name. If not provided, * Medusa generates the name. - * + * * @example * import { model } from "@medusajs/framework/utils" - * + * * const MyCustom = model.define("my_custom", { * id: model.id(), * name: model.text().index( * "IDX_MY_CUSTOM_NAME" * ), * }) - * + * * export default MyCustom - * + * * @customNamespace Property Configuration Methods */ index(name?: string) { @@ -76,20 +76,20 @@ export abstract class BaseProperty implements PropertyType { /** * This method indicates that a property's value must be unique in the database. * A unique index is created on the property. - * + * * @param {string} name - The unique index's name. If not provided, * Medusa generates the name. - * + * * @example * import { model } from "@medusajs/framework/utils" - * + * * const User = model.define("user", { * email: model.text().unique(), * // ... * }) - * + * * export default User - * + * * @customNamespace Property Configuration Methods */ unique(name?: string) { @@ -99,12 +99,12 @@ export abstract class BaseProperty implements PropertyType { /** * This method defines the default value of a property. - * + * * @param {T} value - The default value. - * + * * @example * import { model } from "@medusajs/framework/utils" - * + * * const MyCustom = model.define("my_custom", { * color: model * .enum(["black", "white"]) @@ -114,9 +114,9 @@ export abstract class BaseProperty implements PropertyType { * .default(0), * // ... * }) - * + * * export default MyCustom - * + * * @customNamespace Property Configuration Methods */ default(value: T) { diff --git a/packages/core/utils/src/fulfillment/provider.ts b/packages/core/utils/src/fulfillment/provider.ts index 89d81a1228..0bda857011 100644 --- a/packages/core/utils/src/fulfillment/provider.ts +++ b/packages/core/utils/src/fulfillment/provider.ts @@ -1,18 +1,15 @@ -import { - IFulfillmentProvider, - FulfillmentOption -} from "@medusajs/types" +import { FulfillmentOption, IFulfillmentProvider } from "@medusajs/types" /** * ### constructor * * The constructor allows you to access resources from the module's container using the first parameter, * and the module's options using the second parameter. - * + * * :::note - * + * * A module's options are passed when you register it in the Medusa application. - * + * * ::: * * If you're creating a client or establishing a connection with a third-party service, do it in the constructor. @@ -22,32 +19,32 @@ import { * ```ts * import { AbstractFulfillmentProviderService } from "@medusajs/framework/utils" * import { Logger } from "@medusajs/framework/types" - * + * * type InjectedDependencies = { * logger: Logger * } - * + * * type Options = { * apiKey: string * } - * + * * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * protected logger_: Logger * protected options_: Options * // assuming you're initializing a client * protected client - * + * * constructor( * { logger }: InjectedDependencies, * options: Options * ) { * super() - * + * * this.logger_ = logger * this.options_ = options * } * } - * + * * export default MyFulfillmentProviderService * ``` */ @@ -56,15 +53,15 @@ export class AbstractFulfillmentProviderService { /** * The `identifier` property holds a unique identifier of the fulfillment module provider. - * + * * You can use the kebab-case name of the provider as its value. - * + * * For example: - * + * * ```ts * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * static identifier = "my-fulfillment" - * + * * // ... * } */ @@ -84,7 +81,7 @@ export class AbstractFulfillmentProviderService /** * @ignore - * + * * @privateRemarks * This method is ignored as {@link validateOption} is the one used by the Fulfillment Module. */ @@ -99,13 +96,13 @@ export class AbstractFulfillmentProviderService /** * This method retrieves the shipping options this fulfillment provider supports. - * + * * @returns The list of fulfillment options. - * + * * @example * // other imports... * import { FulfillmentOption } from "@medusajs/framework/types" - * + * * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... * async getFulfillmentOptions(): Promise { @@ -128,28 +125,28 @@ export class AbstractFulfillmentProviderService /** * This method validates the `data` property of a shipping method and returns it. The returned data * is stored in the shipping method's `data` property. - * + * * Your fulfillment provider can use the `data` property to store additional information useful for * handling the fulfillment later. For example, you may store an ID from the third-party fulfillment * system. - * + * * @param optionData - The `data` property of the shipping option. * @param data - The `data` property of the shipping method. * @param context - Context details, such as context of the cart or customer. * @returns the data to store in the `data` property of the shipping method. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... * async validateFulfillmentData( - * optionData: any, - * data: any, + * optionData: any, + * data: any, * context: any * ): Promise { * // assuming your client retrieves an ID from the * // third-party service * const externalId = await this.client.getId() - * + * * return { * ...data, * externalId @@ -163,13 +160,13 @@ export class AbstractFulfillmentProviderService /** * This method validates the `data` property of a shipping option when it's created. - * + * * The `data` property can hold useful information that's later added to the `data` attribute * of shipping methods created from this option. - * + * * @param data - The data to validate. * @return Whether the data is valid. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -183,12 +180,12 @@ export class AbstractFulfillmentProviderService } /** - * This method indicates whether a shippin option's price is calculated during + * This method indicates whether a shippin option's price is calculated during * checkout or is fixed. - * + * * @param data - The `data` property of the shipping option. * @returns Whether the price is calculated for the shipping option. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -203,15 +200,15 @@ export class AbstractFulfillmentProviderService /** * This method calculates the price of a shipping option, or a shipping method when it's created. - * + * * The Medusa application uses the {@link canCalculate} method first to check whether the shipping option's price is calculated. * If it returns `true`, Medusa uses this method to retrieve the calculated price. - * + * * @param optionData - The `data` property of a shipping option. * @param data - If the price is calculated for a shipping option, it's the `data` of the shipping option. Otherwise, it's the `data of the shipping method. * @param cart - The cart details. * @returns The calculated price - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -219,7 +216,7 @@ export class AbstractFulfillmentProviderService * // assuming the client can calculate the price using * // the third-party service * const price = await this.client.calculate(data) - * + * * return price * } * } @@ -229,27 +226,27 @@ export class AbstractFulfillmentProviderService } /** - * This method is used when a fulfillment is created. If the method returns in the object a + * This method is used when a fulfillment is created. If the method returns in the object a * `data` property, it's stored in the fulfillment's `data` property. - * + * * The `data` property is useful when handling the fulfillment later, * as you can access information useful for your integration. - * + * * You can also use this method to perform an action with the third-party fulfillment service. - * + * * @param data - The `data` property of the shipping method this fulfillment is created for. * @param items - The items in the fulfillment. * @param order - The order this fulfillment is created for. * @param fulfillment - The fulfillment's details. * @returns The data to store in the fulfillment's `data` property. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... * async createFulfillment( - * data: any, - * items: any, - * order: any, + * data: any, + * items: any, + * order: any, * fulfillment: any * ): Promise { * // assuming the client creates a fulfillment @@ -258,7 +255,7 @@ export class AbstractFulfillmentProviderService * fulfillment, * items * ) - * + * * return { * data: { * ...data, @@ -275,9 +272,9 @@ export class AbstractFulfillmentProviderService /** * This method is used when a fulfillment is canceled. Use it to perform operations * with the third-party fulfillment service. - * + * * @param fulfillment - The fulfillment's details. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -294,10 +291,10 @@ export class AbstractFulfillmentProviderService /** * This method retrieves the documents of a fulfillment. - * + * * @param data - The `data` property of the fulfillment. * @returns The fulfillment's documents. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -313,17 +310,17 @@ export class AbstractFulfillmentProviderService } /** - * This method is used when a fulfillment is created for a return. If the method returns in the object a + * This method is used when a fulfillment is created for a return. If the method returns in the object a * `data` property, it's stored in the fulfillment's `data` property. - * + * * The `data` property is useful when handling the fulfillment later, * as you can access information useful for your integration. - * + * * Use this method to perform actions necessary in the third-party fulfillment service. - * + * * @param fulfillment - The fulfillment's details. * @returns The data to store in the fulfillment's `data` property. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -333,7 +330,7 @@ export class AbstractFulfillmentProviderService * const externalData = await this.client.createReturn( * fulfillment * ) - * + * * return { * data: { * ...fulfillment.data, @@ -349,10 +346,10 @@ export class AbstractFulfillmentProviderService /** * This method retrieves documents for a return's fulfillment. - * + * * @param data - The `data` property of the fulfillment. * @returns The fulfillment's documents. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -369,10 +366,10 @@ export class AbstractFulfillmentProviderService /** * This method retrieves the documents for a shipment. - * + * * @param data - The `data` property of the shipmnet. * @returns The shipment's documents. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... @@ -382,7 +379,7 @@ export class AbstractFulfillmentProviderService * return await this.client.documents(data) * } * } - * + * */ async getShipmentDocuments(data) { return [] @@ -390,16 +387,16 @@ export class AbstractFulfillmentProviderService /** * This method retrieves the documents of a fulfillment of a certain type. - * + * * @param fulfillmentData - The `data` property of the fulfillment. * @param documentType - The document's type. For example, `invoice`. * @returns The fulfillment's documents. - * + * * @example * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... * async retrieveDocuments( - * fulfillmentData: any, + * fulfillmentData: any, * documentType: any * ): Promise { * // assuming the client retrieves documents diff --git a/packages/core/utils/src/search/abstract-service.ts b/packages/core/utils/src/search/abstract-service.ts index 87600b717b..e32e23760d 100644 --- a/packages/core/utils/src/search/abstract-service.ts +++ b/packages/core/utils/src/search/abstract-service.ts @@ -2,21 +2,21 @@ import { SearchTypes } from "@medusajs/types" /** * ## 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. - * - * 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 + * + * 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`. - * + * * 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" - * + * * class MySearchService extends AbstractSearchService { * isDefault = false - * + * * createIndex(indexName: string, options: Record) { * throw new Error("Method not implemented.") * } @@ -48,7 +48,7 @@ import { SearchTypes } from "@medusajs/types" * } * search( * indexName: string, - * query: string, + * query: string, * options: Record * ) { * return { @@ -56,24 +56,24 @@ import { SearchTypes } from "@medusajs/types" * } * } * updateSettings( - * indexName: string, + * indexName: string, * settings: Record * ) { * throw new Error("Method not implemented.") * } - * + * * } - * + * * export default MySearchService * ``` - * + * * --- - * + * * ## Notes About Class Methods - * - * Although there are several helper methods in this class, the main methods used by the Medusa backend are `addDocuments`, `deleteDocument`, and `search`. + * + * Although there are several helper methods in this class, the main methods used by the Medusa backend are `addDocuments`, `deleteDocument`, and `search`. * The rest of the methods are provided in case you need them for custom use cases. - * + * * --- */ export abstract class AbstractSearchService @@ -122,15 +122,15 @@ export abstract class AbstractSearchService * @example * // ... * import { ProductService } from "@medusajs/medusa" - * + * * type InjectedDependencies = { * productService: ProductService * } - * + * * class MySearchService extends AbstractSearchService { * // ... * protected readonly productService_: ProductService - * + * * constructor({ productService }: InjectedDependencies) { * // @ts-expect-error prefer-rest-params * super(...arguments) @@ -140,7 +140,7 @@ export abstract class AbstractSearchService * // communicates with a third-party service. * this.client = new Client(options) * } - * + * * // ... * } */ @@ -150,15 +150,15 @@ export abstract class AbstractSearchService /** * This method is used to create an index in the search engine. - * + * * @param {string} indexName - The name of the index to create. - * @param {unknown} options - Any options that may be relevant to your search service. This parameter doesn't have + * @param {unknown} options - Any options that may be relevant to your search service. This parameter doesn't have * any defined format as it depends on your custom implementation. * @returns {unknown} No required format of returned data, as it depends on your custom implementation. - * + * * @example * An example implementation, assuming `client` would interact with a third-party service: - * + * * ```ts title="src/services/my-search.ts" * class MySearchService extends AbstractSearchService { * // ... @@ -168,10 +168,10 @@ export abstract class AbstractSearchService * // ... * } * ``` - * + * * Another example of how the [MeiliSearch plugin](https://docs.medusajs.com/plugins/search/meilisearch) uses the * `options` parameter: - * + * * ```ts * class MeiliSearchService extends AbstractSearchService { * // ... @@ -189,14 +189,14 @@ export abstract class AbstractSearchService /** * This method is used to retrieve an index’s results from the search engine. - * + * * @param {string} indexName - The name of the index * @returns {unknown} No required format of returned data, as it depends on your custom implementation. - * + * * @example * class MySearchService extends AbstractSearchService { * // ... - * + * * getIndex(indexName: string) { * return this.client_.getIndex(indexName) * } @@ -206,19 +206,19 @@ export abstract class AbstractSearchService /** * This method is used to add a document to an index in the search engine. - * + * * When the Medusa backend loads, it triggers indexing for all products available in the Medusa backend, which uses this method to add or update documents. * It’s also used whenever a new product is added or a product is updated. - * + * * @param {string} indexName - The name of the index to add the documents to. * @param {unknown} documents - The list of documents to add. For example, an array of {@link entities!Product | products}. * @param {string} type - The type of documents being indexed. For example, `products`. * @returns {unknown} The response of saving the documents in the search engine, but there’s no required format of the response. - * + * * @example * class MySearchService extends AbstractSearchService { * // ... - * + * * async addDocuments( * indexName: string, * documents: Record[], @@ -237,17 +237,17 @@ export abstract class AbstractSearchService /** * This method is used to replace existing documents in the search engine of an index with new documents. - * + * * @param {string} indexName - The name of the index that the documents belong to. * @param {unknown} documents - The list of documents to index. For example, it can be an array of {@link entities!Product | products}. * Based on your search engine implementation, the documents should include an identification key that allows replacing the existing documents. * @param {string} type - The type of documents being replaced. For example, `products`. * @returns {unknown} The response of replacing the documents in the search engine, but there’s no required format of the response. - * + * * @example * class MySearchService extends AbstractSearchService { * // ... - * + * * async replaceDocuments( * indexName: string, * documents: Record[], @@ -268,18 +268,18 @@ export abstract class AbstractSearchService /** * This method is used to delete a document from an index. - * + * * When a product is deleted in the Medusa backend, this method is used to delete the product from the search engine’s index. - * + * * @param {string} indexName - The name of the index that the document belongs to. * @param {string | number} document_id - The ID of the item indexed. For example, if the deleted item is a product, then this is * the ID of the product. * @returns {unknown} The response of deleting the document in the search engine, but there’s no required format of the response. - * + * * @example * class MySearchService extends AbstractSearchService { * // ... - * + * * async deleteDocument( * indexName: string, * document_id: string | number @@ -296,14 +296,14 @@ export abstract class AbstractSearchService /** * This method is used to delete all documents from an index. - * + * * @param {string} indexName - The index's name. * @returns {unknown} The response of deleting the documents of that index in the search engine, but there’s no required format of the response. - * + * * @example * class MySearchService extends AbstractSearchService { * // ... - * + * * async deleteAllDocuments(indexName: string) { * return await this.client_ * .deleteDocuments(indexName) @@ -314,26 +314,26 @@ export abstract class AbstractSearchService /** * This method is used to search through an index by a query. - * - * In the Medusa backend, this method is used within the [Search Products API Route](https://docs.medusajs.com/api/store#products_postproductssearch) + * + * In the Medusa backend, this method is used within the [Search Products API Route](https://docs.medusajs.com/api/store#products_postproductssearch) * to retrieve the search results. The API route's response type is an array of items, though the item's format is not defined as it depends on the * data returned by this method. * * @param {string} indexName - The index's name. In the case of the Search Products API Routes, its value is `products`. * @param {string | null} query - The search query to retrieve results for. - * @param {unknown} options - + * @param {unknown} options - * Options that can configure the search process. The Search Products API route passes an object having the properties: - * + * * - `paginationOptions`: An object having an `offset` and `limit` properties, which are passed in the API Route's body. * - `filter`: Filters that are passed in the API Route's request body. Its format is unknown, so you can pass filters based on your search service. * - `additionalOptions`: Any other parameters that may be passed in the request's body. - * + * * @returns {unknown} The list of results. For example, an array of products. - * + * * @example * class MySearchService extends AbstractSearchService { * // ... - * + * * async search( * indexName: string, * query: string, @@ -355,18 +355,18 @@ export abstract class AbstractSearchService /** * This method is used to update the settings of an index within the search service. This is useful if you want to update the index settings when the plugin options change. - * - * For example, in the Algolia plugin, a loader, which runs when the Medusa backend loads, is used to update the settings of indices based on the plugin options. + * + * For example, in the Algolia plugin, a loader, which runs when the Medusa backend loads, is used to update the settings of indices based on the plugin options. * The loader uses this method to update the settings. - * + * * @param {string} indexName - The index's name to update its settings. * @param {unknown} settings - The settings to update. Its format depends on your use case. * @returns {unknown} The response of updating the index in the search engine, but there’s no required format of the response. - * + * * @example * class MySearchService extends AbstractSearchService { * // ... - * + * * async updateSettings( * indexName: string, * settings: Record diff --git a/packages/core/workflows-sdk/src/utils/composer/__tests__/compose.ts b/packages/core/workflows-sdk/src/utils/composer/__tests__/compose.ts index b0f12c6682..ab041f6661 100644 --- a/packages/core/workflows-sdk/src/utils/composer/__tests__/compose.ts +++ b/packages/core/workflows-sdk/src/utils/composer/__tests__/compose.ts @@ -1903,7 +1903,7 @@ describe("Workflow composer", function () { action: "step1", handlerType: "invoke", error: expect.objectContaining({ - message: "invoke fail", + message: "invoke fail", }), }) diff --git a/packages/core/workflows-sdk/src/utils/composer/parallelize.ts b/packages/core/workflows-sdk/src/utils/composer/parallelize.ts index dc6b6dd6de..ef0f4f7e41 100644 --- a/packages/core/workflows-sdk/src/utils/composer/parallelize.ts +++ b/packages/core/workflows-sdk/src/utils/composer/parallelize.ts @@ -26,7 +26,7 @@ import { OrchestrationUtils } from "@medusajs/utils" * } * * const myWorkflow = createWorkflow( - * "my-workflow", + * "my-workflow", * (input: WorkflowInput) => { * const product = createProductStep(input) * diff --git a/packages/core/workflows-sdk/src/utils/composer/transform.ts b/packages/core/workflows-sdk/src/utils/composer/transform.ts index 0369a4ddfb..280a32328f 100644 --- a/packages/core/workflows-sdk/src/utils/composer/transform.ts +++ b/packages/core/workflows-sdk/src/utils/composer/transform.ts @@ -40,7 +40,7 @@ type Func = (input: T, context: StepExecutionContext) => U | Promise * } * * const myWorkflow = createWorkflow( - * "hello-world", + * "hello-world", * (input: WorkflowInput) => { * const str1 = step1(input) * const str2 = step2(input) @@ -49,7 +49,7 @@ type Func = (input: T, context: StepExecutionContext) => U | Promise * str1, * str2 * }, (input) => `${input.str1}${input.str2}`) - * + * * return new WorkflowResponse(message) * }) */ diff --git a/packages/medusa-test-utils/package.json b/packages/medusa-test-utils/package.json index 722726d79c..8a4e61a340 100644 --- a/packages/medusa-test-utils/package.json +++ b/packages/medusa-test-utils/package.json @@ -38,6 +38,7 @@ "typescript": "^5.6.2" }, "dependencies": { + "@types/express": "^4.17.17", "axios": "^0.21.4", "express": "^4.21.0", "get-port": "^5.1.0", diff --git a/packages/medusa/package.json b/packages/medusa/package.json index 4a2a13abfa..63195b7482 100644 --- a/packages/medusa/package.json +++ b/packages/medusa/package.json @@ -5,6 +5,8 @@ "main": "dist/index.js", "exports": { ".": "./dist/index.js", + "./types": "./dist/types/index.js", + "./utils": "./dist/utils/index.js", "./api/*": "./dist/api/*.js", "./subscribers/*": "./dist/subscribers/*.js", "./jobs/*": "./dist/jobs/*.js", @@ -49,7 +51,6 @@ "@opentelemetry/sdk-trace-node": "^1.26.0", "@swc/core": "^1.7.28", "@swc/jest": "^0.2.36", - "@types/express": "^4.17.17", "@types/jsonwebtoken": "^8.5.9", "@types/lodash": "^4.14.191", "@types/multer": "^1.4.7", @@ -101,6 +102,7 @@ "@medusajs/workflow-engine-redis": "^0.0.4", "@swc/core": "1.5.7", "@swc/helpers": "^0.5.11", + "@types/express": "^4.17.17", "boxen": "^5.0.1", "chalk": "^4.0.0", "chokidar": "^3.4.2", diff --git a/packages/medusa/src/api/admin/api-keys/[id]/revoke/route.ts b/packages/medusa/src/api/admin/api-keys/[id]/revoke/route.ts index eda1c63d1f..065f9de5ff 100644 --- a/packages/medusa/src/api/admin/api-keys/[id]/revoke/route.ts +++ b/packages/medusa/src/api/admin/api-keys/[id]/revoke/route.ts @@ -2,7 +2,7 @@ import { revokeApiKeysWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminRevokeApiKeyType } from "../../validators" import { refetchApiKey } from "../../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/api-keys/[id]/route.ts b/packages/medusa/src/api/admin/api-keys/[id]/route.ts index 76138060ff..8ca110b46e 100644 --- a/packages/medusa/src/api/admin/api-keys/[id]/route.ts +++ b/packages/medusa/src/api/admin/api-keys/[id]/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchApiKey } from "../helpers" import { AdminUpdateApiKeyType } from "../validators" diff --git a/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts b/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts index e214652acf..72e4056758 100644 --- a/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts +++ b/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts @@ -4,7 +4,7 @@ import { ApiKeyType, MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchApiKey } from "../../helpers" export const POST = async ( diff --git a/packages/medusa/src/api/admin/api-keys/middlewares.ts b/packages/medusa/src/api/admin/api-keys/middlewares.ts index 21b0937f12..796e71acfa 100644 --- a/packages/medusa/src/api/admin/api-keys/middlewares.ts +++ b/packages/medusa/src/api/admin/api-keys/middlewares.ts @@ -1,7 +1,10 @@ import * as QueryConfig from "./query-config" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateApiKey, AdminGetApiKeyParams, @@ -9,7 +12,6 @@ import { AdminRevokeApiKey, AdminUpdateApiKey, } from "./validators" -import { validateAndTransformBody } from "../../utils/validate-body" import { createLinkBody } from "../../utils/validators" export const adminApiKeyRoutesMiddlewares: MiddlewareRoute[] = [ diff --git a/packages/medusa/src/api/admin/api-keys/route.ts b/packages/medusa/src/api/admin/api-keys/route.ts index 3089eb0629..1d399d93a4 100644 --- a/packages/medusa/src/api/admin/api-keys/route.ts +++ b/packages/medusa/src/api/admin/api-keys/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { AdminCreateApiKeyType } from "./validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/campaigns/[id]/promotions/route.ts b/packages/medusa/src/api/admin/campaigns/[id]/promotions/route.ts index d3c8b9dfa1..8702dd836b 100644 --- a/packages/medusa/src/api/admin/campaigns/[id]/promotions/route.ts +++ b/packages/medusa/src/api/admin/campaigns/[id]/promotions/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { addOrRemoveCampaignPromotionsWorkflow } from "@medusajs/core-flows" import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/campaigns/[id]/route.ts b/packages/medusa/src/api/admin/campaigns/[id]/route.ts index 519a34dd00..91f2c32f73 100644 --- a/packages/medusa/src/api/admin/campaigns/[id]/route.ts +++ b/packages/medusa/src/api/admin/campaigns/[id]/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { deleteCampaignsWorkflow, updateCampaignsWorkflow, diff --git a/packages/medusa/src/api/admin/campaigns/middlewares.ts b/packages/medusa/src/api/admin/campaigns/middlewares.ts index 71211167f2..520d869947 100644 --- a/packages/medusa/src/api/admin/campaigns/middlewares.ts +++ b/packages/medusa/src/api/admin/campaigns/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createLinkBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/admin/campaigns/route.ts b/packages/medusa/src/api/admin/campaigns/route.ts index 18601a2383..f72ba8e3c3 100644 --- a/packages/medusa/src/api/admin/campaigns/route.ts +++ b/packages/medusa/src/api/admin/campaigns/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { createCampaignsWorkflow } from "@medusajs/core-flows" import { ContainerRegistrationKeys, diff --git a/packages/medusa/src/api/admin/claims/[id]/cancel/route.ts b/packages/medusa/src/api/admin/claims/[id]/cancel/route.ts index 1af08e2e79..3f69513b7f 100644 --- a/packages/medusa/src/api/admin/claims/[id]/cancel/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/cancel/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostCancelClaimReqSchemaType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts index a052739267..e7b4940b0c 100644 --- a/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostClaimsItemsActionReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts b/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts index 2a29b56428..26f3dd1d85 100644 --- a/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostClaimItemsReqSchemaType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts index a101e244a2..d5f716b04b 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts @@ -9,8 +9,8 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" -import { refetchEntity } from "../../../../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config" import { AdminPostReturnsRequestItemsActionReqSchemaType } from "../../../../../returns/validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts index 9263fddcad..6eb8899479 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config" import { AdminPostReturnsRequestItemsReqSchemaType } from "../../../../returns/validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts index ca102318c6..1c7277d536 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config" import { AdminPostClaimsShippingActionReqSchemaType } from "../../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts index 00958b901e..1f1f8344c9 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config" import { AdminPostReturnsShippingReqSchemaType } from "../../../../returns/validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts index e519a89e0e..45d0ae9873 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts @@ -10,7 +10,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostClaimsItemsActionReqSchemaType } from "../../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts index 590cc3591c..d44f70b59c 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostClaimsAddItemsReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts index 25c9a73f46..1e6fc9d752 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostClaimsShippingActionReqSchemaType } from "../../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts index ff8a75c595..3b1ea6c1c0 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostClaimsShippingReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/claims/[id]/request/route.ts b/packages/medusa/src/api/admin/claims/[id]/request/route.ts index bdad008ef8..6b2e77b065 100644 --- a/packages/medusa/src/api/admin/claims/[id]/request/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/request/route.ts @@ -10,7 +10,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../returns/query-config" export const POST = async ( diff --git a/packages/medusa/src/api/admin/claims/[id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/route.ts index adafdf2977..542c71edff 100644 --- a/packages/medusa/src/api/admin/claims/[id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/route.ts @@ -1,9 +1,9 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" + refetchEntity, +} from "@medusajs/framework/http" import { MedusaError } from "@medusajs/framework/utils" -import { refetchEntity } from "../../../utils/refetch-entity" import { AdminClaimResponse } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/claims/middlewares.ts b/packages/medusa/src/api/admin/claims/middlewares.ts index 3c733427c2..d8c51fc443 100644 --- a/packages/medusa/src/api/admin/claims/middlewares.ts +++ b/packages/medusa/src/api/admin/claims/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminGetOrdersOrderParams, diff --git a/packages/medusa/src/api/admin/claims/route.ts b/packages/medusa/src/api/admin/claims/route.ts index 197f27c9f8..e5f4c547a8 100644 --- a/packages/medusa/src/api/admin/claims/route.ts +++ b/packages/medusa/src/api/admin/claims/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderClaimsReqSchemaType } from "./validators" export const GET = async ( diff --git a/packages/medusa/src/api/admin/collections/[id]/products/route.ts b/packages/medusa/src/api/admin/collections/[id]/products/route.ts index 283d6a51d1..e0908ccf59 100644 --- a/packages/medusa/src/api/admin/collections/[id]/products/route.ts +++ b/packages/medusa/src/api/admin/collections/[id]/products/route.ts @@ -3,7 +3,7 @@ import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchCollection } from "../../helpers" export const POST = async ( diff --git a/packages/medusa/src/api/admin/collections/[id]/route.ts b/packages/medusa/src/api/admin/collections/[id]/route.ts index 557f058be0..d4d44e2636 100644 --- a/packages/medusa/src/api/admin/collections/[id]/route.ts +++ b/packages/medusa/src/api/admin/collections/[id]/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { deleteCollectionsWorkflow, updateCollectionsWorkflow, diff --git a/packages/medusa/src/api/admin/collections/middlewares.ts b/packages/medusa/src/api/admin/collections/middlewares.ts index c0fc58db86..4cab704040 100644 --- a/packages/medusa/src/api/admin/collections/middlewares.ts +++ b/packages/medusa/src/api/admin/collections/middlewares.ts @@ -1,13 +1,15 @@ import * as QueryConfig from "./query-config" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateCollection, AdminGetCollectionParams, AdminGetCollectionsParams, AdminUpdateCollection, } from "./validators" -import { validateAndTransformBody } from "../../utils/validate-body" import { createLinkBody } from "../../utils/validators" export const adminCollectionRoutesMiddlewares: MiddlewareRoute[] = [ diff --git a/packages/medusa/src/api/admin/collections/route.ts b/packages/medusa/src/api/admin/collections/route.ts index 876498b9cd..8384a70573 100644 --- a/packages/medusa/src/api/admin/collections/route.ts +++ b/packages/medusa/src/api/admin/collections/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { createCollectionsWorkflow } from "@medusajs/core-flows" import { diff --git a/packages/medusa/src/api/admin/currencies/[code]/route.ts b/packages/medusa/src/api/admin/currencies/[code]/route.ts index 4a94170fe8..b6570f7dc5 100644 --- a/packages/medusa/src/api/admin/currencies/[code]/route.ts +++ b/packages/medusa/src/api/admin/currencies/[code]/route.ts @@ -3,7 +3,7 @@ import { MedusaError, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/currencies/middlewares.ts b/packages/medusa/src/api/admin/currencies/middlewares.ts index a09f2ebd51..a8d2910fc0 100644 --- a/packages/medusa/src/api/admin/currencies/middlewares.ts +++ b/packages/medusa/src/api/admin/currencies/middlewares.ts @@ -1,7 +1,7 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" -import { AdminGetCurrencyParams, AdminGetCurrenciesParams } from "./validators" +import { AdminGetCurrenciesParams, AdminGetCurrencyParams } from "./validators" export const adminCurrencyRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/currencies/route.ts b/packages/medusa/src/api/admin/currencies/route.ts index 12e93b9eb4..9b02b63266 100644 --- a/packages/medusa/src/api/admin/currencies/route.ts +++ b/packages/medusa/src/api/admin/currencies/route.ts @@ -2,7 +2,7 @@ import { ContainerRegistrationKeys, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts b/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts index 3daacc2ec7..4aa2ac47c0 100644 --- a/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts +++ b/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts @@ -2,7 +2,7 @@ import { linkCustomersToCustomerGroupWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types" import { refetchCustomerGroup } from "../../helpers" diff --git a/packages/medusa/src/api/admin/customer-groups/[id]/route.ts b/packages/medusa/src/api/admin/customer-groups/[id]/route.ts index e1c8b3a91d..9b09b95715 100644 --- a/packages/medusa/src/api/admin/customer-groups/[id]/route.ts +++ b/packages/medusa/src/api/admin/customer-groups/[id]/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { MedusaError } from "@medusajs/framework/utils" import { refetchCustomerGroup } from "../helpers" diff --git a/packages/medusa/src/api/admin/customer-groups/middlewares.ts b/packages/medusa/src/api/admin/customer-groups/middlewares.ts index aa7cd921b1..45a00986c7 100644 --- a/packages/medusa/src/api/admin/customer-groups/middlewares.ts +++ b/packages/medusa/src/api/admin/customer-groups/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createLinkBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/admin/customer-groups/route.ts b/packages/medusa/src/api/admin/customer-groups/route.ts index 04b7eeeea1..a92c1d8095 100644 --- a/packages/medusa/src/api/admin/customer-groups/route.ts +++ b/packages/medusa/src/api/admin/customer-groups/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { createCustomerGroupsWorkflow } from "@medusajs/core-flows" import { ContainerRegistrationKeys, diff --git a/packages/medusa/src/api/admin/customers/[id]/addresses/[address_id]/route.ts b/packages/medusa/src/api/admin/customers/[id]/addresses/[address_id]/route.ts index 3ba579af04..308745b333 100644 --- a/packages/medusa/src/api/admin/customers/[id]/addresses/[address_id]/route.ts +++ b/packages/medusa/src/api/admin/customers/[id]/addresses/[address_id]/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { deleteCustomerAddressesWorkflow, updateCustomerAddressesWorkflow, diff --git a/packages/medusa/src/api/admin/customers/[id]/addresses/route.ts b/packages/medusa/src/api/admin/customers/[id]/addresses/route.ts index 879b2d4ce5..8f22e19afe 100644 --- a/packages/medusa/src/api/admin/customers/[id]/addresses/route.ts +++ b/packages/medusa/src/api/admin/customers/[id]/addresses/route.ts @@ -2,7 +2,7 @@ import { createCustomerAddressesWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, remoteQueryObjectFromString, diff --git a/packages/medusa/src/api/admin/customers/[id]/route.ts b/packages/medusa/src/api/admin/customers/[id]/route.ts index 0830b9e1d3..2702dc75e7 100644 --- a/packages/medusa/src/api/admin/customers/[id]/route.ts +++ b/packages/medusa/src/api/admin/customers/[id]/route.ts @@ -7,7 +7,7 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchCustomer } from "../helpers" import { AdminUpdateCustomerType } from "../validators" diff --git a/packages/medusa/src/api/admin/customers/middlewares.ts b/packages/medusa/src/api/admin/customers/middlewares.ts index a76b195767..5db65c2f16 100644 --- a/packages/medusa/src/api/admin/customers/middlewares.ts +++ b/packages/medusa/src/api/admin/customers/middlewares.ts @@ -11,8 +11,10 @@ import { } from "./validators" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" export const adminCustomerRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/customers/route.ts b/packages/medusa/src/api/admin/customers/route.ts index bbc131df09..fa6a4aa62b 100644 --- a/packages/medusa/src/api/admin/customers/route.ts +++ b/packages/medusa/src/api/admin/customers/route.ts @@ -8,7 +8,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchCustomer } from "./helpers" import { AdminCreateCustomerType } from "./validators" diff --git a/packages/medusa/src/api/admin/draft-orders/[id]/route.ts b/packages/medusa/src/api/admin/draft-orders/[id]/route.ts index 0ba4c9ce1a..27542ab1ff 100644 --- a/packages/medusa/src/api/admin/draft-orders/[id]/route.ts +++ b/packages/medusa/src/api/admin/draft-orders/[id]/route.ts @@ -1,5 +1,5 @@ import { MedusaError } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refetchOrder } from "../helpers" import { defaultAdminOrderFields } from "../query-config" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/draft-orders/middlewares.ts b/packages/medusa/src/api/admin/draft-orders/middlewares.ts index 0e99da1faf..09624f5c9d 100644 --- a/packages/medusa/src/api/admin/draft-orders/middlewares.ts +++ b/packages/medusa/src/api/admin/draft-orders/middlewares.ts @@ -1,6 +1,6 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformBody } from "@medusajs/framework" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminCreateDraftOrder, diff --git a/packages/medusa/src/api/admin/draft-orders/route.ts b/packages/medusa/src/api/admin/draft-orders/route.ts index 54a890bae4..2af2c958e4 100644 --- a/packages/medusa/src/api/admin/draft-orders/route.ts +++ b/packages/medusa/src/api/admin/draft-orders/route.ts @@ -8,7 +8,7 @@ import { AuthenticatedMedusaRequest, MedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { AdminCreateDraftOrderType } from "./validators" import { refetchOrder } from "./helpers" import { diff --git a/packages/medusa/src/api/admin/draft-orders/validators.ts b/packages/medusa/src/api/admin/draft-orders/validators.ts index e4f0eca644..eeb4161e32 100644 --- a/packages/medusa/src/api/admin/draft-orders/validators.ts +++ b/packages/medusa/src/api/admin/draft-orders/validators.ts @@ -1,9 +1,9 @@ import { z } from "zod" import { AddressPayload, BigNumberInput } from "../../utils/common-validators" import { - WithAdditionalData, createFindParams, createSelectParams, + WithAdditionalData, } from "../../utils/validators" export type AdminGetOrderParamsType = z.infer diff --git a/packages/medusa/src/api/admin/exchanges/[id]/cancel/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/cancel/route.ts index 359866f3f1..2de2b36ec9 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/cancel/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/cancel/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostCancelExchangeReqSchemaType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts index 99faf5f9d0..9e43aeeaac 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts @@ -10,8 +10,8 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" -import { refetchEntity } from "../../../../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config" import { AdminPostExchangesRequestItemsReturnActionReqSchemaType } from "../../../../validators" diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts index 75f95d62d9..d3cc37326b 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config" import { AdminPostExchangesReturnRequestItemsReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts index 7b76f35a2e..b67e23703e 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config" import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators" import { AdminOrderPreview, HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts index 3255e5662c..77ed17423b 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config" import { AdminPostReturnsShippingReqSchemaType } from "../../../../returns/validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts index 15ed208bf2..8de123844a 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts @@ -10,7 +10,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostExchangesItemsActionReqSchemaType } from "../../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts index 28f6a074b8..ca76cc2e4f 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostExchangesAddItemsReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts index d2532b2d9e..7e959b2b14 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts index 32d46a907b..8a8f062efd 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostExchangesShippingReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts index 6ae6bdca9c..cae1644c7c 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts @@ -10,7 +10,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { defaultAdminDetailsReturnFields } from "../../../returns/query-config" export const POST = async ( diff --git a/packages/medusa/src/api/admin/exchanges/[id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/route.ts index 75c55fe9d4..8aa297d7e1 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/route.ts @@ -3,8 +3,8 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" -import { refetchEntity } from "../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/exchanges/middlewares.ts b/packages/medusa/src/api/admin/exchanges/middlewares.ts index a8169b1b2f..37456c76be 100644 --- a/packages/medusa/src/api/admin/exchanges/middlewares.ts +++ b/packages/medusa/src/api/admin/exchanges/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminGetOrdersOrderParams, diff --git a/packages/medusa/src/api/admin/exchanges/route.ts b/packages/medusa/src/api/admin/exchanges/route.ts index 1ef91413d7..692c5c01cb 100644 --- a/packages/medusa/src/api/admin/exchanges/route.ts +++ b/packages/medusa/src/api/admin/exchanges/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderExchangesReqSchemaType } from "./validators" export const GET = async ( diff --git a/packages/medusa/src/api/admin/fulfillment-providers/middlewares.ts b/packages/medusa/src/api/admin/fulfillment-providers/middlewares.ts index d569c425dc..82b3a22d47 100644 --- a/packages/medusa/src/api/admin/fulfillment-providers/middlewares.ts +++ b/packages/medusa/src/api/admin/fulfillment-providers/middlewares.ts @@ -1,6 +1,6 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { maybeApplyLinkFilter } from "../../utils/maybe-apply-link-filter" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { maybeApplyLinkFilter } from "@medusajs/framework/http" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminFulfillmentProvidersParams } from "./validators" diff --git a/packages/medusa/src/api/admin/fulfillment-providers/route.ts b/packages/medusa/src/api/admin/fulfillment-providers/route.ts index 1d0e0442da..ea860ec9b7 100644 --- a/packages/medusa/src/api/admin/fulfillment-providers/route.ts +++ b/packages/medusa/src/api/admin/fulfillment-providers/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/fulfillment-sets/[id]/route.ts b/packages/medusa/src/api/admin/fulfillment-sets/[id]/route.ts index 8c9967b1c0..4a9a3efd21 100644 --- a/packages/medusa/src/api/admin/fulfillment-sets/[id]/route.ts +++ b/packages/medusa/src/api/admin/fulfillment-sets/[id]/route.ts @@ -4,7 +4,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" export const DELETE = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts b/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts index d8ce2eab8a..5df0028f14 100644 --- a/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts +++ b/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts @@ -18,7 +18,7 @@ import { AuthenticatedMedusaRequest, MedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminUpdateFulfillmentSetServiceZonesType } from "../../../validators" export const GET = async ( diff --git a/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/route.ts b/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/route.ts index ba2b5a03a0..1bc3dfca6c 100644 --- a/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/route.ts +++ b/packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/route.ts @@ -1,5 +1,5 @@ import { createServiceZonesWorkflow } from "@medusajs/core-flows" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { AdminCreateFulfillmentSetServiceZonesType } from "../../validators" import { refetchFulfillmentSet } from "../../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/fulfillment-sets/middlewares.ts b/packages/medusa/src/api/admin/fulfillment-sets/middlewares.ts index 9649edf3c6..c9b3211158 100644 --- a/packages/medusa/src/api/admin/fulfillment-sets/middlewares.ts +++ b/packages/medusa/src/api/admin/fulfillment-sets/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminCreateFulfillmentSetServiceZonesSchema, diff --git a/packages/medusa/src/api/admin/fulfillments/[id]/cancel/route.ts b/packages/medusa/src/api/admin/fulfillments/[id]/cancel/route.ts index fa7b95ee45..07effd1f0f 100644 --- a/packages/medusa/src/api/admin/fulfillments/[id]/cancel/route.ts +++ b/packages/medusa/src/api/admin/fulfillments/[id]/cancel/route.ts @@ -2,7 +2,7 @@ import { cancelFulfillmentWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchFulfillment } from "../../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/fulfillments/[id]/shipment/route.ts b/packages/medusa/src/api/admin/fulfillments/[id]/shipment/route.ts index 685c25c48e..340604dd63 100644 --- a/packages/medusa/src/api/admin/fulfillments/[id]/shipment/route.ts +++ b/packages/medusa/src/api/admin/fulfillments/[id]/shipment/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchFulfillment } from "../../helpers" import { AdminCreateShipmentType } from "../../validators" diff --git a/packages/medusa/src/api/admin/fulfillments/middlewares.ts b/packages/medusa/src/api/admin/fulfillments/middlewares.ts index 01cfbc0660..dc791fed3c 100644 --- a/packages/medusa/src/api/admin/fulfillments/middlewares.ts +++ b/packages/medusa/src/api/admin/fulfillments/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminCreateFulfillment, diff --git a/packages/medusa/src/api/admin/fulfillments/route.ts b/packages/medusa/src/api/admin/fulfillments/route.ts index 3452bd5e6f..4efbd776eb 100644 --- a/packages/medusa/src/api/admin/fulfillments/route.ts +++ b/packages/medusa/src/api/admin/fulfillments/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchFulfillment } from "./helpers" import { AdminCreateFulfillmentType } from "./validators" diff --git a/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/[location_id]/route.ts b/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/[location_id]/route.ts index 70cef0c548..693f2890da 100644 --- a/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/[location_id]/route.ts +++ b/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/[location_id]/route.ts @@ -3,7 +3,7 @@ import { MedusaError, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { deleteInventoryLevelsWorkflow, diff --git a/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/batch/route.ts b/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/batch/route.ts index e3069cef2f..49c99f1a5b 100644 --- a/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/batch/route.ts +++ b/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/batch/route.ts @@ -2,7 +2,7 @@ import { AdminCreateInventoryLocationLevelType, AdminUpdateInventoryLocationLevelType, } from "../../../validators" -import { MedusaRequest, MedusaResponse } from "../../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { bulkCreateDeleteLevelsWorkflow } from "@medusajs/core-flows" import { BatchMethodRequest } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/route.ts b/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/route.ts index 69cbc36b5c..8b4f6eb4c0 100644 --- a/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/route.ts +++ b/packages/medusa/src/api/admin/inventory-items/[id]/location-levels/route.ts @@ -2,7 +2,7 @@ import { ContainerRegistrationKeys, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { createInventoryLevelsWorkflow } from "@medusajs/core-flows" import { diff --git a/packages/medusa/src/api/admin/inventory-items/[id]/route.ts b/packages/medusa/src/api/admin/inventory-items/[id]/route.ts index 88778e6a88..65a439c9c7 100644 --- a/packages/medusa/src/api/admin/inventory-items/[id]/route.ts +++ b/packages/medusa/src/api/admin/inventory-items/[id]/route.ts @@ -1,5 +1,5 @@ import { MedusaError } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { deleteInventoryItemWorkflow, updateInventoryItemsWorkflow, diff --git a/packages/medusa/src/api/admin/inventory-items/middlewares.ts b/packages/medusa/src/api/admin/inventory-items/middlewares.ts index e792f10efb..fed4ad50a6 100644 --- a/packages/medusa/src/api/admin/inventory-items/middlewares.ts +++ b/packages/medusa/src/api/admin/inventory-items/middlewares.ts @@ -1,6 +1,9 @@ import * as QueryConfig from "./query-config" -import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { MiddlewareRoute, unlessPath } from "@medusajs/framework/http" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateInventoryItem, AdminCreateInventoryLocationLevel, @@ -11,9 +14,7 @@ import { AdminUpdateInventoryItem, AdminUpdateInventoryLocationLevel, } from "./validators" -import { validateAndTransformBody } from "../../utils/validate-body" import { createBatchBody } from "../../utils/validators" -import { unlessPath } from "../../utils/unless-path" export const adminInventoryRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/inventory-items/route.ts b/packages/medusa/src/api/admin/inventory-items/route.ts index 67544771aa..a420f6411d 100644 --- a/packages/medusa/src/api/admin/inventory-items/route.ts +++ b/packages/medusa/src/api/admin/inventory-items/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, remoteQueryObjectFromString, diff --git a/packages/medusa/src/api/admin/invites/[id]/resend/route.ts b/packages/medusa/src/api/admin/invites/[id]/resend/route.ts index b2dfb02311..38710e135d 100644 --- a/packages/medusa/src/api/admin/invites/[id]/resend/route.ts +++ b/packages/medusa/src/api/admin/invites/[id]/resend/route.ts @@ -1,4 +1,4 @@ -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refreshInviteTokensWorkflow } from "@medusajs/core-flows" import { refetchInvite } from "../../helpers" diff --git a/packages/medusa/src/api/admin/invites/[id]/route.ts b/packages/medusa/src/api/admin/invites/[id]/route.ts index 63111f0303..ff74344368 100644 --- a/packages/medusa/src/api/admin/invites/[id]/route.ts +++ b/packages/medusa/src/api/admin/invites/[id]/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { MedusaError } from "@medusajs/framework/utils" import { deleteInvitesWorkflow } from "@medusajs/core-flows" diff --git a/packages/medusa/src/api/admin/invites/accept/route.ts b/packages/medusa/src/api/admin/invites/accept/route.ts index 63bce0d205..7e92f0be08 100644 --- a/packages/medusa/src/api/admin/invites/accept/route.ts +++ b/packages/medusa/src/api/admin/invites/accept/route.ts @@ -4,7 +4,7 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { AdminInviteAcceptType } from "../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/invites/middlewares.ts b/packages/medusa/src/api/admin/invites/middlewares.ts index 3da7d0c38b..adb4f7fa62 100644 --- a/packages/medusa/src/api/admin/invites/middlewares.ts +++ b/packages/medusa/src/api/admin/invites/middlewares.ts @@ -10,8 +10,10 @@ import { import { MiddlewareRoute } from "@medusajs/framework/http" import { authenticate } from "../../../utils/middlewares/authenticate-middleware" -import { validateAndTransformQuery } from "../../utils/validate-query" -import { validateAndTransformBody } from "../../utils/validate-body" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" // TODO: Due to issues with our routing (and using router.use for applying middlewares), we have to opt-out of global auth in all routes, and then reapply it here. // See https://medusacorp.slack.com/archives/C025KMS13SA/p1716455350491879 for details. diff --git a/packages/medusa/src/api/admin/invites/route.ts b/packages/medusa/src/api/admin/invites/route.ts index b0fe542ab0..de0ff1cc3b 100644 --- a/packages/medusa/src/api/admin/invites/route.ts +++ b/packages/medusa/src/api/admin/invites/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, remoteQueryObjectFromString, diff --git a/packages/medusa/src/api/admin/notifications/[id]/route.ts b/packages/medusa/src/api/admin/notifications/[id]/route.ts index 233fa6266f..e0ee0d4b15 100644 --- a/packages/medusa/src/api/admin/notifications/[id]/route.ts +++ b/packages/medusa/src/api/admin/notifications/[id]/route.ts @@ -1,9 +1,9 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" + refetchEntity, +} from "@medusajs/framework/http" import { AdminGetNotificationParamsType } from "../validators" -import { refetchEntity } from "../../../utils/refetch-entity" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/notifications/middlewares.ts b/packages/medusa/src/api/admin/notifications/middlewares.ts index b1b2e34f65..ee0d4b6a7d 100644 --- a/packages/medusa/src/api/admin/notifications/middlewares.ts +++ b/packages/medusa/src/api/admin/notifications/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminGetNotificationParams, diff --git a/packages/medusa/src/api/admin/notifications/route.ts b/packages/medusa/src/api/admin/notifications/route.ts index eca1e96572..b76fa1ea42 100644 --- a/packages/medusa/src/api/admin/notifications/route.ts +++ b/packages/medusa/src/api/admin/notifications/route.ts @@ -1,8 +1,8 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" -import { refetchEntities } from "../../utils/refetch-entity" + refetchEntities, +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts index 9c1c3364da..ee8b3facbc 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts index 6fdc273735..6763b51cc5 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts @@ -6,7 +6,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderEditsItemsActionReqSchemaType } from "../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts index 64ac656cb3..7a8087205c 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderEditsUpdateItemQuantityReqSchemaType } from "../../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts index 99a85e4334..747e9c961c 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts @@ -4,7 +4,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderEditsAddItemsReqSchemaType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts index 2bf308b0d3..8461431540 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/order-edits/[id]/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/route.ts index e571cba5e4..21565972c7 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" export const DELETE = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts index a986b19e82..ed02212440 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts @@ -6,7 +6,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderEditsShippingActionReqSchemaType } from "../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts index 41cd661910..758fd18d22 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderEditsShippingReqSchemaType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/order-edits/middlewares.ts b/packages/medusa/src/api/admin/order-edits/middlewares.ts index 5154324b0f..86498c4cd1 100644 --- a/packages/medusa/src/api/admin/order-edits/middlewares.ts +++ b/packages/medusa/src/api/admin/order-edits/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" +import { validateAndTransformBody } from "@medusajs/framework" import { AdminPostOrderEditsAddItemsReqSchema, AdminPostOrderEditsItemsActionReqSchema, diff --git a/packages/medusa/src/api/admin/order-edits/route.ts b/packages/medusa/src/api/admin/order-edits/route.ts index fd9b4adaeb..4573992e48 100644 --- a/packages/medusa/src/api/admin/order-edits/route.ts +++ b/packages/medusa/src/api/admin/order-edits/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostOrderEditsReqSchemaType } from "./validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/orders/[id]/archive/route.ts b/packages/medusa/src/api/admin/orders/[id]/archive/route.ts index 485578fee9..71fc16ef34 100644 --- a/packages/medusa/src/api/admin/orders/[id]/archive/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/archive/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const POST = async ( diff --git a/packages/medusa/src/api/admin/orders/[id]/cancel/route.ts b/packages/medusa/src/api/admin/orders/[id]/cancel/route.ts index 27b725f04d..20b4538a38 100644 --- a/packages/medusa/src/api/admin/orders/[id]/cancel/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/cancel/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/orders/[id]/changes/route.ts b/packages/medusa/src/api/admin/orders/[id]/changes/route.ts index 063e3d4d6e..ca78811eec 100644 --- a/packages/medusa/src/api/admin/orders/[id]/changes/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/changes/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/orders/[id]/complete/route.ts b/packages/medusa/src/api/admin/orders/[id]/complete/route.ts index d00dd65a42..aa50d1a82f 100644 --- a/packages/medusa/src/api/admin/orders/[id]/complete/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/complete/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts b/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts index 99fe6248e9..7acaa065f8 100644 --- a/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/cancel/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminOrderCancelFulfillmentType } from "../../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts b/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts index 7b8e92c88a..44b236ca4d 100644 --- a/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/mark-as-delivered/route.ts @@ -3,8 +3,8 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" -import { refetchEntity } from "../../../../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts b/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts index 9e13d3b5f2..665588a87e 100644 --- a/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/fulfillments/[fulfillment_id]/shipments/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminOrderCreateShipmentType } from "../../../../validators" import { AdditionalData, HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/orders/[id]/fulfillments/route.ts b/packages/medusa/src/api/admin/orders/[id]/fulfillments/route.ts index 43386fafe9..9f9c3eb17c 100644 --- a/packages/medusa/src/api/admin/orders/[id]/fulfillments/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/fulfillments/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminOrderCreateFulfillmentType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/orders/[id]/preview/route.ts b/packages/medusa/src/api/admin/orders/[id]/preview/route.ts index 65807ffb5d..0128c2d00b 100644 --- a/packages/medusa/src/api/admin/orders/[id]/preview/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/preview/route.ts @@ -3,7 +3,7 @@ import { Modules } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/orders/[id]/route.ts b/packages/medusa/src/api/admin/orders/[id]/route.ts index 790281ee80..df493a2d57 100644 --- a/packages/medusa/src/api/admin/orders/[id]/route.ts +++ b/packages/medusa/src/api/admin/orders/[id]/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/orders/middlewares.ts b/packages/medusa/src/api/admin/orders/middlewares.ts index fbd2b97097..bcaf9d8ce6 100644 --- a/packages/medusa/src/api/admin/orders/middlewares.ts +++ b/packages/medusa/src/api/admin/orders/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminCompleteOrder, diff --git a/packages/medusa/src/api/admin/orders/route.ts b/packages/medusa/src/api/admin/orders/route.ts index acad912c77..610827e190 100644 --- a/packages/medusa/src/api/admin/orders/route.ts +++ b/packages/medusa/src/api/admin/orders/route.ts @@ -3,7 +3,7 @@ import { HttpTypes, OrderDTO } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/payment-collections/[id]/mark-as-paid/route.ts b/packages/medusa/src/api/admin/payment-collections/[id]/mark-as-paid/route.ts index 43ffcd1224..6e77a7549b 100644 --- a/packages/medusa/src/api/admin/payment-collections/[id]/mark-as-paid/route.ts +++ b/packages/medusa/src/api/admin/payment-collections/[id]/mark-as-paid/route.ts @@ -3,8 +3,8 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" -import { refetchEntity } from "../../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" import { AdminMarkPaymentCollectionPaidType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/payment-collections/[id]/route.ts b/packages/medusa/src/api/admin/payment-collections/[id]/route.ts index d24e2fc763..b66d87bc91 100644 --- a/packages/medusa/src/api/admin/payment-collections/[id]/route.ts +++ b/packages/medusa/src/api/admin/payment-collections/[id]/route.ts @@ -3,7 +3,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" export const DELETE = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/payment-collections/middlewares.ts b/packages/medusa/src/api/admin/payment-collections/middlewares.ts index c66ca87290..cd2c992f92 100644 --- a/packages/medusa/src/api/admin/payment-collections/middlewares.ts +++ b/packages/medusa/src/api/admin/payment-collections/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as queryConfig from "./query-config" import { AdminCreatePaymentCollection, diff --git a/packages/medusa/src/api/admin/payment-collections/route.ts b/packages/medusa/src/api/admin/payment-collections/route.ts index a89de99f9e..f96e0da602 100644 --- a/packages/medusa/src/api/admin/payment-collections/route.ts +++ b/packages/medusa/src/api/admin/payment-collections/route.ts @@ -3,8 +3,8 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" -import { refetchEntity } from "../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" import { AdminCreatePaymentCollectionType } from "./validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/payments/[id]/capture/route.ts b/packages/medusa/src/api/admin/payments/[id]/capture/route.ts index 7f9c5d8e8e..7bc812a4d3 100644 --- a/packages/medusa/src/api/admin/payments/[id]/capture/route.ts +++ b/packages/medusa/src/api/admin/payments/[id]/capture/route.ts @@ -2,7 +2,7 @@ import { capturePaymentWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchPayment } from "../../helpers" import { AdminCreatePaymentCaptureType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/payments/[id]/refund/route.ts b/packages/medusa/src/api/admin/payments/[id]/refund/route.ts index 27b266bbbb..f7429b9472 100644 --- a/packages/medusa/src/api/admin/payments/[id]/refund/route.ts +++ b/packages/medusa/src/api/admin/payments/[id]/refund/route.ts @@ -2,7 +2,7 @@ import { refundPaymentWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchPayment } from "../../helpers" import { AdminCreatePaymentRefundType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/payments/[id]/route.ts b/packages/medusa/src/api/admin/payments/[id]/route.ts index b94e391e35..1ef740c4e0 100644 --- a/packages/medusa/src/api/admin/payments/[id]/route.ts +++ b/packages/medusa/src/api/admin/payments/[id]/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { AdminGetPaymentParamsType } from "../validators" import { refetchPayment } from "../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/payments/middlewares.ts b/packages/medusa/src/api/admin/payments/middlewares.ts index cc70a29201..c3bf4484ce 100644 --- a/packages/medusa/src/api/admin/payments/middlewares.ts +++ b/packages/medusa/src/api/admin/payments/middlewares.ts @@ -1,7 +1,8 @@ -import { MiddlewareRoute } from "@medusajs/framework/http" -import { unlessPath } from "../../utils/unless-path" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { MiddlewareRoute, unlessPath } from "@medusajs/framework/http" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as queryConfig from "./query-config" import { AdminCreatePaymentCapture, diff --git a/packages/medusa/src/api/admin/payments/payment-providers/route.ts b/packages/medusa/src/api/admin/payments/payment-providers/route.ts index 043210e208..2da7855902 100644 --- a/packages/medusa/src/api/admin/payments/payment-providers/route.ts +++ b/packages/medusa/src/api/admin/payments/payment-providers/route.ts @@ -2,7 +2,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, remoteQueryObjectFromString, diff --git a/packages/medusa/src/api/admin/payments/route.ts b/packages/medusa/src/api/admin/payments/route.ts index b2d2f6a8ba..f6ca4f26c2 100644 --- a/packages/medusa/src/api/admin/payments/route.ts +++ b/packages/medusa/src/api/admin/payments/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/price-lists/[id]/prices/batch/route.ts b/packages/medusa/src/api/admin/price-lists/[id]/prices/batch/route.ts index 4894ac944d..4a74ae6d1c 100644 --- a/packages/medusa/src/api/admin/price-lists/[id]/prices/batch/route.ts +++ b/packages/medusa/src/api/admin/price-lists/[id]/prices/batch/route.ts @@ -2,7 +2,7 @@ import { promiseAll } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { listPrices } from "../../../queries" import { adminPriceListPriceRemoteQueryFields } from "../../../query-config" import { BatchMethodRequest, HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts b/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts index 0b27a1667a..176852575c 100644 --- a/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts +++ b/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts @@ -4,7 +4,7 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { fetchPriceList, fetchPriceListPriceIdsForProduct } from "../../helpers" export const POST = async ( diff --git a/packages/medusa/src/api/admin/price-lists/[id]/route.ts b/packages/medusa/src/api/admin/price-lists/[id]/route.ts index bf0d3f235a..5380fc90e2 100644 --- a/packages/medusa/src/api/admin/price-lists/[id]/route.ts +++ b/packages/medusa/src/api/admin/price-lists/[id]/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { fetchPriceList } from "../helpers" import { AdminUpdatePriceListType } from "../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/price-lists/middlewares.ts b/packages/medusa/src/api/admin/price-lists/middlewares.ts index c6d6b7b76e..ce9ac1dbd9 100644 --- a/packages/medusa/src/api/admin/price-lists/middlewares.ts +++ b/packages/medusa/src/api/admin/price-lists/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createBatchBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/admin/price-lists/queries/get-price-list.ts b/packages/medusa/src/api/admin/price-lists/queries/get-price-list.ts index 88f4898bd3..065b92a062 100644 --- a/packages/medusa/src/api/admin/price-lists/queries/get-price-list.ts +++ b/packages/medusa/src/api/admin/price-lists/queries/get-price-list.ts @@ -1,8 +1,8 @@ import { MedusaContainer } from "@medusajs/framework/types" import { ContainerRegistrationKeys, - MedusaError, isPresent, + MedusaError, remoteQueryObjectFromString, } from "@medusajs/framework/utils" import { AdminPriceListRemoteQueryDTO } from "../types" diff --git a/packages/medusa/src/api/admin/price-lists/route.ts b/packages/medusa/src/api/admin/price-lists/route.ts index e5d959bc01..471e1801f4 100644 --- a/packages/medusa/src/api/admin/price-lists/route.ts +++ b/packages/medusa/src/api/admin/price-lists/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { fetchPriceList, transformPriceList } from "./helpers" import { AdminCreatePriceListType } from "./validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/price-preferences/[id]/route.ts b/packages/medusa/src/api/admin/price-preferences/[id]/route.ts index f07eb7a5a8..ab9909f6cc 100644 --- a/packages/medusa/src/api/admin/price-preferences/[id]/route.ts +++ b/packages/medusa/src/api/admin/price-preferences/[id]/route.ts @@ -7,8 +7,8 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" -import { refetchEntity } from "../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/price-preferences/middlewares.ts b/packages/medusa/src/api/admin/price-preferences/middlewares.ts index 32d1a57cee..7ba5f55368 100644 --- a/packages/medusa/src/api/admin/price-preferences/middlewares.ts +++ b/packages/medusa/src/api/admin/price-preferences/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminCreatePricePreference, diff --git a/packages/medusa/src/api/admin/price-preferences/route.ts b/packages/medusa/src/api/admin/price-preferences/route.ts index 9dba160271..27785a84a3 100644 --- a/packages/medusa/src/api/admin/price-preferences/route.ts +++ b/packages/medusa/src/api/admin/price-preferences/route.ts @@ -2,8 +2,9 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" -import { refetchEntities, refetchEntity } from "../../utils/refetch-entity" + refetchEntities, + refetchEntity, +} from "@medusajs/framework/http" import { createPricePreferencesWorkflow } from "@medusajs/core-flows" export const GET = async ( diff --git a/packages/medusa/src/api/admin/product-categories/[id]/products/route.ts b/packages/medusa/src/api/admin/product-categories/[id]/products/route.ts index 51055da1fb..cc88a24809 100644 --- a/packages/medusa/src/api/admin/product-categories/[id]/products/route.ts +++ b/packages/medusa/src/api/admin/product-categories/[id]/products/route.ts @@ -6,8 +6,8 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" -import { refetchEntity } from "../../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/product-categories/[id]/route.ts b/packages/medusa/src/api/admin/product-categories/[id]/route.ts index c106169cb3..40ca296d79 100644 --- a/packages/medusa/src/api/admin/product-categories/[id]/route.ts +++ b/packages/medusa/src/api/admin/product-categories/[id]/route.ts @@ -9,8 +9,8 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" -import { refetchEntities } from "../../../utils/refetch-entity" + refetchEntities, +} from "@medusajs/framework/http" import { AdminProductCategoryParamsType, AdminUpdateProductCategoryType, diff --git a/packages/medusa/src/api/admin/product-categories/middlewares.ts b/packages/medusa/src/api/admin/product-categories/middlewares.ts index 2097accdbd..c8fa2397f0 100644 --- a/packages/medusa/src/api/admin/product-categories/middlewares.ts +++ b/packages/medusa/src/api/admin/product-categories/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createLinkBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/admin/product-categories/route.ts b/packages/medusa/src/api/admin/product-categories/route.ts index 36edad2b79..bed3e831ae 100644 --- a/packages/medusa/src/api/admin/product-categories/route.ts +++ b/packages/medusa/src/api/admin/product-categories/route.ts @@ -3,8 +3,8 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" -import { refetchEntities } from "../../utils/refetch-entity" + refetchEntities, +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/product-tags/[id]/route.ts b/packages/medusa/src/api/admin/product-tags/[id]/route.ts index 7c88a5f5b0..794bd34d83 100644 --- a/packages/medusa/src/api/admin/product-tags/[id]/route.ts +++ b/packages/medusa/src/api/admin/product-tags/[id]/route.ts @@ -5,13 +5,13 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" + refetchEntity, +} from "@medusajs/framework/http" import { AdminGetProductTagParamsType, AdminUpdateProductTagType, } from "../validators" -import { refetchEntity } from "../../../utils/refetch-entity" import { HttpTypes } from "@medusajs/framework/types" import { MedusaError } from "@medusajs/framework/utils" diff --git a/packages/medusa/src/api/admin/product-tags/middlewares.ts b/packages/medusa/src/api/admin/product-tags/middlewares.ts index b064f893ac..4fb15e9f4e 100644 --- a/packages/medusa/src/api/admin/product-tags/middlewares.ts +++ b/packages/medusa/src/api/admin/product-tags/middlewares.ts @@ -1,13 +1,15 @@ import * as QueryConfig from "./query-config" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateProductTag, AdminGetProductTagParams, AdminGetProductTagsParams, AdminUpdateProductTag, } from "./validators" -import { validateAndTransformBody } from "../../utils/validate-body" export const adminProductTagRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/product-tags/route.ts b/packages/medusa/src/api/admin/product-tags/route.ts index d50a06f100..23d545ffa2 100644 --- a/packages/medusa/src/api/admin/product-tags/route.ts +++ b/packages/medusa/src/api/admin/product-tags/route.ts @@ -1,10 +1,11 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" + refetchEntities, + refetchEntity, +} from "@medusajs/framework/http" import { createProductTagsWorkflow } from "@medusajs/core-flows" -import { refetchEntities, refetchEntity } from "../../utils/refetch-entity" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/product-types/[id]/route.ts b/packages/medusa/src/api/admin/product-types/[id]/route.ts index a6c133dd9d..29ff2f5e38 100644 --- a/packages/medusa/src/api/admin/product-types/[id]/route.ts +++ b/packages/medusa/src/api/admin/product-types/[id]/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchProductType } from "../helpers" import { diff --git a/packages/medusa/src/api/admin/product-types/middlewares.ts b/packages/medusa/src/api/admin/product-types/middlewares.ts index 9d0b68497f..36a0e0ae31 100644 --- a/packages/medusa/src/api/admin/product-types/middlewares.ts +++ b/packages/medusa/src/api/admin/product-types/middlewares.ts @@ -1,13 +1,15 @@ import * as QueryConfig from "./query-config" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateProductType, AdminGetProductTypeParams, AdminGetProductTypesParams, AdminUpdateProductType, } from "./validators" -import { validateAndTransformBody } from "../../utils/validate-body" export const adminProductTypeRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/product-types/route.ts b/packages/medusa/src/api/admin/product-types/route.ts index 3ed14936e7..753f5623fd 100644 --- a/packages/medusa/src/api/admin/product-types/route.ts +++ b/packages/medusa/src/api/admin/product-types/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, diff --git a/packages/medusa/src/api/admin/product-variants/middlewares.ts b/packages/medusa/src/api/admin/product-variants/middlewares.ts index c950e2c9c7..937d19f3f8 100644 --- a/packages/medusa/src/api/admin/product-variants/middlewares.ts +++ b/packages/medusa/src/api/admin/product-variants/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminGetProductVariantsParams } from "./validators" diff --git a/packages/medusa/src/api/admin/product-variants/route.ts b/packages/medusa/src/api/admin/product-variants/route.ts index 6bf0e5d927..b44456fd19 100644 --- a/packages/medusa/src/api/admin/product-variants/route.ts +++ b/packages/medusa/src/api/admin/product-variants/route.ts @@ -1,10 +1,10 @@ import { AuthenticatedMedusaRequest, MedusaResponse, + refetchEntities, } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" import { wrapVariantsWithInventoryQuantity } from "../../utils/middlewares" -import { refetchEntities } from "../../utils/refetch-entity" import { remapKeysForVariant, remapVariantResponse } from "../products/helpers" export const GET = async ( diff --git a/packages/medusa/src/api/admin/products/[id]/options/[option_id]/route.ts b/packages/medusa/src/api/admin/products/[id]/options/[option_id]/route.ts index e7a83b067a..ec86505f76 100644 --- a/packages/medusa/src/api/admin/products/[id]/options/[option_id]/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/options/[option_id]/route.ts @@ -1,7 +1,8 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" + refetchEntity, +} from "@medusajs/framework/http" import { deleteProductOptionsWorkflow, updateProductOptionsWorkflow, @@ -9,7 +10,6 @@ import { import { remapKeysForProduct, remapProductResponse } from "../../../helpers" import { AdditionalData, HttpTypes } from "@medusajs/framework/types" -import { refetchEntity } from "../../../../../utils/refetch-entity" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/products/[id]/options/route.ts b/packages/medusa/src/api/admin/products/[id]/options/route.ts index 3d190e8842..f5a4488de3 100644 --- a/packages/medusa/src/api/admin/products/[id]/options/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/options/route.ts @@ -1,15 +1,13 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" + refetchEntities, + refetchEntity, +} from "@medusajs/framework/http" import { createProductOptionsWorkflow } from "@medusajs/core-flows" import { remapKeysForProduct, remapProductResponse } from "../../helpers" import { AdditionalData, HttpTypes } from "@medusajs/framework/types" -import { - refetchEntities, - refetchEntity, -} from "../../../../utils/refetch-entity" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/products/[id]/route.ts b/packages/medusa/src/api/admin/products/[id]/route.ts index c5a3151944..1aa55d0e99 100644 --- a/packages/medusa/src/api/admin/products/[id]/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/route.ts @@ -5,11 +5,11 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { remapKeysForProduct, remapProductResponse } from "../helpers" import { MedusaError } from "@medusajs/framework/utils" import { AdditionalData, HttpTypes } from "@medusajs/framework/types" -import { refetchEntity } from "../../../utils/refetch-entity" +import { refetchEntity } from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/[inventory_item_id]/route.ts b/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/[inventory_item_id]/route.ts index 7770d7c58f..0dfc9dec51 100644 --- a/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/[inventory_item_id]/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/[inventory_item_id]/route.ts @@ -3,7 +3,7 @@ import { Modules } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchVariant } from "../../../../../helpers" import { AdminUpdateVariantInventoryItemType } from "../../../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/route.ts b/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/route.ts index af52142fb3..459fb7fc1f 100644 --- a/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/inventory-items/route.ts @@ -3,7 +3,7 @@ import { Modules } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchVariant } from "../../../../helpers" import { AdminCreateVariantInventoryItemType } from "../../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/route.ts b/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/route.ts index 511f40c30d..283edee8c2 100644 --- a/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/variants/[variant_id]/route.ts @@ -5,10 +5,10 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdditionalData, HttpTypes } from "@medusajs/framework/types" -import { refetchEntity } from "../../../../../utils/refetch-entity" +import { refetchEntity } from "@medusajs/framework/http" import { remapKeysForProduct, remapKeysForVariant, diff --git a/packages/medusa/src/api/admin/products/[id]/variants/batch/route.ts b/packages/medusa/src/api/admin/products/[id]/variants/batch/route.ts index d43b9cef49..c3a84eb54c 100644 --- a/packages/medusa/src/api/admin/products/[id]/variants/batch/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/variants/batch/route.ts @@ -2,7 +2,7 @@ import { batchProductVariantsWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchBatchVariants, remapVariantResponse } from "../../../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/products/[id]/variants/inventory-items/batch/route.ts b/packages/medusa/src/api/admin/products/[id]/variants/inventory-items/batch/route.ts index a3fe3fe532..193adc732c 100644 --- a/packages/medusa/src/api/admin/products/[id]/variants/inventory-items/batch/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/variants/inventory-items/batch/route.ts @@ -2,7 +2,7 @@ import { batchLinksWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { buildBatchVariantInventoryData } from "../../../../helpers" import { AdminBatchVariantInventoryItemsType } from "../../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/products/[id]/variants/route.ts b/packages/medusa/src/api/admin/products/[id]/variants/route.ts index 04f1ca2c4e..356c2c80aa 100644 --- a/packages/medusa/src/api/admin/products/[id]/variants/route.ts +++ b/packages/medusa/src/api/admin/products/[id]/variants/route.ts @@ -3,12 +3,9 @@ import { AdditionalData, HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { wrapVariantsWithInventoryQuantity } from "../../../../utils/middlewares" -import { - refetchEntities, - refetchEntity, -} from "../../../../utils/refetch-entity" +import { refetchEntities, refetchEntity } from "@medusajs/framework/http" import { remapKeysForProduct, remapKeysForVariant, diff --git a/packages/medusa/src/api/admin/products/batch/route.ts b/packages/medusa/src/api/admin/products/batch/route.ts index bd01bb54de..bdb6a2b41c 100644 --- a/packages/medusa/src/api/admin/products/batch/route.ts +++ b/packages/medusa/src/api/admin/products/batch/route.ts @@ -2,7 +2,7 @@ import { batchProductsWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchBatchProducts, remapProductResponse } from "../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/products/export/route.ts b/packages/medusa/src/api/admin/products/export/route.ts index 1709130e7e..c401d33ec2 100644 --- a/packages/medusa/src/api/admin/products/export/route.ts +++ b/packages/medusa/src/api/admin/products/export/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" import { remapKeysForProduct } from "../helpers" import { exportProductsWorkflow } from "@medusajs/core-flows" diff --git a/packages/medusa/src/api/admin/products/import/[transaction_id]/confirm/route.ts b/packages/medusa/src/api/admin/products/import/[transaction_id]/confirm/route.ts index c57fc247c4..283b15897c 100644 --- a/packages/medusa/src/api/admin/products/import/[transaction_id]/confirm/route.ts +++ b/packages/medusa/src/api/admin/products/import/[transaction_id]/confirm/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { importProductsWorkflowId, diff --git a/packages/medusa/src/api/admin/products/import/route.ts b/packages/medusa/src/api/admin/products/import/route.ts index a61255fdce..a5523fc094 100644 --- a/packages/medusa/src/api/admin/products/import/route.ts +++ b/packages/medusa/src/api/admin/products/import/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" import { MedusaError } from "@medusajs/framework/utils" import { importProductsWorkflow } from "@medusajs/core-flows" diff --git a/packages/medusa/src/api/admin/products/middlewares.ts b/packages/medusa/src/api/admin/products/middlewares.ts index 96154358fd..0b5478cdf4 100644 --- a/packages/medusa/src/api/admin/products/middlewares.ts +++ b/packages/medusa/src/api/admin/products/middlewares.ts @@ -1,8 +1,12 @@ -import { MiddlewareRoute } from "@medusajs/framework/http" -import { maybeApplyLinkFilter } from "../../utils/maybe-apply-link-filter" -import { unlessPath } from "../../utils/unless-path" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + maybeApplyLinkFilter, + MiddlewareRoute, + unlessPath, +} from "@medusajs/framework/http" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createBatchBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { maybeApplyPriceListsFilter } from "./utils" diff --git a/packages/medusa/src/api/admin/products/route.ts b/packages/medusa/src/api/admin/products/route.ts index 3bbfb9a626..3a3fb48d7e 100644 --- a/packages/medusa/src/api/admin/products/route.ts +++ b/packages/medusa/src/api/admin/products/route.ts @@ -3,8 +3,9 @@ import { AdditionalData, HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" -import { refetchEntities, refetchEntity } from "../../utils/refetch-entity" + refetchEntities, + refetchEntity, +} from "@medusajs/framework/http" import { remapKeysForProduct, remapProductResponse } from "./helpers" export const GET = async ( diff --git a/packages/medusa/src/api/admin/products/utils/maybe-apply-price-lists-filter.ts b/packages/medusa/src/api/admin/products/utils/maybe-apply-price-lists-filter.ts index 95af0c866e..4dce5c8f3f 100644 --- a/packages/medusa/src/api/admin/products/utils/maybe-apply-price-lists-filter.ts +++ b/packages/medusa/src/api/admin/products/utils/maybe-apply-price-lists-filter.ts @@ -4,7 +4,7 @@ import { remoteQueryObjectFromString, } from "@medusajs/framework/utils" import { NextFunction } from "express" -import { MedusaRequest } from "../../../../types/routing" +import { MedusaRequest } from "@medusajs/framework/http" export function maybeApplyPriceListsFilter() { return async function applyPriceListsFilter( diff --git a/packages/medusa/src/api/admin/promotions/[id]/[rule_type]/route.ts b/packages/medusa/src/api/admin/promotions/[id]/[rule_type]/route.ts index dd85771868..e492acb7c6 100644 --- a/packages/medusa/src/api/admin/promotions/[id]/[rule_type]/route.ts +++ b/packages/medusa/src/api/admin/promotions/[id]/[rule_type]/route.ts @@ -8,7 +8,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { getRuleAttributesMap, operatorsMap, diff --git a/packages/medusa/src/api/admin/promotions/[id]/buy-rules/batch/route.ts b/packages/medusa/src/api/admin/promotions/[id]/buy-rules/batch/route.ts index b791504ad8..0bbc9e7d77 100644 --- a/packages/medusa/src/api/admin/promotions/[id]/buy-rules/batch/route.ts +++ b/packages/medusa/src/api/admin/promotions/[id]/buy-rules/batch/route.ts @@ -2,7 +2,7 @@ import { batchPromotionRulesWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { BatchMethodRequest, HttpTypes } from "@medusajs/framework/types" import { RuleType } from "@medusajs/framework/utils" import { refetchBatchRules } from "../../../helpers" diff --git a/packages/medusa/src/api/admin/promotions/[id]/route.ts b/packages/medusa/src/api/admin/promotions/[id]/route.ts index 8241b4dfd6..a489b02254 100644 --- a/packages/medusa/src/api/admin/promotions/[id]/route.ts +++ b/packages/medusa/src/api/admin/promotions/[id]/route.ts @@ -10,7 +10,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchPromotion } from "../helpers" import { AdminGetPromotionParamsType, diff --git a/packages/medusa/src/api/admin/promotions/[id]/rules/batch/route.ts b/packages/medusa/src/api/admin/promotions/[id]/rules/batch/route.ts index 7d13383de2..9212c8234a 100644 --- a/packages/medusa/src/api/admin/promotions/[id]/rules/batch/route.ts +++ b/packages/medusa/src/api/admin/promotions/[id]/rules/batch/route.ts @@ -2,7 +2,7 @@ import { batchPromotionRulesWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { BatchMethodRequest, HttpTypes } from "@medusajs/framework/types" import { RuleType } from "@medusajs/framework/utils" import { refetchBatchRules } from "../../../helpers" diff --git a/packages/medusa/src/api/admin/promotions/[id]/target-rules/batch/route.ts b/packages/medusa/src/api/admin/promotions/[id]/target-rules/batch/route.ts index a986689a95..99e9206add 100644 --- a/packages/medusa/src/api/admin/promotions/[id]/target-rules/batch/route.ts +++ b/packages/medusa/src/api/admin/promotions/[id]/target-rules/batch/route.ts @@ -2,7 +2,7 @@ import { batchPromotionRulesWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { BatchMethodRequest, HttpTypes } from "@medusajs/framework/types" import { RuleType } from "@medusajs/framework/utils" import { refetchBatchRules } from "../../../helpers" diff --git a/packages/medusa/src/api/admin/promotions/helpers.ts b/packages/medusa/src/api/admin/promotions/helpers.ts index 701b7a4a9f..6e0dac17fa 100644 --- a/packages/medusa/src/api/admin/promotions/helpers.ts +++ b/packages/medusa/src/api/admin/promotions/helpers.ts @@ -1,8 +1,12 @@ -import { BatchMethodResponse, BatchResponse } from "@medusajs/framework/types" -import { PromotionRuleDTO, MedusaContainer } from "@medusajs/framework/types" import { - promiseAll, + BatchMethodResponse, + BatchResponse, + MedusaContainer, + PromotionRuleDTO, +} from "@medusajs/framework/types" +import { ContainerRegistrationKeys, + promiseAll, remoteQueryObjectFromString, } from "@medusajs/framework/utils" diff --git a/packages/medusa/src/api/admin/promotions/middlewares.ts b/packages/medusa/src/api/admin/promotions/middlewares.ts index b4492d0ace..b2af4edd5f 100644 --- a/packages/medusa/src/api/admin/promotions/middlewares.ts +++ b/packages/medusa/src/api/admin/promotions/middlewares.ts @@ -1,7 +1,8 @@ -import { MiddlewareRoute } from "@medusajs/framework/http" -import { unlessPath } from "../../utils/unless-path" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { MiddlewareRoute, unlessPath } from "@medusajs/framework/http" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createBatchBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/admin/promotions/route.ts b/packages/medusa/src/api/admin/promotions/route.ts index 7c6dd4d930..6d534ac562 100644 --- a/packages/medusa/src/api/admin/promotions/route.ts +++ b/packages/medusa/src/api/admin/promotions/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchPromotion } from "./helpers" import { AdditionalData, HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/promotions/rule-attribute-options/[rule_type]/route.ts b/packages/medusa/src/api/admin/promotions/rule-attribute-options/[rule_type]/route.ts index fb4fca9319..056203ac91 100644 --- a/packages/medusa/src/api/admin/promotions/rule-attribute-options/[rule_type]/route.ts +++ b/packages/medusa/src/api/admin/promotions/rule-attribute-options/[rule_type]/route.ts @@ -2,7 +2,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { getRuleAttributesMap, validateRuleType } from "../../utils" export const GET = async ( diff --git a/packages/medusa/src/api/admin/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts b/packages/medusa/src/api/admin/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts index 4e81869556..e2f76f22ae 100644 --- a/packages/medusa/src/api/admin/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts +++ b/packages/medusa/src/api/admin/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { ruleQueryConfigurations, validateRuleAttribute, diff --git a/packages/medusa/src/api/admin/refund-reasons/[id]/route.ts b/packages/medusa/src/api/admin/refund-reasons/[id]/route.ts index 1b95b6b3cb..6e2fe28f31 100644 --- a/packages/medusa/src/api/admin/refund-reasons/[id]/route.ts +++ b/packages/medusa/src/api/admin/refund-reasons/[id]/route.ts @@ -6,8 +6,8 @@ import { HttpTypes, RefundReasonResponse } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" -import { refetchEntity } from "../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" import { AdminUpdatePaymentRefundReasonType } from "../validators" export const GET = async ( diff --git a/packages/medusa/src/api/admin/refund-reasons/middlewares.ts b/packages/medusa/src/api/admin/refund-reasons/middlewares.ts index 45d05e6c3c..e364b195b1 100644 --- a/packages/medusa/src/api/admin/refund-reasons/middlewares.ts +++ b/packages/medusa/src/api/admin/refund-reasons/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as queryConfig from "./query-config" import { AdminCreatePaymentRefundReason, diff --git a/packages/medusa/src/api/admin/refund-reasons/route.ts b/packages/medusa/src/api/admin/refund-reasons/route.ts index 7aaddd0c38..196113d118 100644 --- a/packages/medusa/src/api/admin/refund-reasons/route.ts +++ b/packages/medusa/src/api/admin/refund-reasons/route.ts @@ -2,6 +2,8 @@ import { createRefundReasonsWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, + refetchEntities, + refetchEntity, } from "@medusajs/framework/http" import { AdminCreateRefundReason, @@ -10,7 +12,6 @@ import { RefundReasonResponse, RefundReasonsResponse, } from "@medusajs/framework/types" -import { refetchEntities, refetchEntity } from "../../utils/refetch-entity" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/regions/[id]/route.ts b/packages/medusa/src/api/admin/regions/[id]/route.ts index bf09bd902e..542d6ff060 100644 --- a/packages/medusa/src/api/admin/regions/[id]/route.ts +++ b/packages/medusa/src/api/admin/regions/[id]/route.ts @@ -6,7 +6,7 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchRegion } from "../helpers" import { AdminGetRegionParamsType, AdminUpdateRegionType } from "../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/regions/middlewares.ts b/packages/medusa/src/api/admin/regions/middlewares.ts index 5fe924e6a7..5095f50a5b 100644 --- a/packages/medusa/src/api/admin/regions/middlewares.ts +++ b/packages/medusa/src/api/admin/regions/middlewares.ts @@ -1,13 +1,15 @@ import * as QueryConfig from "./query-config" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateRegion, AdminGetRegionParams, AdminGetRegionsParams, AdminUpdateRegion, } from "./validators" -import { validateAndTransformBody } from "../../utils/validate-body" export const adminRegionRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/regions/route.ts b/packages/medusa/src/api/admin/regions/route.ts index d854182231..6295beeb5b 100644 --- a/packages/medusa/src/api/admin/regions/route.ts +++ b/packages/medusa/src/api/admin/regions/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchRegion } from "./helpers" export const GET = async ( diff --git a/packages/medusa/src/api/admin/reservations/[id]/route.ts b/packages/medusa/src/api/admin/reservations/[id]/route.ts index 8562790688..c741c46b4d 100644 --- a/packages/medusa/src/api/admin/reservations/[id]/route.ts +++ b/packages/medusa/src/api/admin/reservations/[id]/route.ts @@ -1,14 +1,16 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { AdminGetReservationParamsType, AdminUpdateReservationType, } from "../validators" import { MedusaError } from "@medusajs/framework/utils" -import { deleteReservationsWorkflow } from "@medusajs/core-flows" -import { updateReservationsWorkflow } from "@medusajs/core-flows" +import { + deleteReservationsWorkflow, + updateReservationsWorkflow, +} from "@medusajs/core-flows" import { refetchReservation } from "../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/reservations/middlewares.ts b/packages/medusa/src/api/admin/reservations/middlewares.ts index a63ff4eb56..c9fee8dd34 100644 --- a/packages/medusa/src/api/admin/reservations/middlewares.ts +++ b/packages/medusa/src/api/admin/reservations/middlewares.ts @@ -1,14 +1,16 @@ import * as QueryConfig from "./query-config" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateReservation, AdminGetReservationParams, AdminGetReservationsParams, AdminUpdateReservation, } from "./validators" -import { validateAndTransformBody } from "../../utils/validate-body" export const adminReservationRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/reservations/route.ts b/packages/medusa/src/api/admin/reservations/route.ts index 75ff850e40..70069074bf 100644 --- a/packages/medusa/src/api/admin/reservations/route.ts +++ b/packages/medusa/src/api/admin/reservations/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, remoteQueryObjectFromString, diff --git a/packages/medusa/src/api/admin/return-reasons/[id]/route.ts b/packages/medusa/src/api/admin/return-reasons/[id]/route.ts index eab259317c..c8985c5b77 100644 --- a/packages/medusa/src/api/admin/return-reasons/[id]/route.ts +++ b/packages/medusa/src/api/admin/return-reasons/[id]/route.ts @@ -11,8 +11,8 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" -import { refetchEntity } from "../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/return-reasons/middlewares.ts b/packages/medusa/src/api/admin/return-reasons/middlewares.ts index 5ea19aadfb..d73a126066 100644 --- a/packages/medusa/src/api/admin/return-reasons/middlewares.ts +++ b/packages/medusa/src/api/admin/return-reasons/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminCreateReturnReason, diff --git a/packages/medusa/src/api/admin/return-reasons/route.ts b/packages/medusa/src/api/admin/return-reasons/route.ts index 2f16bddb28..3b429e95c3 100644 --- a/packages/medusa/src/api/admin/return-reasons/route.ts +++ b/packages/medusa/src/api/admin/return-reasons/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/returns/[id]/cancel/route.ts b/packages/medusa/src/api/admin/returns/[id]/cancel/route.ts index 6f2663426d..fde47af53d 100644 --- a/packages/medusa/src/api/admin/returns/[id]/cancel/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/cancel/route.ts @@ -2,7 +2,7 @@ import { cancelReturnWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostCancelReturnReqSchemaType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/dismiss-items/[action_id]/route.ts b/packages/medusa/src/api/admin/returns/[id]/dismiss-items/[action_id]/route.ts index 9be4c766c6..43e93142d7 100644 --- a/packages/medusa/src/api/admin/returns/[id]/dismiss-items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/dismiss-items/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsDismissItemsActionReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/dismiss-items/route.ts b/packages/medusa/src/api/admin/returns/[id]/dismiss-items/route.ts index 3f8d4ddd4e..8199ee440a 100644 --- a/packages/medusa/src/api/admin/returns/[id]/dismiss-items/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/dismiss-items/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsReceiveItemsReqSchemaType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/receive-items/[action_id]/route.ts b/packages/medusa/src/api/admin/returns/[id]/receive-items/[action_id]/route.ts index d25b67af13..e888df6b71 100644 --- a/packages/medusa/src/api/admin/returns/[id]/receive-items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/receive-items/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsReceiveItemsActionReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/receive-items/route.ts b/packages/medusa/src/api/admin/returns/[id]/receive-items/route.ts index a5fd460342..ed578d97c9 100644 --- a/packages/medusa/src/api/admin/returns/[id]/receive-items/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/receive-items/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsReceiveItemsReqSchemaType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/receive/confirm/route.ts b/packages/medusa/src/api/admin/returns/[id]/receive/confirm/route.ts index ed27acf55b..a9a423f85a 100644 --- a/packages/medusa/src/api/admin/returns/[id]/receive/confirm/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/receive/confirm/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsConfirmRequestReqSchemaType } from "../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/returns/[id]/receive/route.ts b/packages/medusa/src/api/admin/returns/[id]/receive/route.ts index 2aa2a97ed6..72c8965d39 100644 --- a/packages/medusa/src/api/admin/returns/[id]/receive/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/receive/route.ts @@ -12,7 +12,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReceiveReturnsReqSchemaType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/returns/[id]/request-items/[action_id]/route.ts b/packages/medusa/src/api/admin/returns/[id]/request-items/[action_id]/route.ts index 4b32c19b7f..3b9794b0f2 100644 --- a/packages/medusa/src/api/admin/returns/[id]/request-items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/request-items/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsRequestItemsActionReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/request-items/route.ts b/packages/medusa/src/api/admin/returns/[id]/request-items/route.ts index aec4decfcd..778da5c340 100644 --- a/packages/medusa/src/api/admin/returns/[id]/request-items/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/request-items/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsRequestItemsReqSchemaType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/request/route.ts b/packages/medusa/src/api/admin/returns/[id]/request/route.ts index 1b7a065b42..7c855e26c1 100644 --- a/packages/medusa/src/api/admin/returns/[id]/request/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/request/route.ts @@ -10,7 +10,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsConfirmRequestReqSchemaType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/returns/[id]/route.ts b/packages/medusa/src/api/admin/returns/[id]/route.ts index 4879121bd2..b5aeaa91e1 100644 --- a/packages/medusa/src/api/admin/returns/[id]/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsReturnReqSchemaType } from "../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/returns/[id]/shipping-method/[action_id]/route.ts index 279a63d7ae..bff1df6a55 100644 --- a/packages/medusa/src/api/admin/returns/[id]/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/shipping-method/[action_id]/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsShippingActionReqSchemaType } from "../../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/[id]/shipping-method/route.ts b/packages/medusa/src/api/admin/returns/[id]/shipping-method/route.ts index b75494e5d6..48ea183493 100644 --- a/packages/medusa/src/api/admin/returns/[id]/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/shipping-method/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsShippingReqSchemaType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/returns/middlewares.ts b/packages/medusa/src/api/admin/returns/middlewares.ts index 603ecac5b6..917c17a736 100644 --- a/packages/medusa/src/api/admin/returns/middlewares.ts +++ b/packages/medusa/src/api/admin/returns/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminGetOrdersOrderParams, diff --git a/packages/medusa/src/api/admin/returns/route.ts b/packages/medusa/src/api/admin/returns/route.ts index fbac8a8fc8..b978282d0b 100644 --- a/packages/medusa/src/api/admin/returns/route.ts +++ b/packages/medusa/src/api/admin/returns/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { AdminPostReturnsReqSchemaType } from "./validators" export const GET = async ( diff --git a/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts b/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts index 51216e19c5..a25e6a2790 100644 --- a/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts +++ b/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { linkProductsToSalesChannelWorkflow } from "@medusajs/core-flows" import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/sales-channels/[id]/route.ts b/packages/medusa/src/api/admin/sales-channels/[id]/route.ts index 57f7d5a913..29fddac17e 100644 --- a/packages/medusa/src/api/admin/sales-channels/[id]/route.ts +++ b/packages/medusa/src/api/admin/sales-channels/[id]/route.ts @@ -6,7 +6,7 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchSalesChannel } from "../helpers" import { AdminGetSalesChannelParamsType, diff --git a/packages/medusa/src/api/admin/sales-channels/middlewares.ts b/packages/medusa/src/api/admin/sales-channels/middlewares.ts index e3ac4ffc28..a0518373d0 100644 --- a/packages/medusa/src/api/admin/sales-channels/middlewares.ts +++ b/packages/medusa/src/api/admin/sales-channels/middlewares.ts @@ -1,7 +1,8 @@ -import { MiddlewareRoute } from "@medusajs/framework/http" -import { maybeApplyLinkFilter } from "../../utils/maybe-apply-link-filter" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { maybeApplyLinkFilter, MiddlewareRoute } from "@medusajs/framework/http" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createLinkBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/admin/sales-channels/route.ts b/packages/medusa/src/api/admin/sales-channels/route.ts index efc06ca87f..ba11c04feb 100644 --- a/packages/medusa/src/api/admin/sales-channels/route.ts +++ b/packages/medusa/src/api/admin/sales-channels/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchSalesChannel } from "./helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/shipping-options/[id]/route.ts b/packages/medusa/src/api/admin/shipping-options/[id]/route.ts index 9d8c7f1f87..b04289bf67 100644 --- a/packages/medusa/src/api/admin/shipping-options/[id]/route.ts +++ b/packages/medusa/src/api/admin/shipping-options/[id]/route.ts @@ -6,7 +6,7 @@ import { FulfillmentWorkflow, HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchShippingOption } from "../helpers" import { AdminGetShippingOptionParamsType, diff --git a/packages/medusa/src/api/admin/shipping-options/[id]/rules/batch/route.ts b/packages/medusa/src/api/admin/shipping-options/[id]/rules/batch/route.ts index c33ee37bb8..167af0bfd5 100644 --- a/packages/medusa/src/api/admin/shipping-options/[id]/rules/batch/route.ts +++ b/packages/medusa/src/api/admin/shipping-options/[id]/rules/batch/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { BatchMethodRequest, HttpTypes } from "@medusajs/framework/types" import { refetchBatchRules } from "../../../helpers" import { batchShippingOptionRulesWorkflow } from "@medusajs/core-flows" diff --git a/packages/medusa/src/api/admin/shipping-options/middlewares.ts b/packages/medusa/src/api/admin/shipping-options/middlewares.ts index 3ed040e4e1..46ce963126 100644 --- a/packages/medusa/src/api/admin/shipping-options/middlewares.ts +++ b/packages/medusa/src/api/admin/shipping-options/middlewares.ts @@ -1,7 +1,8 @@ -import { MiddlewareRoute } from "@medusajs/framework/http" -import { maybeApplyLinkFilter } from "../../utils/maybe-apply-link-filter" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { maybeApplyLinkFilter, MiddlewareRoute } from "@medusajs/framework/http" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createBatchBody } from "../../utils/validators" import { listTransformQueryConfig, diff --git a/packages/medusa/src/api/admin/shipping-options/route.ts b/packages/medusa/src/api/admin/shipping-options/route.ts index dba358fdcc..38efbec210 100644 --- a/packages/medusa/src/api/admin/shipping-options/route.ts +++ b/packages/medusa/src/api/admin/shipping-options/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchShippingOption } from "./helpers" export const GET = async ( diff --git a/packages/medusa/src/api/admin/shipping-profiles/[id]/route.ts b/packages/medusa/src/api/admin/shipping-profiles/[id]/route.ts index a8f896a026..b93bb52814 100644 --- a/packages/medusa/src/api/admin/shipping-profiles/[id]/route.ts +++ b/packages/medusa/src/api/admin/shipping-profiles/[id]/route.ts @@ -7,7 +7,7 @@ import { Modules } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchShippingProfile } from "../helpers" import { AdminGetShippingProfileParamsType, diff --git a/packages/medusa/src/api/admin/shipping-profiles/middlewares.ts b/packages/medusa/src/api/admin/shipping-profiles/middlewares.ts index a44853d6fb..a65422a0bd 100644 --- a/packages/medusa/src/api/admin/shipping-profiles/middlewares.ts +++ b/packages/medusa/src/api/admin/shipping-profiles/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { listTransformQueryConfig, retrieveTransformQueryConfig, diff --git a/packages/medusa/src/api/admin/shipping-profiles/route.ts b/packages/medusa/src/api/admin/shipping-profiles/route.ts index 8243fc1140..1474431cab 100644 --- a/packages/medusa/src/api/admin/shipping-profiles/route.ts +++ b/packages/medusa/src/api/admin/shipping-profiles/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchShippingProfile } from "./helpers" export const POST = async ( diff --git a/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-providers/route.ts b/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-providers/route.ts index 3db4728c62..0c136a0021 100644 --- a/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-providers/route.ts +++ b/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-providers/route.ts @@ -5,7 +5,7 @@ import { Modules } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchStockLocation } from "../../helpers" const buildLinks = (id, fulfillmentProviderIds: string[]) => { diff --git a/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-sets/route.ts b/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-sets/route.ts index 2e8ffa9db0..c21f1a73dd 100644 --- a/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-sets/route.ts +++ b/packages/medusa/src/api/admin/stock-locations/[id]/fulfillment-sets/route.ts @@ -2,7 +2,7 @@ import { createLocationFulfillmentSetWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchStockLocation } from "../../helpers" import { AdminCreateStockLocationFulfillmentSetType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/stock-locations/[id]/route.ts b/packages/medusa/src/api/admin/stock-locations/[id]/route.ts index 362c533f8a..44103cc3e4 100644 --- a/packages/medusa/src/api/admin/stock-locations/[id]/route.ts +++ b/packages/medusa/src/api/admin/stock-locations/[id]/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { deleteStockLocationsWorkflow, diff --git a/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts b/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts index 1ae4cb1511..a86cc09757 100644 --- a/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts +++ b/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { linkSalesChannelsToStockLocationWorkflow } from "@medusajs/core-flows" import { HttpTypes, LinkMethodRequest } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/stock-locations/middlewares.ts b/packages/medusa/src/api/admin/stock-locations/middlewares.ts index da36ec96c4..cfe528c590 100644 --- a/packages/medusa/src/api/admin/stock-locations/middlewares.ts +++ b/packages/medusa/src/api/admin/stock-locations/middlewares.ts @@ -1,7 +1,8 @@ -import { MiddlewareRoute } from "@medusajs/framework/http" -import { maybeApplyLinkFilter } from "../../utils/maybe-apply-link-filter" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { maybeApplyLinkFilter, MiddlewareRoute } from "@medusajs/framework/http" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { createLinkBody } from "../../utils/validators" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/admin/stock-locations/route.ts b/packages/medusa/src/api/admin/stock-locations/route.ts index 3e393e9011..fd30bd7658 100644 --- a/packages/medusa/src/api/admin/stock-locations/route.ts +++ b/packages/medusa/src/api/admin/stock-locations/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { createStockLocationsWorkflow } from "@medusajs/core-flows" import { refetchStockLocation } from "./helpers" diff --git a/packages/medusa/src/api/admin/stores/[id]/route.ts b/packages/medusa/src/api/admin/stores/[id]/route.ts index 8c5117ad76..735631b002 100644 --- a/packages/medusa/src/api/admin/stores/[id]/route.ts +++ b/packages/medusa/src/api/admin/stores/[id]/route.ts @@ -1,13 +1,13 @@ import { updateStoresWorkflow } from "@medusajs/core-flows" import { - remoteQueryObjectFromString, ContainerRegistrationKeys, MedusaError, + remoteQueryObjectFromString, } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { AdminGetStoreParamsType, AdminUpdateStoreType } from "../validators" import { refetchStore } from "../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/stores/middlewares.ts b/packages/medusa/src/api/admin/stores/middlewares.ts index 97bff81e13..0e9f3db0e9 100644 --- a/packages/medusa/src/api/admin/stores/middlewares.ts +++ b/packages/medusa/src/api/admin/stores/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminGetStoreParams, diff --git a/packages/medusa/src/api/admin/stores/route.ts b/packages/medusa/src/api/admin/stores/route.ts index c4be27b623..eaf9d340b3 100644 --- a/packages/medusa/src/api/admin/stores/route.ts +++ b/packages/medusa/src/api/admin/stores/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/tax-rates/[id]/route.ts b/packages/medusa/src/api/admin/tax-rates/[id]/route.ts index 8aa369d23e..ffea1b5a74 100644 --- a/packages/medusa/src/api/admin/tax-rates/[id]/route.ts +++ b/packages/medusa/src/api/admin/tax-rates/[id]/route.ts @@ -10,7 +10,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchTaxRate } from "../helpers" import { AdminGetTaxRateParamsType, diff --git a/packages/medusa/src/api/admin/tax-rates/[id]/rules/[rule_id]/route.ts b/packages/medusa/src/api/admin/tax-rates/[id]/rules/[rule_id]/route.ts index ed64563235..adcce3aa9d 100644 --- a/packages/medusa/src/api/admin/tax-rates/[id]/rules/[rule_id]/route.ts +++ b/packages/medusa/src/api/admin/tax-rates/[id]/rules/[rule_id]/route.ts @@ -2,7 +2,7 @@ import { deleteTaxRateRulesWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { refetchTaxRate } from "../../../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/tax-rates/[id]/rules/route.ts b/packages/medusa/src/api/admin/tax-rates/[id]/rules/route.ts index 07223c5797..6b926e455d 100644 --- a/packages/medusa/src/api/admin/tax-rates/[id]/rules/route.ts +++ b/packages/medusa/src/api/admin/tax-rates/[id]/rules/route.ts @@ -2,7 +2,7 @@ import { createTaxRateRulesWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminCreateTaxRateRuleType } from "../../validators" import { refetchTaxRate } from "../../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/tax-rates/middlewares.ts b/packages/medusa/src/api/admin/tax-rates/middlewares.ts index fface469de..faa5dab2b3 100644 --- a/packages/medusa/src/api/admin/tax-rates/middlewares.ts +++ b/packages/medusa/src/api/admin/tax-rates/middlewares.ts @@ -1,6 +1,9 @@ import * as QueryConfig from "./query-config" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import { AdminCreateTaxRate, AdminCreateTaxRateRule, @@ -10,7 +13,6 @@ import { } from "./validators" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" export const adminTaxRateRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/tax-rates/route.ts b/packages/medusa/src/api/admin/tax-rates/route.ts index 6255e961c9..ac0f49086a 100644 --- a/packages/medusa/src/api/admin/tax-rates/route.ts +++ b/packages/medusa/src/api/admin/tax-rates/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchTaxRate } from "./helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/tax-regions/[id]/route.ts b/packages/medusa/src/api/admin/tax-regions/[id]/route.ts index 3e16c0d085..c503cc37c7 100644 --- a/packages/medusa/src/api/admin/tax-regions/[id]/route.ts +++ b/packages/medusa/src/api/admin/tax-regions/[id]/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/tax-regions/middlewares.ts b/packages/medusa/src/api/admin/tax-regions/middlewares.ts index cae55d57a2..b060c0814f 100644 --- a/packages/medusa/src/api/admin/tax-regions/middlewares.ts +++ b/packages/medusa/src/api/admin/tax-regions/middlewares.ts @@ -7,8 +7,10 @@ import { } from "./validators" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" export const adminTaxRegionRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/tax-regions/route.ts b/packages/medusa/src/api/admin/tax-regions/route.ts index a330fc221f..260e9494e2 100644 --- a/packages/medusa/src/api/admin/tax-regions/route.ts +++ b/packages/medusa/src/api/admin/tax-regions/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchTaxRegion } from "./helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/uploads/[id]/route.ts b/packages/medusa/src/api/admin/uploads/[id]/route.ts index ca95767b2a..095d02b91f 100644 --- a/packages/medusa/src/api/admin/uploads/[id]/route.ts +++ b/packages/medusa/src/api/admin/uploads/[id]/route.ts @@ -1,14 +1,14 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { deleteFilesWorkflow } from "@medusajs/core-flows" import { HttpTypes } from "@medusajs/framework/types" import { ContainerRegistrationKeys, MedusaError, + remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { remoteQueryObjectFromString } from "@medusajs/framework/utils" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/uploads/middlewares.ts b/packages/medusa/src/api/admin/uploads/middlewares.ts index 291834c812..880ebb424a 100644 --- a/packages/medusa/src/api/admin/uploads/middlewares.ts +++ b/packages/medusa/src/api/admin/uploads/middlewares.ts @@ -1,6 +1,6 @@ import multer from "multer" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import { retrieveUploadConfig } from "./query-config" import { AdminGetUploadParams } from "./validators" diff --git a/packages/medusa/src/api/admin/uploads/route.ts b/packages/medusa/src/api/admin/uploads/route.ts index 3debedff84..ef3750fd13 100644 --- a/packages/medusa/src/api/admin/uploads/route.ts +++ b/packages/medusa/src/api/admin/uploads/route.ts @@ -2,7 +2,7 @@ import { uploadFilesWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { MedusaError } from "@medusajs/framework/utils" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/admin/users/[id]/route.ts b/packages/medusa/src/api/admin/users/[id]/route.ts index 1604ff4a10..63b6008f17 100644 --- a/packages/medusa/src/api/admin/users/[id]/route.ts +++ b/packages/medusa/src/api/admin/users/[id]/route.ts @@ -6,7 +6,7 @@ import { HttpTypes, UpdateUserDTO } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, diff --git a/packages/medusa/src/api/admin/users/me/route.ts b/packages/medusa/src/api/admin/users/me/route.ts index 440966c085..a9c99cbafd 100644 --- a/packages/medusa/src/api/admin/users/me/route.ts +++ b/packages/medusa/src/api/admin/users/me/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/admin/users/middlewares.ts b/packages/medusa/src/api/admin/users/middlewares.ts index 0fb60be320..aca62a56a1 100644 --- a/packages/medusa/src/api/admin/users/middlewares.ts +++ b/packages/medusa/src/api/admin/users/middlewares.ts @@ -1,7 +1,9 @@ import { MiddlewareRoute } from "@medusajs/framework/http" import { authenticate } from "../../../utils/middlewares/authenticate-middleware" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { AdminGetUserParams, diff --git a/packages/medusa/src/api/admin/users/route.ts b/packages/medusa/src/api/admin/users/route.ts index e228e0b3c8..c8627954ef 100644 --- a/packages/medusa/src/api/admin/users/route.ts +++ b/packages/medusa/src/api/admin/users/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/users/validators.ts b/packages/medusa/src/api/admin/users/validators.ts index 23e080ffcc..49b6430af3 100644 --- a/packages/medusa/src/api/admin/users/validators.ts +++ b/packages/medusa/src/api/admin/users/validators.ts @@ -38,4 +38,3 @@ export const AdminUpdateUser = z.object({ last_name: z.string().nullish(), avatar_url: z.string().nullish(), }) - diff --git a/packages/medusa/src/api/admin/workflows-executions/[id]/route.ts b/packages/medusa/src/api/admin/workflows-executions/[id]/route.ts index 56a0eee092..d4fd88de28 100644 --- a/packages/medusa/src/api/admin/workflows-executions/[id]/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/[id]/route.ts @@ -2,7 +2,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { AdminGetWorkflowExecutionDetailsParamsType } from "../validators" import { diff --git a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/[step_id]/subscribe/route.ts b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/[step_id]/subscribe/route.ts index d00439dabe..d8a4263b34 100644 --- a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/[step_id]/subscribe/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/[step_id]/subscribe/route.ts @@ -2,7 +2,7 @@ import { IWorkflowEngineService } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../../types/routing" +} from "@medusajs/framework/http" import { Modules } from "@medusajs/framework/utils" diff --git a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/route.ts b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/route.ts index 6c803f8cab..80d76efc51 100644 --- a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/[transaction_id]/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, diff --git a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/run/route.ts b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/run/route.ts index 531e0bbaa0..521f38b98d 100644 --- a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/run/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/run/route.ts @@ -7,7 +7,7 @@ import { Modules } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { AdminCreateWorkflowsRunType } from "../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/failure/route.ts b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/failure/route.ts index 78a3b77637..3b75070f69 100644 --- a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/failure/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/failure/route.ts @@ -1,12 +1,15 @@ -import { TransactionHandlerType, isDefined } from "@medusajs/framework/utils" +import { + isDefined, + Modules, + TransactionHandlerType, +} from "@medusajs/framework/utils" import { StepResponse } from "@medusajs/framework/workflows-sdk" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { IWorkflowEngineService } from "@medusajs/framework/types" -import { Modules } from "@medusajs/framework/utils" import { AdminCreateWorkflowsAsyncResponseType } from "../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/success/route.ts b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/success/route.ts index 8cffbbaf19..b824283f07 100644 --- a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/success/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/steps/success/route.ts @@ -1,12 +1,15 @@ -import { TransactionHandlerType, isDefined } from "@medusajs/framework/utils" +import { + isDefined, + Modules, + TransactionHandlerType, +} from "@medusajs/framework/utils" import { StepResponse } from "@medusajs/framework/workflows-sdk" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { IWorkflowEngineService } from "@medusajs/framework/types" -import { Modules } from "@medusajs/framework/utils" import { AdminCreateWorkflowsAsyncResponseType } from "../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/subscribe/route.ts b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/subscribe/route.ts index e4b75b345d..8200939671 100644 --- a/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/subscribe/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/[workflow_id]/subscribe/route.ts @@ -2,7 +2,7 @@ import { IWorkflowEngineService } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { Modules } from "@medusajs/framework/utils" diff --git a/packages/medusa/src/api/admin/workflows-executions/middlewares.ts b/packages/medusa/src/api/admin/workflows-executions/middlewares.ts index 65212987a4..ee1e70b3d2 100644 --- a/packages/medusa/src/api/admin/workflows-executions/middlewares.ts +++ b/packages/medusa/src/api/admin/workflows-executions/middlewares.ts @@ -8,8 +8,8 @@ import { } from "./validators" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" -import { validateAndTransformBody } from "../../utils/validate-body" +import { validateAndTransformQuery } from "@medusajs/framework" +import { validateAndTransformBody } from "@medusajs/framework" export const adminWorkflowsExecutionsMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/admin/workflows-executions/route.ts b/packages/medusa/src/api/admin/workflows-executions/route.ts index 65aea7582b..0a4bdf39ad 100644 --- a/packages/medusa/src/api/admin/workflows-executions/route.ts +++ b/packages/medusa/src/api/admin/workflows-executions/route.ts @@ -2,7 +2,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, remoteQueryObjectFromString, diff --git a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/callback/route.ts b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/callback/route.ts index 1546eb2c77..2d2fd69b0a 100644 --- a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/callback/route.ts +++ b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/callback/route.ts @@ -8,7 +8,7 @@ import { MedusaError, Modules, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { generateJwtTokenForAuthIdentity } from "../../../utils/generate-jwt-token" export const GET = async (req: MedusaRequest, res: MedusaResponse) => { diff --git a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/register/route.ts b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/register/route.ts index e04a2ae623..ac226bacac 100644 --- a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/register/route.ts +++ b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/register/route.ts @@ -8,7 +8,7 @@ import { MedusaError, Modules, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { generateJwtTokenForAuthIdentity } from "../../../utils/generate-jwt-token" export const POST = async (req: MedusaRequest, res: MedusaResponse) => { 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 dfa373ffa2..93e9e28c6f 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 @@ -3,7 +3,7 @@ import { ContainerRegistrationKeys } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { ResetPasswordRequestType } from "../../../validators" export const POST = async ( diff --git a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/route.ts b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/route.ts index e6b26d9fe9..627c71aed3 100644 --- a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/route.ts +++ b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/route.ts @@ -8,7 +8,7 @@ import { MedusaError, Modules, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { generateJwtTokenForAuthIdentity } from "../../utils/generate-jwt-token" export const GET = async (req: MedusaRequest, res: MedusaResponse) => { diff --git a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/update/route.ts b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/update/route.ts index 750a80adf6..2f910f8181 100644 --- a/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/update/route.ts +++ b/packages/medusa/src/api/auth/[actor_type]/[auth_provider]/update/route.ts @@ -1,7 +1,9 @@ -import { AuthenticatedMedusaRequest } from "@medusajs/framework/http" +import { + AuthenticatedMedusaRequest, + MedusaResponse, +} from "@medusajs/framework/http" import { IAuthModuleService } from "@medusajs/framework/types" import { MedusaError, Modules } from "@medusajs/framework/utils" -import { MedusaResponse } from "../../../../../types/routing" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/auth/middlewares.ts b/packages/medusa/src/api/auth/middlewares.ts index cb6b46fec0..cc7df3e92f 100644 --- a/packages/medusa/src/api/auth/middlewares.ts +++ b/packages/medusa/src/api/auth/middlewares.ts @@ -1,5 +1,8 @@ -import { authenticate, MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../utils/validate-body" +import { + authenticate, + MiddlewareRoute, + validateAndTransformBody, +} from "@medusajs/framework/http" import { validateScopeProviderAssociation } from "./utils/validate-scope-provider-association" import { validateToken } from "./utils/validate-token" import { ResetPasswordRequest } from "./validators" diff --git a/packages/medusa/src/api/auth/session/route.ts b/packages/medusa/src/api/auth/session/route.ts index 153d3ea25b..0560f9418f 100644 --- a/packages/medusa/src/api/auth/session/route.ts +++ b/packages/medusa/src/api/auth/session/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/auth/token/refresh/route.ts b/packages/medusa/src/api/auth/token/refresh/route.ts index 413f6741b4..222c5486a8 100644 --- a/packages/medusa/src/api/auth/token/refresh/route.ts +++ b/packages/medusa/src/api/auth/token/refresh/route.ts @@ -3,7 +3,7 @@ import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { generateJwtTokenForAuthIdentity } from "../../utils/generate-jwt-token" // Retrieve a newly generated JWT token. All checks that the existing token is valid already happen in the auth middleware. diff --git a/packages/medusa/src/api/hooks/payment/[provider]/route.ts b/packages/medusa/src/api/hooks/payment/[provider]/route.ts index 2be6739ca5..ae9ca3ba7a 100644 --- a/packages/medusa/src/api/hooks/payment/[provider]/route.ts +++ b/packages/medusa/src/api/hooks/payment/[provider]/route.ts @@ -1,7 +1,7 @@ import { PaymentModuleOptions } from "@medusajs/framework/types" import { Modules, PaymentWebhookEvents } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" export const POST = async (req: MedusaRequest, res: MedusaResponse) => { try { diff --git a/packages/medusa/src/api/store/carts/[id]/complete/route.ts b/packages/medusa/src/api/store/carts/[id]/complete/route.ts index 3e157eeb03..782f04bfe3 100644 --- a/packages/medusa/src/api/store/carts/[id]/complete/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/complete/route.ts @@ -1,7 +1,7 @@ import { completeCartWorkflow } from "@medusajs/core-flows" import { MedusaError } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" -import { prepareRetrieveQuery } from "../../../../../utils/get-query-config" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" +import { prepareRetrieveQuery } from "@medusajs/framework" import { refetchOrder } from "../../../orders/helpers" import { refetchCart } from "../../helpers" import { defaultStoreCartFields } from "../../query-config" diff --git a/packages/medusa/src/api/store/carts/[id]/line-items/[line_id]/route.ts b/packages/medusa/src/api/store/carts/[id]/line-items/[line_id]/route.ts index cead30d66c..d073568957 100644 --- a/packages/medusa/src/api/store/carts/[id]/line-items/[line_id]/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/line-items/[line_id]/route.ts @@ -4,8 +4,8 @@ import { } from "@medusajs/core-flows" import { HttpTypes } from "@medusajs/framework/types" import { MedusaError } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../../../types/routing" -import { prepareListQuery } from "../../../../../../utils/get-query-config" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" +import { prepareListQuery } from "@medusajs/framework" import { refetchCart } from "../../../helpers" import { StoreUpdateCartLineItemType } from "../../../validators" diff --git a/packages/medusa/src/api/store/carts/[id]/line-items/route.ts b/packages/medusa/src/api/store/carts/[id]/line-items/route.ts index c739ce7db9..5a50d7b374 100644 --- a/packages/medusa/src/api/store/carts/[id]/line-items/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/line-items/route.ts @@ -1,5 +1,5 @@ import { addToCartWorkflow } from "@medusajs/core-flows" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refetchCart } from "../../helpers" import { StoreAddCartLineItemType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/store/carts/[id]/promotions/route.ts b/packages/medusa/src/api/store/carts/[id]/promotions/route.ts index a5b82f4690..a851b85d76 100644 --- a/packages/medusa/src/api/store/carts/[id]/promotions/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/promotions/route.ts @@ -1,6 +1,6 @@ import { updateCartPromotionsWorkflow } from "@medusajs/core-flows" import { PromotionActions } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refetchCart } from "../../helpers" import { StoreAddCartPromotionsType, diff --git a/packages/medusa/src/api/store/carts/[id]/route.ts b/packages/medusa/src/api/store/carts/[id]/route.ts index c420807d2c..1a752e21f4 100644 --- a/packages/medusa/src/api/store/carts/[id]/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/route.ts @@ -5,7 +5,7 @@ import { UpdateCartDataDTO, } from "@medusajs/framework/types" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refetchCart } from "../helpers" export const GET = async ( diff --git a/packages/medusa/src/api/store/carts/[id]/shipping-methods/route.ts b/packages/medusa/src/api/store/carts/[id]/shipping-methods/route.ts index 65f69949d5..df1f24f289 100644 --- a/packages/medusa/src/api/store/carts/[id]/shipping-methods/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/shipping-methods/route.ts @@ -1,5 +1,5 @@ import { addShippingMethodToWorkflow } from "@medusajs/core-flows" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refetchCart } from "../../helpers" import { StoreAddCartShippingMethodsType } from "../../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/store/carts/[id]/taxes/route.ts b/packages/medusa/src/api/store/carts/[id]/taxes/route.ts index fa7797103d..1f8f198a50 100644 --- a/packages/medusa/src/api/store/carts/[id]/taxes/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/taxes/route.ts @@ -1,6 +1,6 @@ import { updateTaxLinesWorkflow } from "@medusajs/core-flows" import { HttpTypes } from "@medusajs/framework/types" -import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refetchCart } from "../../helpers" export const POST = async ( diff --git a/packages/medusa/src/api/store/carts/middlewares.ts b/packages/medusa/src/api/store/carts/middlewares.ts index c67f29d3b5..eea117f6e2 100644 --- a/packages/medusa/src/api/store/carts/middlewares.ts +++ b/packages/medusa/src/api/store/carts/middlewares.ts @@ -1,8 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" import { ensurePublishableKeyAndSalesChannelMatch } from "../../utils/middlewares/common/ensure-pub-key-sales-channel-match" import { maybeAttachPublishableKeyScopes } from "../../utils/middlewares/common/maybe-attach-pub-key-scopes" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformBody } from "@medusajs/framework" +import { validateAndTransformQuery } from "@medusajs/framework" import * as OrderQueryConfig from "../orders/query-config" import { StoreGetOrderParams } from "../orders/validators" import * as QueryConfig from "./query-config" diff --git a/packages/medusa/src/api/store/carts/route.ts b/packages/medusa/src/api/store/carts/route.ts index b310eb1f1f..15e5539cac 100644 --- a/packages/medusa/src/api/store/carts/route.ts +++ b/packages/medusa/src/api/store/carts/route.ts @@ -7,7 +7,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { refetchCart } from "./helpers" export const POST = async ( diff --git a/packages/medusa/src/api/store/collections/[id]/route.ts b/packages/medusa/src/api/store/collections/[id]/route.ts index 563f8378ed..a545af34fb 100644 --- a/packages/medusa/src/api/store/collections/[id]/route.ts +++ b/packages/medusa/src/api/store/collections/[id]/route.ts @@ -2,7 +2,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { refetchCollection } from "../helpers" export const GET = async ( diff --git a/packages/medusa/src/api/store/collections/middlewares.ts b/packages/medusa/src/api/store/collections/middlewares.ts index 45aa4f0388..ff414e0977 100644 --- a/packages/medusa/src/api/store/collections/middlewares.ts +++ b/packages/medusa/src/api/store/collections/middlewares.ts @@ -1,6 +1,6 @@ import * as QueryConfig from "./query-config" import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import { StoreGetCollectionParams, StoreGetCollectionsParams, diff --git a/packages/medusa/src/api/store/collections/route.ts b/packages/medusa/src/api/store/collections/route.ts index d40c814daa..506d186074 100644 --- a/packages/medusa/src/api/store/collections/route.ts +++ b/packages/medusa/src/api/store/collections/route.ts @@ -2,7 +2,7 @@ import { HttpTypes } from "@medusajs/framework/types" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, diff --git a/packages/medusa/src/api/store/currencies/[code]/route.ts b/packages/medusa/src/api/store/currencies/[code]/route.ts index d239a0bd74..d132ac9f7f 100644 --- a/packages/medusa/src/api/store/currencies/[code]/route.ts +++ b/packages/medusa/src/api/store/currencies/[code]/route.ts @@ -3,7 +3,7 @@ import { MedusaError, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/store/currencies/middlewares.ts b/packages/medusa/src/api/store/currencies/middlewares.ts index e9cde07fe6..a5053efa72 100644 --- a/packages/medusa/src/api/store/currencies/middlewares.ts +++ b/packages/medusa/src/api/store/currencies/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { StoreGetCurrenciesParams, StoreGetCurrencyParams } from "./validators" diff --git a/packages/medusa/src/api/store/currencies/route.ts b/packages/medusa/src/api/store/currencies/route.ts index 461105918f..1b21e03621 100644 --- a/packages/medusa/src/api/store/currencies/route.ts +++ b/packages/medusa/src/api/store/currencies/route.ts @@ -2,7 +2,7 @@ import { ContainerRegistrationKeys, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts b/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts index e33adef2bb..64829aecc8 100644 --- a/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts +++ b/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes, MedusaContainer } from "@medusajs/framework/types" import { ContainerRegistrationKeys, diff --git a/packages/medusa/src/api/store/customers/me/addresses/route.ts b/packages/medusa/src/api/store/customers/me/addresses/route.ts index bb1c801e1d..0dd6e37517 100644 --- a/packages/medusa/src/api/store/customers/me/addresses/route.ts +++ b/packages/medusa/src/api/store/customers/me/addresses/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { createCustomerAddressesWorkflow } from "@medusajs/core-flows" import { diff --git a/packages/medusa/src/api/store/customers/me/route.ts b/packages/medusa/src/api/store/customers/me/route.ts index 433870a771..d7488876fa 100644 --- a/packages/medusa/src/api/store/customers/me/route.ts +++ b/packages/medusa/src/api/store/customers/me/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" +} from "@medusajs/framework/http" import { StoreGetCustomerParamsType, diff --git a/packages/medusa/src/api/store/customers/middlewares.ts b/packages/medusa/src/api/store/customers/middlewares.ts index d36e691d60..8bfbc063fc 100644 --- a/packages/medusa/src/api/store/customers/middlewares.ts +++ b/packages/medusa/src/api/store/customers/middlewares.ts @@ -3,17 +3,19 @@ import * as QueryConfig from "./query-config" import { StoreCreateCustomer, StoreCreateCustomerAddress, - StoreGetCustomerParams, StoreGetCustomerAddressesParams, + StoreGetCustomerAddressParams, + StoreGetCustomerParams, StoreUpdateCustomer, StoreUpdateCustomerAddress, - StoreGetCustomerAddressParams, } from "./validators" import { MiddlewareRoute } from "@medusajs/framework/http" import { authenticate } from "../../../utils/middlewares/authenticate-middleware" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" export const storeCustomerRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/store/customers/route.ts b/packages/medusa/src/api/store/customers/route.ts index b43a7dfb45..ea3921ef46 100644 --- a/packages/medusa/src/api/store/customers/route.ts +++ b/packages/medusa/src/api/store/customers/route.ts @@ -2,7 +2,7 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { createCustomerAccountWorkflow } from "@medusajs/core-flows" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/store/orders/[id]/route.ts b/packages/medusa/src/api/store/orders/[id]/route.ts index 454ca95c8f..1c7a611703 100644 --- a/packages/medusa/src/api/store/orders/[id]/route.ts +++ b/packages/medusa/src/api/store/orders/[id]/route.ts @@ -1,5 +1,5 @@ import { HttpTypes } from "@medusajs/framework/types" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { refetchOrder } from "../helpers" // TODO: Do we want to apply some sort of authentication here? My suggestion is that we do diff --git a/packages/medusa/src/api/store/orders/helpers.ts b/packages/medusa/src/api/store/orders/helpers.ts index aeba3eeb98..0224cdce90 100644 --- a/packages/medusa/src/api/store/orders/helpers.ts +++ b/packages/medusa/src/api/store/orders/helpers.ts @@ -1,5 +1,5 @@ import { MedusaContainer } from "@medusajs/framework/types" -import { refetchEntity } from "../../utils/refetch-entity" +import { refetchEntity } from "@medusajs/framework/http" export const refetchOrder = async ( idOrFilter: string | object, diff --git a/packages/medusa/src/api/store/orders/middlewares.ts b/packages/medusa/src/api/store/orders/middlewares.ts index acbed22d91..26ed5fa4e6 100644 --- a/packages/medusa/src/api/store/orders/middlewares.ts +++ b/packages/medusa/src/api/store/orders/middlewares.ts @@ -1,6 +1,6 @@ import { MiddlewareRoute } from "@medusajs/framework/http" import { authenticate } from "../../../utils/middlewares/authenticate-middleware" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { StoreGetOrderParams, StoreGetOrdersParams } from "./validators" diff --git a/packages/medusa/src/api/store/orders/route.ts b/packages/medusa/src/api/store/orders/route.ts index 48829d1cf2..23465ce7de 100644 --- a/packages/medusa/src/api/store/orders/route.ts +++ b/packages/medusa/src/api/store/orders/route.ts @@ -5,7 +5,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/store/payment-collections/[id]/payment-sessions/route.ts b/packages/medusa/src/api/store/payment-collections/[id]/payment-sessions/route.ts index e81fd92b60..a01707893e 100644 --- a/packages/medusa/src/api/store/payment-collections/[id]/payment-sessions/route.ts +++ b/packages/medusa/src/api/store/payment-collections/[id]/payment-sessions/route.ts @@ -2,7 +2,7 @@ import { createPaymentSessionsWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../../types/routing" +} from "@medusajs/framework/http" import { StoreCreatePaymentSessionType } from "../../validators" import { refetchPaymentCollection } from "../../helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/store/payment-collections/helpers.ts b/packages/medusa/src/api/store/payment-collections/helpers.ts index 4f2deaa594..3f5e7ce664 100644 --- a/packages/medusa/src/api/store/payment-collections/helpers.ts +++ b/packages/medusa/src/api/store/payment-collections/helpers.ts @@ -2,7 +2,7 @@ import { MedusaContainer, PaymentCollectionDTO, } from "@medusajs/framework/types" -import { refetchEntity } from "../../utils/refetch-entity" +import { refetchEntity } from "@medusajs/framework/http" export const refetchPaymentCollection = async ( id: string, diff --git a/packages/medusa/src/api/store/payment-collections/middlewares.ts b/packages/medusa/src/api/store/payment-collections/middlewares.ts index 29539c527d..e873672b60 100644 --- a/packages/medusa/src/api/store/payment-collections/middlewares.ts +++ b/packages/medusa/src/api/store/payment-collections/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as queryConfig from "./query-config" import { StoreCreatePaymentCollection, diff --git a/packages/medusa/src/api/store/payment-collections/route.ts b/packages/medusa/src/api/store/payment-collections/route.ts index 4e73da8615..a70de79dad 100644 --- a/packages/medusa/src/api/store/payment-collections/route.ts +++ b/packages/medusa/src/api/store/payment-collections/route.ts @@ -6,7 +6,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const POST = async ( diff --git a/packages/medusa/src/api/store/payment-providers/middlewares.ts b/packages/medusa/src/api/store/payment-providers/middlewares.ts index 53c90492a1..76238b98be 100644 --- a/packages/medusa/src/api/store/payment-providers/middlewares.ts +++ b/packages/medusa/src/api/store/payment-providers/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as queryConfig from "./query-config" import { StoreGetPaymentProvidersParams } from "./validators" diff --git a/packages/medusa/src/api/store/payment-providers/route.ts b/packages/medusa/src/api/store/payment-providers/route.ts index 145b4b05ad..13e6e80d41 100644 --- a/packages/medusa/src/api/store/payment-providers/route.ts +++ b/packages/medusa/src/api/store/payment-providers/route.ts @@ -1,7 +1,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" import { ContainerRegistrationKeys, MedusaError, diff --git a/packages/medusa/src/api/store/product-categories/[id]/route.ts b/packages/medusa/src/api/store/product-categories/[id]/route.ts index 2f32749d8b..e9d7b10711 100644 --- a/packages/medusa/src/api/store/product-categories/[id]/route.ts +++ b/packages/medusa/src/api/store/product-categories/[id]/route.ts @@ -3,8 +3,8 @@ import { MedusaError } from "@medusajs/framework/utils" import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../../types/routing" -import { refetchEntity } from "../../../utils/refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" import { StoreProductCategoryParamsType } from "../validators" export const GET = async ( diff --git a/packages/medusa/src/api/store/product-categories/middlewares.ts b/packages/medusa/src/api/store/product-categories/middlewares.ts index 41339b5770..b60d46d0e9 100644 --- a/packages/medusa/src/api/store/product-categories/middlewares.ts +++ b/packages/medusa/src/api/store/product-categories/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import { applyCategoryFilters } from "./helpers" import * as QueryConfig from "./query-config" import { diff --git a/packages/medusa/src/api/store/product-categories/route.ts b/packages/medusa/src/api/store/product-categories/route.ts index 9f0571e7ff..d74dd5243e 100644 --- a/packages/medusa/src/api/store/product-categories/route.ts +++ b/packages/medusa/src/api/store/product-categories/route.ts @@ -9,7 +9,7 @@ import { import { AuthenticatedMedusaRequest, MedusaResponse, -} from "../../../types/routing" +} from "@medusajs/framework/http" export const GET = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/store/products/[id]/route.ts b/packages/medusa/src/api/store/products/[id]/route.ts index a062498744..d1bc08f3bf 100644 --- a/packages/medusa/src/api/store/products/[id]/route.ts +++ b/packages/medusa/src/api/store/products/[id]/route.ts @@ -1,9 +1,9 @@ -import { MedusaError, isPresent } from "@medusajs/framework/utils" -import { MedusaResponse } from "../../../../types/routing" +import { isPresent, MedusaError } from "@medusajs/framework/utils" +import { MedusaResponse } from "@medusajs/framework/http" import { wrapVariantsWithInventoryQuantity } from "../../../utils/middlewares" import { - RequestWithContext, refetchProduct, + RequestWithContext, wrapProductsWithTaxPrices, } from "../helpers" import { StoreGetProductParamsType } from "../validators" diff --git a/packages/medusa/src/api/store/products/helpers.ts b/packages/medusa/src/api/store/products/helpers.ts index 19896b52f6..528361a759 100644 --- a/packages/medusa/src/api/store/products/helpers.ts +++ b/packages/medusa/src/api/store/products/helpers.ts @@ -2,12 +2,16 @@ import { HttpTypes, ItemTaxLineDTO, MedusaContainer, - TaxCalculationContext, TaxableItemDTO, + TaxCalculationContext, } from "@medusajs/framework/types" -import { Modules, calculateAmountsWithTax } from "@medusajs/framework/utils" -import { MedusaRequest } from "../../../types/routing" -import { refetchEntities, refetchEntity } from "../../utils/refetch-entity" +import { + MedusaRequest, + refetchEntities, + refetchEntity, +} from "@medusajs/framework/http" +import { calculateAmountsWithTax, Modules } from "@medusajs/framework/utils" +import { TaxModuleService } from "@medusajs/tax/dist/services" export type RequestWithContext = MedusaRequest & { taxContext: { @@ -64,7 +68,7 @@ export const wrapProductsWithTaxPrices = async ( return } - const taxService = req.scope.resolve(Modules.TAX) + const taxService = req.scope.resolve(Modules.TAX) const taxRates = (await taxService.getTaxLines( products.map(asTaxItem).flat(), diff --git a/packages/medusa/src/api/store/products/middlewares.ts b/packages/medusa/src/api/store/products/middlewares.ts index 0e447a1469..0244e636f7 100644 --- a/packages/medusa/src/api/store/products/middlewares.ts +++ b/packages/medusa/src/api/store/products/middlewares.ts @@ -1,23 +1,25 @@ import { isPresent, ProductStatus } from "@medusajs/framework/utils" -import { MiddlewareRoute } from "@medusajs/framework/http" -import { maybeApplyLinkFilter } from "../../utils/maybe-apply-link-filter" import { applyDefaultFilters, + applyParamsAsFilters, clearFiltersByKey, + maybeApplyLinkFilter, + MiddlewareRoute, + setContext, +} from "@medusajs/framework/http" +import { filterByValidSalesChannels, normalizeDataForContext, setPricingContext, setTaxContext, } from "../../utils/middlewares" -import { setContext } from "../../utils/middlewares/common/set-context" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import { maybeApplyStockLocationId } from "./helpers" import * as QueryConfig from "./query-config" import { StoreGetProductsParams, StoreGetProductsParamsType, } from "./validators" -import { applyParamsAsFilters } from "../../utils/middlewares/common/apply-params-as-filters" export const storeProductRoutesMiddlewares: MiddlewareRoute[] = [ { diff --git a/packages/medusa/src/api/store/products/route.ts b/packages/medusa/src/api/store/products/route.ts index 20bc1c401c..97e63531e0 100644 --- a/packages/medusa/src/api/store/products/route.ts +++ b/packages/medusa/src/api/store/products/route.ts @@ -3,7 +3,7 @@ import { isPresent, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaResponse } from "../../../types/routing" +import { MedusaResponse } from "@medusajs/framework/http" import { wrapVariantsWithInventoryQuantity } from "../../utils/middlewares" import { RequestWithContext, wrapProductsWithTaxPrices } from "./helpers" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/store/regions/[id]/route.ts b/packages/medusa/src/api/store/regions/[id]/route.ts index f511761271..d8c75ea3e6 100644 --- a/packages/medusa/src/api/store/regions/[id]/route.ts +++ b/packages/medusa/src/api/store/regions/[id]/route.ts @@ -3,7 +3,7 @@ import { MedusaError, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/store/regions/middlewares.ts b/packages/medusa/src/api/store/regions/middlewares.ts index 066dbf4d77..2b7066d46e 100644 --- a/packages/medusa/src/api/store/regions/middlewares.ts +++ b/packages/medusa/src/api/store/regions/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { StoreGetRegionParams, StoreGetRegionsParams } from "./validators" diff --git a/packages/medusa/src/api/store/regions/route.ts b/packages/medusa/src/api/store/regions/route.ts index 987990670a..b1ec2cbb04 100644 --- a/packages/medusa/src/api/store/regions/route.ts +++ b/packages/medusa/src/api/store/regions/route.ts @@ -2,8 +2,8 @@ import { ContainerRegistrationKeys, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../types/routing" import { HttpTypes } from "@medusajs/framework/types" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" export const GET = async ( req: MedusaRequest, diff --git a/packages/medusa/src/api/store/return-reasons/[id]/route.ts b/packages/medusa/src/api/store/return-reasons/[id]/route.ts index c28997a67b..8c741ef38e 100644 --- a/packages/medusa/src/api/store/return-reasons/[id]/route.ts +++ b/packages/medusa/src/api/store/return-reasons/[id]/route.ts @@ -2,7 +2,7 @@ import { ContainerRegistrationKeys, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { StoreReturnReasonParamsType } from "../validators" import { HttpTypes } from "@medusajs/framework/types" diff --git a/packages/medusa/src/api/store/return-reasons/middlewares.ts b/packages/medusa/src/api/store/return-reasons/middlewares.ts index 408d71c32a..937ec59c8d 100644 --- a/packages/medusa/src/api/store/return-reasons/middlewares.ts +++ b/packages/medusa/src/api/store/return-reasons/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import * as QueryConfig from "./query-config" import { StoreReturnReasonParams } from "./validators" diff --git a/packages/medusa/src/api/store/return-reasons/route.ts b/packages/medusa/src/api/store/return-reasons/route.ts index 2e584efa03..9911bf8089 100644 --- a/packages/medusa/src/api/store/return-reasons/route.ts +++ b/packages/medusa/src/api/store/return-reasons/route.ts @@ -2,7 +2,7 @@ import { ContainerRegistrationKeys, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( diff --git a/packages/medusa/src/api/store/return/middlewares.ts b/packages/medusa/src/api/store/return/middlewares.ts index f38d3b070b..6f5de07398 100644 --- a/packages/medusa/src/api/store/return/middlewares.ts +++ b/packages/medusa/src/api/store/return/middlewares.ts @@ -1,6 +1,8 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformBody } from "../../utils/validate-body" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { + validateAndTransformBody, + validateAndTransformQuery, +} from "@medusajs/framework" import * as QueryConfig from "./query-config" import { ReturnsParams, StorePostReturnsReqSchema } from "./validators" diff --git a/packages/medusa/src/api/store/return/route.ts b/packages/medusa/src/api/store/return/route.ts index ed6c11aa07..9830b7d044 100644 --- a/packages/medusa/src/api/store/return/route.ts +++ b/packages/medusa/src/api/store/return/route.ts @@ -1,5 +1,5 @@ import { createAndCompleteReturnOrderWorkflow } from "@medusajs/core-flows" -import { MedusaRequest, MedusaResponse } from "../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { HttpTypes } from "@medusajs/framework/types" export const POST = async ( diff --git a/packages/medusa/src/api/store/shipping-options/middlewares.ts b/packages/medusa/src/api/store/shipping-options/middlewares.ts index b30af428d3..42bb88e642 100644 --- a/packages/medusa/src/api/store/shipping-options/middlewares.ts +++ b/packages/medusa/src/api/store/shipping-options/middlewares.ts @@ -1,5 +1,5 @@ import { MiddlewareRoute } from "@medusajs/framework/http" -import { validateAndTransformQuery } from "../../utils/validate-query" +import { validateAndTransformQuery } from "@medusajs/framework" import { listTransformQueryConfig } from "./query-config" import { StoreGetShippingOptions } from "./validators" diff --git a/packages/medusa/src/api/store/shipping-options/route.ts b/packages/medusa/src/api/store/shipping-options/route.ts index 254fb8b28d..1c50c1cc2c 100644 --- a/packages/medusa/src/api/store/shipping-options/route.ts +++ b/packages/medusa/src/api/store/shipping-options/route.ts @@ -1,7 +1,7 @@ import { listShippingOptionsForCartWorkflow } from "@medusajs/core-flows" import { HttpTypes, ICartModuleService } from "@medusajs/framework/types" import { MedusaError, Modules } from "@medusajs/framework/utils" -import { MedusaRequest, MedusaResponse } from "../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { StoreGetShippingOptionsType } from "./validators" export const GET = async ( diff --git a/packages/medusa/src/api/utils/__tests__/zod-helper.spec.ts b/packages/medusa/src/api/utils/__tests__/zod-helper.spec.ts deleted file mode 100644 index 0f177503c8..0000000000 --- a/packages/medusa/src/api/utils/__tests__/zod-helper.spec.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { z } from "zod" -import { zodValidator } from "../zod-helper" - -describe("zodValidator", () => { - it("should validate and return validated", async () => { - const schema = z.object({ - id: z.string(), - name: z.string(), - }) - - const toValidate = { - id: "1", - name: "Tony Stark", - } - - const validated = await zodValidator(schema, toValidate) - - expect(JSON.stringify(validated)).toBe( - JSON.stringify({ - id: "1", - name: "Tony Stark", - }) - ) - }) - - it("should show human readable error message for invalid data and unrecognized fields", async () => { - const errorMessage = await zodValidator( - z - .object({ - id: z.string(), - test: z.object({ - name: z.string(), - test2: z.object({ - name: z.string(), - }), - }), - }) - .strict(), - { - id: "1", - name: "Tony Stark", - company: "Stark Industries", - } - ).catch((e) => e.message) - - expect(errorMessage).toContain( - "Invalid request: Field 'test' is required; Unrecognized fields: 'name, company'" - ) - }) - - it("should show human readable error message for invalid type", async () => { - const errorMessage = await zodValidator( - z - .object({ - id: z.string(), - }) - .strict(), - { - id: 1, - } - ).catch((e) => e.message) - - expect(errorMessage).toContain( - "Invalid request: Expected type: 'string' for field 'id', got: 'number'" - ) - }) - - it("should show human readable error message for invalid enum", async () => { - const errorMessage = await zodValidator( - z - .object({ - id: z.enum(["1", "2"]), - }) - .strict(), - { - id: "3", - } - ).catch((e) => e.message) - - expect(errorMessage).toContain( - "Invalid request: Expected: '1, 2' for field 'id', but got: '3'" - ) - }) - - it("should show human readable error message for invalid union", async () => { - const errorMessage = await zodValidator( - z - .object({ - id: z.union([z.string(), z.number()]), - }) - .strict(), - { - id: true, - } - ).catch((e) => e.message) - - expect(errorMessage).toContain( - "Invalid request: Expected type: 'string, number' for field 'id', got: 'boolean'" - ) - }) - - it("should show human readable error message for missing required field", async () => { - const errorMessage = await zodValidator( - z - .object({ - id: z.union([z.string(), z.number()]), - }) - .strict(), - {} - ).catch((e) => e.message) - - expect(errorMessage).toContain("Invalid request: Field 'id' is required") - }) - - it("should apply strict by default", async () => { - const schema = z.object({ - id: z.string(), - }) - - const toValidate = { - id: "1", - name: "Tony Stark", - company: "Stark Industries", - } - - const errorMessage = await zodValidator(schema, toValidate).catch( - (e) => e.message - ) - - expect(errorMessage).toBe( - "Invalid request: Unrecognized fields: 'name, company'" - ) - }) -}) diff --git a/packages/medusa/src/api/utils/middlewares/common/apply-params-as-filters.ts b/packages/medusa/src/api/utils/middlewares/common/apply-params-as-filters.ts deleted file mode 100644 index e22005561e..0000000000 --- a/packages/medusa/src/api/utils/middlewares/common/apply-params-as-filters.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NextFunction } from "express" -import { MedusaRequest } from "../../../../types/routing" - -export function applyParamsAsFilters(mappings: { - [param: string]: string -}) { - return async (req: MedusaRequest, _, next: NextFunction) => { - for (const [param, paramValue] of Object.entries(req.params)) { - if (mappings[param]) { - req.filterableFields[mappings[param]] = paramValue - } - } - - return next() - } -} diff --git a/packages/medusa/src/api/utils/middlewares/common/clear-filters-by-key.ts b/packages/medusa/src/api/utils/middlewares/common/clear-filters-by-key.ts deleted file mode 100644 index 804e30d2a7..0000000000 --- a/packages/medusa/src/api/utils/middlewares/common/clear-filters-by-key.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NextFunction } from "express" -import { MedusaRequest } from "../../../../types/routing" - -export function clearFiltersByKey(keys: string[]) { - return async (req: MedusaRequest, _, next: NextFunction) => { - keys.forEach((key) => { - delete req.filterableFields[key] - }) - - return next() - } -} diff --git a/packages/medusa/src/api/utils/middlewares/common/ensure-pub-key-sales-channel-match.ts b/packages/medusa/src/api/utils/middlewares/common/ensure-pub-key-sales-channel-match.ts index 65aac0c83b..ac432d1418 100644 --- a/packages/medusa/src/api/utils/middlewares/common/ensure-pub-key-sales-channel-match.ts +++ b/packages/medusa/src/api/utils/middlewares/common/ensure-pub-key-sales-channel-match.ts @@ -1,5 +1,5 @@ import { NextFunction } from "express" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" import { StoreCreateCartType } from "../../../store/carts/validators" /** diff --git a/packages/medusa/src/api/utils/middlewares/common/index.ts b/packages/medusa/src/api/utils/middlewares/common/index.ts deleted file mode 100644 index 420f4ad32f..0000000000 --- a/packages/medusa/src/api/utils/middlewares/common/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./apply-default-filters" -export * from "./clear-filters-by-key" diff --git a/packages/medusa/src/api/utils/middlewares/common/maybe-attach-pub-key-scopes.ts b/packages/medusa/src/api/utils/middlewares/common/maybe-attach-pub-key-scopes.ts index 44671f1d04..522b5c61e8 100644 --- a/packages/medusa/src/api/utils/middlewares/common/maybe-attach-pub-key-scopes.ts +++ b/packages/medusa/src/api/utils/middlewares/common/maybe-attach-pub-key-scopes.ts @@ -4,7 +4,7 @@ import { remoteQueryObjectFromString, } from "@medusajs/framework/utils" import { NextFunction } from "express" -import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" /** * If a publishable key (PK) is passed in the header of the request, we attach diff --git a/packages/medusa/src/api/utils/middlewares/index.ts b/packages/medusa/src/api/utils/middlewares/index.ts index b8bf5d953e..0413143cb8 100644 --- a/packages/medusa/src/api/utils/middlewares/index.ts +++ b/packages/medusa/src/api/utils/middlewares/index.ts @@ -1,2 +1 @@ -export * from "./common" export * from "./products" diff --git a/packages/medusa/src/api/utils/middlewares/products/normalize-data-for-context.ts b/packages/medusa/src/api/utils/middlewares/products/normalize-data-for-context.ts index 35c37b26ea..693ed43b3a 100644 --- a/packages/medusa/src/api/utils/middlewares/products/normalize-data-for-context.ts +++ b/packages/medusa/src/api/utils/middlewares/products/normalize-data-for-context.ts @@ -1,7 +1,10 @@ import { MedusaError } from "@medusajs/framework/utils" import { NextFunction } from "express" -import { AuthenticatedMedusaRequest } from "../../../../types/routing" -import { refetchEntities, refetchEntity } from "../../refetch-entity" +import { + AuthenticatedMedusaRequest, + refetchEntities, + refetchEntity, +} from "@medusajs/framework/http" export function normalizeDataForContext() { return async (req: AuthenticatedMedusaRequest, _, next: NextFunction) => { diff --git a/packages/medusa/src/api/utils/middlewares/products/set-pricing-context.ts b/packages/medusa/src/api/utils/middlewares/products/set-pricing-context.ts index 501034c7f0..3048b4b204 100644 --- a/packages/medusa/src/api/utils/middlewares/products/set-pricing-context.ts +++ b/packages/medusa/src/api/utils/middlewares/products/set-pricing-context.ts @@ -1,8 +1,11 @@ import { MedusaPricingContext } from "@medusajs/framework/types" import { MedusaError } from "@medusajs/framework/utils" import { NextFunction } from "express" -import { AuthenticatedMedusaRequest } from "../../../../types/routing" -import { refetchEntities, refetchEntity } from "../../refetch-entity" +import { + AuthenticatedMedusaRequest, + refetchEntities, + refetchEntity, +} from "@medusajs/framework/http" export function setPricingContext() { return async (req: AuthenticatedMedusaRequest, _, next: NextFunction) => { diff --git a/packages/medusa/src/api/utils/middlewares/products/set-tax-context.ts b/packages/medusa/src/api/utils/middlewares/products/set-tax-context.ts index 80154c9622..90c4712876 100644 --- a/packages/medusa/src/api/utils/middlewares/products/set-tax-context.ts +++ b/packages/medusa/src/api/utils/middlewares/products/set-tax-context.ts @@ -3,8 +3,8 @@ import { NextFunction } from "express" import { AuthenticatedMedusaRequest, MedusaRequest, -} from "../../../../types/routing" -import { refetchEntity } from "../../refetch-entity" + refetchEntity, +} from "@medusajs/framework/http" import { MedusaError } from "@medusajs/framework/utils" import { RequestWithContext } from "../../../store/products/helpers" diff --git a/packages/medusa/src/api/utils/middlewares/products/variant-inventory-quantity.ts b/packages/medusa/src/api/utils/middlewares/products/variant-inventory-quantity.ts index f9cae4fb15..2e4adb9f35 100644 --- a/packages/medusa/src/api/utils/middlewares/products/variant-inventory-quantity.ts +++ b/packages/medusa/src/api/utils/middlewares/products/variant-inventory-quantity.ts @@ -3,7 +3,7 @@ import { LINKS, remoteQueryObjectFromString, } from "@medusajs/framework/utils" -import { MedusaRequest } from "../../../../types/routing" +import { MedusaRequest } from "@medusajs/framework/http" export async function getVariantInventoryItems({ req, diff --git a/packages/medusa/src/api/utils/unless-path.ts b/packages/medusa/src/api/utils/unless-path.ts deleted file mode 100644 index 7b8c779d84..0000000000 --- a/packages/medusa/src/api/utils/unless-path.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { MiddlewareFunction } from "@medusajs/framework/http" -import { NextFunction } from "express" -import { MedusaRequest, MedusaResponse } from "../../types/routing" - -// Due to how our route loader works, where we load all middlewares before routes, ambiguous routes end up having all middlewares on different routes executed before the route handler is. -// This function allows us to skip middlewares for particular routes, so we can temporarily solve this without completely breaking the route loader for everyone. -export const unlessPath = - (onPath: RegExp, middleware: MiddlewareFunction) => - (req: MedusaRequest, res: MedusaResponse, next: NextFunction) => { - if (onPath.test(req.path)) { - return next() - } else { - return middleware(req, res, next) - } - } diff --git a/packages/medusa/src/index.js b/packages/medusa/src/index.js deleted file mode 100644 index d25b391cb4..0000000000 --- a/packages/medusa/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -export * as Commands from "./commands" -export * from "./types/common" -export * from "./types/global" -export * from "./types/middlewares" -export * from "./types/routing" -export * from "./types/subscribers" -export * from "./utils" -export * from "./instrumentation" diff --git a/packages/medusa/src/index.ts b/packages/medusa/src/index.ts new file mode 100644 index 0000000000..b106750fc1 --- /dev/null +++ b/packages/medusa/src/index.ts @@ -0,0 +1,4 @@ +export * as Commands from "./commands" +export * from "./types" +export * from "./utils" +export * from "./instrumentation" diff --git a/packages/medusa/src/loaders/index.ts b/packages/medusa/src/loaders/index.ts index df7417dafb..c34a73d91e 100644 --- a/packages/medusa/src/loaders/index.ts +++ b/packages/medusa/src/loaders/index.ts @@ -5,8 +5,8 @@ import { } from "@medusajs/framework/types" import { ContainerRegistrationKeys, - promiseAll, GraphQLSchema, + promiseAll, } from "@medusajs/framework/utils" import { asValue } from "awilix" import { Express, NextFunction, Request, Response } from "express" diff --git a/packages/medusa/src/types/common.ts b/packages/medusa/src/types/common.ts deleted file mode 100644 index 7efe3e53ad..0000000000 --- a/packages/medusa/src/types/common.ts +++ /dev/null @@ -1,36 +0,0 @@ -export interface FindConfig { - select?: (keyof Entity)[] - skip?: number - take?: number - relations?: string[] - order?: { [K: string]: "ASC" | "DESC" } -} - -export type QueryConfig = { - /** - * Default fields and relations to return - */ - defaults?: (keyof TEntity | string)[] - /** - * @deprecated Use `defaults` instead - */ - defaultFields?: (keyof TEntity | string)[] - /** - * @deprecated Use `defaultFields` instead and the relations will be inferred - */ - defaultRelations?: string[] - /** - * Fields and relations that are allowed to be requested - */ - allowed?: string[] - /** - * @deprecated Use `allowed` instead - */ - allowedFields?: string[] - /** - * @deprecated Use `allowedFields` instead and the relations will be inferred - */ - allowedRelations?: string[] - defaultLimit?: number - isList?: boolean -} diff --git a/packages/medusa/src/types/global.ts b/packages/medusa/src/types/global.ts index b0f3dfb516..e94c518ac5 100644 --- a/packages/medusa/src/types/global.ts +++ b/packages/medusa/src/types/global.ts @@ -1,8 +1,8 @@ import { + FindConfig, MedusaContainer as coreMedusaContainer, RequestQueryFields, } from "@medusajs/framework/types" -import { FindConfig } from "./common" declare global { // eslint-disable-next-line @typescript-eslint/no-namespace diff --git a/packages/medusa/src/types/index.ts b/packages/medusa/src/types/index.ts new file mode 100644 index 0000000000..b676b3713d --- /dev/null +++ b/packages/medusa/src/types/index.ts @@ -0,0 +1,3 @@ +export * from "./global" +export * from "./middlewares" +export * from "./subscribers" diff --git a/packages/medusa/src/types/routing.ts b/packages/medusa/src/types/routing.ts deleted file mode 100644 index f9d4f1cf41..0000000000 --- a/packages/medusa/src/types/routing.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { ZodObject } from "zod" -import type { NextFunction, Request, Response } from "express" - -import { - MedusaContainer, - MedusaPricingContext, - RequestQueryFields, -} from "@medusajs/framework/types" -import { FindConfig } from "./common" - -// TODO this will be reqorked and move to the framework at a later point unless decided otherwise -export interface MedusaRequest - extends Request< - { - [key: string]: string - }, - any, - Body - > { - validatedBody: Body - validatedQuery: RequestQueryFields & Record - /** - * TODO: shouldn't this correspond to returnable fields instead of allowed fields? also it is used by the cleanResponseData util - */ - allowedProperties: string[] - /** - * An object containing the select, relation, skip, take and order to be used with medusa internal services - */ - listConfig: FindConfig - /** - * An object containing the select, relation to be used with medusa internal services - */ - retrieveConfig: FindConfig - /** - * An object containing fields and variables to be used with the remoteQuery - */ - remoteQueryConfig: { - fields: string[] - pagination: { order?: Record; skip?: number; take?: number } - } - /** - * An object containing the fields that are filterable e.g `{ id: Any }` - */ - filterableFields: Record - includes?: Record - /** - * An array of fields and relations that are allowed to be queried, this can be set by the - * consumer as part of a middleware and it will take precedence over the defaultAllowedFields - * @deprecated use `allowed` instead - */ - allowedFields?: string[] - /** - * An array of fields and relations that are allowed to be queried, this can be set by the - * consumer as part of a middleware and it will take precedence over the defaultAllowedFields set - * by the api - */ - allowed?: string[] - errors: string[] - scope: MedusaContainer - session?: any - rawBody?: any - requestId?: string - /** - * An object that carries the context that is used to calculate prices for variants - */ - pricingContext?: MedusaPricingContext - /** - * A generic context object that can be used across the request lifecycle - */ - context?: Record - - /** - * Custom validator to validate the `additional_data` property in - * requests that allows for additional_data - */ - additionalDataValidator?: ZodObject -} - -export interface AuthContext { - actor_id: string - actor_type: string - auth_identity_id: string - app_metadata: Record -} - -export interface AuthenticatedMedusaRequest - extends MedusaRequest { - auth_context: AuthContext -} - -export type MedusaResponse = Response - -export type MedusaNextFunction = NextFunction - -export type MedusaRequestHandler = ( - req: MedusaRequest, - res: MedusaResponse, - next: MedusaNextFunction -) => Promise | void diff --git a/packages/medusa/src/utils/__tests__/define-routes-config.spec.ts b/packages/medusa/src/utils/__tests__/define-routes-config.spec.ts index bf3e4d94fc..f94318c4f9 100644 --- a/packages/medusa/src/utils/__tests__/define-routes-config.spec.ts +++ b/packages/medusa/src/utils/__tests__/define-routes-config.spec.ts @@ -1,6 +1,6 @@ import zod from "zod" import { defineMiddlewares } from "../define-middlewares" -import { MedusaRequest, MedusaResponse } from "../../types/routing" +import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" describe("defineMiddlewares", function () { test("define custom middleware for a route", () => { diff --git a/packages/medusa/src/utils/api/index.ts b/packages/medusa/src/utils/api/index.ts deleted file mode 100644 index 6cb9b8e8e3..0000000000 --- a/packages/medusa/src/utils/api/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./http-compression" diff --git a/packages/medusa/src/utils/clean-response-data.ts b/packages/medusa/src/utils/clean-response-data.ts index e99d12d426..6f02f6f315 100644 --- a/packages/medusa/src/utils/clean-response-data.ts +++ b/packages/medusa/src/utils/clean-response-data.ts @@ -1,5 +1,4 @@ -import { pickDeep } from "@medusajs/framework/utils" -import { omitDeep } from "./omit-deep" +import { omitDeep, pickDeep } from "@medusajs/framework/utils" // TODO: once the legacy totals decoration will be removed. // We will be able to only compute the totals if one of the total fields is present diff --git a/packages/medusa/src/utils/index.ts b/packages/medusa/src/utils/index.ts index 6ddfc3036b..35b8ff48d5 100644 --- a/packages/medusa/src/utils/index.ts +++ b/packages/medusa/src/utils/index.ts @@ -1,6 +1,4 @@ export * from "./clean-response-data" export * from "./exception-formatter" export * from "./middlewares" -export * from "./omit-deep" export * from "./define-middlewares" -export * from "./remove-undefined-properties" diff --git a/packages/modules/api-key/src/migrations/.snapshot-medusa-api-key.json b/packages/modules/api-key/src/migrations/.snapshot-medusa-api-key.json index 285509c8b7..2ca3413268 100644 --- a/packages/modules/api-key/src/migrations/.snapshot-medusa-api-key.json +++ b/packages/modules/api-key/src/migrations/.snapshot-medusa-api-key.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -126,9 +124,7 @@ "indexes": [ { "keyName": "IDX_api_key_token_unique", - "columnNames": [ - "token" - ], + "columnNames": ["token"], "composite": false, "primary": false, "unique": false, @@ -136,9 +132,7 @@ }, { "keyName": "IDX_api_key_type", - "columnNames": [ - "type" - ], + "columnNames": ["type"], "composite": false, "primary": false, "unique": false, @@ -146,9 +140,7 @@ }, { "keyName": "api_key_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true diff --git a/packages/modules/api-key/src/migrations/Migration20240604080145.ts b/packages/modules/api-key/src/migrations/Migration20240604080145.ts index f4270b1384..452e0a0c9c 100644 --- a/packages/modules/api-key/src/migrations/Migration20240604080145.ts +++ b/packages/modules/api-key/src/migrations/Migration20240604080145.ts @@ -1,13 +1,15 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240604080145 extends Migration { - async up(): Promise { - this.addSql('alter table if exists "api_key" add column if not exists "updated_at" timestamptz not null default now();'); + this.addSql( + 'alter table if exists "api_key" add column if not exists "updated_at" timestamptz not null default now();' + ) } async down(): Promise { - this.addSql('alter table if exists "api_key" drop column if exists "updated_at";'); + this.addSql( + 'alter table if exists "api_key" drop column if exists "updated_at";' + ) } - } diff --git a/packages/modules/auth/integration-tests/__fixtures__/providers/default-provider.ts b/packages/modules/auth/integration-tests/__fixtures__/providers/default-provider.ts index 28548ea104..a181b2eead 100644 --- a/packages/modules/auth/integration-tests/__fixtures__/providers/default-provider.ts +++ b/packages/modules/auth/integration-tests/__fixtures__/providers/default-provider.ts @@ -1,8 +1,8 @@ import { - AuthIdentityDTO, - AuthIdentityProviderService, AuthenticationInput, AuthenticationResponse, + AuthIdentityDTO, + AuthIdentityProviderService, } from "@medusajs/framework/types" import { AbstractAuthModuleProvider, diff --git a/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts b/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts index d35f111eb6..123e79234c 100644 --- a/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts +++ b/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts @@ -1,7 +1,7 @@ import { IAuthModuleService } from "@medusajs/framework/types" import { Module, Modules } from "@medusajs/framework/utils" import { AuthModuleService } from "@services" -import { SuiteOptions, moduleIntegrationTestRunner } from "medusa-test-utils" +import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" import { resolve } from "path" let moduleOptions = { diff --git a/packages/modules/auth/src/loaders/providers.ts b/packages/modules/auth/src/loaders/providers.ts index 24af7af212..43526d54c2 100644 --- a/packages/modules/auth/src/loaders/providers.ts +++ b/packages/modules/auth/src/loaders/providers.ts @@ -1,9 +1,9 @@ import { LoaderOptions, - ModulesSdkTypes, ModuleProvider, + ModulesSdkTypes, } from "@medusajs/framework/types" -import { Lifetime, asFunction, asValue } from "awilix" +import { asFunction, asValue, Lifetime } from "awilix" import { moduleProviderLoader } from "@medusajs/framework/modules-sdk" import { AuthIdentifiersRegistrationName, diff --git a/packages/modules/auth/src/migrations/.snapshot-medusa-auth.json b/packages/modules/auth/src/migrations/.snapshot-medusa-auth.json index 9aec33a519..c0b46de6c5 100644 --- a/packages/modules/auth/src/migrations/.snapshot-medusa-auth.json +++ b/packages/modules/auth/src/migrations/.snapshot-medusa-auth.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -52,9 +50,7 @@ "indexes": [ { "keyName": "auth_identity_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -163,9 +159,7 @@ }, { "keyName": "provider_identity_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -175,13 +169,9 @@ "foreignKeys": { "provider_identity_auth_identity_id_foreign": { "constraintName": "provider_identity_auth_identity_id_foreign", - "columnNames": [ - "auth_identity_id" - ], + "columnNames": ["auth_identity_id"], "localTableName": "public.provider_identity", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.auth_identity", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/auth/src/models/auth-identity.ts b/packages/modules/auth/src/models/auth-identity.ts index 6488edb2bd..00c77483a9 100644 --- a/packages/modules/auth/src/models/auth-identity.ts +++ b/packages/modules/auth/src/models/auth-identity.ts @@ -2,8 +2,8 @@ import { BeforeCreate, Collection, Entity, - OnInit, OneToMany, + OnInit, PrimaryKey, Property, } from "@mikro-orm/core" diff --git a/packages/modules/auth/src/services/auth-provider.ts b/packages/modules/auth/src/services/auth-provider.ts index b231e7cb21..3c8e39f220 100644 --- a/packages/modules/auth/src/services/auth-provider.ts +++ b/packages/modules/auth/src/services/auth-provider.ts @@ -1,8 +1,8 @@ import { - AuthIdentityProviderService, - AuthTypes, AuthenticationInput, AuthenticationResponse, + AuthIdentityProviderService, + AuthTypes, } from "@medusajs/framework/types" import { MedusaError } from "@medusajs/framework/utils" import { AuthProviderRegistrationPrefix } from "@types" diff --git a/packages/modules/auth/src/types/index.ts b/packages/modules/auth/src/types/index.ts index f1b3063de7..27a7edea6a 100644 --- a/packages/modules/auth/src/types/index.ts +++ b/packages/modules/auth/src/types/index.ts @@ -1,6 +1,8 @@ -import { ModuleProviderExports } from "@medusajs/framework/types" -import { ModuleServiceInitializeOptions } from "@medusajs/framework/types" -import { Logger } from "@medusajs/framework/types" +import { + Logger, + ModuleProviderExports, + ModuleServiceInitializeOptions, +} from "@medusajs/framework/types" export type InitializeModuleInjectableDependencies = { logger?: Logger diff --git a/packages/modules/cache-inmemory/README.md b/packages/modules/cache-inmemory/README.md index 5a6f17d30d..28d48e623f 100644 --- a/packages/modules/cache-inmemory/README.md +++ b/packages/modules/cache-inmemory/README.md @@ -17,7 +17,9 @@ yarn add @medusajs/cache-inmemory ``` ### Note -Recommended for testing and development. For production, use Redis cache module. + +Recommended for testing and development. For production, use Redis cache module. ### Other caching modules + - [Medusa Cache Redis](../cache-redis/README.md) diff --git a/packages/modules/cache-redis/README.md b/packages/modules/cache-redis/README.md index 9c84a7163b..af9c2686ad 100644 --- a/packages/modules/cache-redis/README.md +++ b/packages/modules/cache-redis/README.md @@ -13,14 +13,15 @@ yarn add @medusajs/cache-redis ``` { ttl?: number // Time to keep data in cache (in seconds) - + redisUrl?: string // Redis instance connection string - + redisOptions?: RedisOptions // Redis client options - + namespace?: string // Prefix for event keys (the default is `medusa:`) } ``` ### Other caching modules + - [Medusa Cache In-Memory](../cache-inmemory/README.md) diff --git a/packages/modules/cart/src/migrations/.snapshot-medusa-cart.json b/packages/modules/cart/src/migrations/.snapshot-medusa-cart.json index 3b0ca191cb..a1b27ba076 100644 --- a/packages/modules/cart/src/migrations/.snapshot-medusa-cart.json +++ b/packages/modules/cart/src/migrations/.snapshot-medusa-cart.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -161,9 +159,7 @@ "indexes": [ { "keyName": "IDX_cart_address_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -171,9 +167,7 @@ }, { "keyName": "cart_address_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -302,27 +296,21 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "sales_channel_id" - ], + "columnNames": ["sales_channel_id"], "composite": false, "keyName": "IDX_cart_sales_channel_id", "primary": false, "unique": false }, { - "columnNames": [ - "currency_code" - ], + "columnNames": ["currency_code"], "composite": false, "keyName": "IDX_cart_curency_code", "primary": false, "unique": false }, { - "columnNames": [ - "billing_address_id" - ], + "columnNames": ["billing_address_id"], "composite": false, "keyName": "IDX_cart_billing_address_id", "primary": false, @@ -330,9 +318,7 @@ }, { "keyName": "IDX_cart_region_id", - "columnNames": [ - "region_id" - ], + "columnNames": ["region_id"], "composite": false, "primary": false, "unique": false, @@ -340,9 +326,7 @@ }, { "keyName": "IDX_cart_customer_id", - "columnNames": [ - "customer_id" - ], + "columnNames": ["customer_id"], "composite": false, "primary": false, "unique": false, @@ -350,9 +334,7 @@ }, { "keyName": "IDX_cart_sales_channel_id", - "columnNames": [ - "sales_channel_id" - ], + "columnNames": ["sales_channel_id"], "composite": false, "primary": false, "unique": false, @@ -360,9 +342,7 @@ }, { "keyName": "IDX_cart_shipping_address_id", - "columnNames": [ - "shipping_address_id" - ], + "columnNames": ["shipping_address_id"], "composite": false, "primary": false, "unique": false, @@ -370,9 +350,7 @@ }, { "keyName": "IDX_cart_billing_address_id", - "columnNames": [ - "billing_address_id" - ], + "columnNames": ["billing_address_id"], "composite": false, "primary": false, "unique": false, @@ -380,9 +358,7 @@ }, { "keyName": "IDX_cart_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -390,9 +366,7 @@ }, { "keyName": "cart_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -402,26 +376,18 @@ "foreignKeys": { "cart_shipping_address_id_foreign": { "constraintName": "cart_shipping_address_id_foreign", - "columnNames": [ - "shipping_address_id" - ], + "columnNames": ["shipping_address_id"], "localTableName": "public.cart", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.cart_address", "deleteRule": "set null", "updateRule": "cascade" }, "cart_billing_address_id_foreign": { "constraintName": "cart_billing_address_id_foreign", - "columnNames": [ - "billing_address_id" - ], + "columnNames": ["billing_address_id"], "localTableName": "public.cart", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.cart_address", "deleteRule": "set null", "updateRule": "cascade" @@ -705,9 +671,7 @@ "indexes": [ { "keyName": "IDX_line_item_cart_id", - "columnNames": [ - "cart_id" - ], + "columnNames": ["cart_id"], "composite": false, "primary": false, "unique": false, @@ -715,9 +679,7 @@ }, { "keyName": "IDX_line_item_variant_id", - "columnNames": [ - "variant_id" - ], + "columnNames": ["variant_id"], "composite": false, "primary": false, "unique": false, @@ -725,9 +687,7 @@ }, { "keyName": "IDX_line_item_product_id", - "columnNames": [ - "product_id" - ], + "columnNames": ["product_id"], "composite": false, "primary": false, "unique": false, @@ -735,9 +695,7 @@ }, { "keyName": "IDX_cart_line_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -745,9 +703,7 @@ }, { "keyName": "cart_line_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -757,13 +713,9 @@ "foreignKeys": { "cart_line_item_cart_id_foreign": { "constraintName": "cart_line_item_cart_id_foreign", - "columnNames": [ - "cart_id" - ], + "columnNames": ["cart_id"], "localTableName": "public.cart_line_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.cart", "updateRule": "cascade" } @@ -890,9 +842,7 @@ "indexes": [ { "keyName": "IDX_adjustment_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -900,9 +850,7 @@ }, { "keyName": "IDX_line_item_adjustment_promotion_id", - "columnNames": [ - "promotion_id" - ], + "columnNames": ["promotion_id"], "composite": false, "primary": false, "unique": false, @@ -910,9 +858,7 @@ }, { "keyName": "IDX_cart_line_item_adjustment_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -920,9 +866,7 @@ }, { "keyName": "cart_line_item_adjustment_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1049,9 +993,7 @@ "indexes": [ { "keyName": "IDX_tax_line_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -1059,9 +1001,7 @@ }, { "keyName": "IDX_line_item_tax_line_tax_rate_id", - "columnNames": [ - "tax_rate_id" - ], + "columnNames": ["tax_rate_id"], "composite": false, "primary": false, "unique": false, @@ -1069,9 +1009,7 @@ }, { "keyName": "IDX_cart_line_item_tax_line_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1079,9 +1017,7 @@ }, { "keyName": "cart_line_item_tax_line_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1221,9 +1157,7 @@ "indexes": [ { "keyName": "IDX_shipping_method_cart_id", - "columnNames": [ - "cart_id" - ], + "columnNames": ["cart_id"], "composite": false, "primary": false, "unique": false, @@ -1231,9 +1165,7 @@ }, { "keyName": "IDX_shipping_method_option_id", - "columnNames": [ - "shipping_option_id" - ], + "columnNames": ["shipping_option_id"], "composite": false, "primary": false, "unique": false, @@ -1241,9 +1173,7 @@ }, { "keyName": "IDX_cart_shipping_method_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1251,9 +1181,7 @@ }, { "keyName": "cart_shipping_method_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1269,13 +1197,9 @@ "foreignKeys": { "cart_shipping_method_cart_id_foreign": { "constraintName": "cart_shipping_method_cart_id_foreign", - "columnNames": [ - "cart_id" - ], + "columnNames": ["cart_id"], "localTableName": "public.cart_shipping_method", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.cart", "updateRule": "cascade" } @@ -1402,9 +1326,7 @@ "indexes": [ { "keyName": "IDX_adjustment_shipping_method_id", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "composite": false, "primary": false, "unique": false, @@ -1412,9 +1334,7 @@ }, { "keyName": "IDX_shipping_method_adjustment_promotion_id", - "columnNames": [ - "promotion_id" - ], + "columnNames": ["promotion_id"], "composite": false, "primary": false, "unique": false, @@ -1422,9 +1342,7 @@ }, { "keyName": "IDX_cart_shipping_method_adjustment_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1432,9 +1350,7 @@ }, { "keyName": "cart_shipping_method_adjustment_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1555,9 +1471,7 @@ "indexes": [ { "keyName": "IDX_tax_line_shipping_method_id", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "composite": false, "primary": false, "unique": false, @@ -1565,9 +1479,7 @@ }, { "keyName": "IDX_shipping_method_tax_line_tax_rate_id", - "columnNames": [ - "tax_rate_id" - ], + "columnNames": ["tax_rate_id"], "composite": false, "primary": false, "unique": false, @@ -1575,9 +1487,7 @@ }, { "keyName": "IDX_cart_shipping_method_tax_line_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1585,9 +1495,7 @@ }, { "keyName": "cart_shipping_method_tax_line_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1597,4 +1505,4 @@ "foreignKeys": {} } ] -} \ No newline at end of file +} diff --git a/packages/modules/cart/src/models/address.ts b/packages/modules/cart/src/models/address.ts index 07b99fdb47..270ba6dbf3 100644 --- a/packages/modules/cart/src/models/address.ts +++ b/packages/modules/cart/src/models/address.ts @@ -1,7 +1,7 @@ import { DAL } from "@medusajs/framework/types" import { - DALUtils, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, } from "@medusajs/framework/utils" import { diff --git a/packages/modules/cart/src/models/cart.ts b/packages/modules/cart/src/models/cart.ts index 09762a073f..9df5ba7296 100644 --- a/packages/modules/cart/src/models/cart.ts +++ b/packages/modules/cart/src/models/cart.ts @@ -1,7 +1,7 @@ import { DAL } from "@medusajs/framework/types" import { - DALUtils, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, } from "@medusajs/framework/utils" import { @@ -11,8 +11,8 @@ import { Entity, Filter, ManyToOne, - OnInit, OneToMany, + OnInit, OptionalProps, PrimaryKey, Property, diff --git a/packages/modules/cart/src/models/index.ts b/packages/modules/cart/src/models/index.ts index 7f5c45b194..62897db827 100644 --- a/packages/modules/cart/src/models/index.ts +++ b/packages/modules/cart/src/models/index.ts @@ -6,4 +6,3 @@ export { default as LineItemTaxLine } from "./line-item-tax-line" export { default as ShippingMethod } from "./shipping-method" export { default as ShippingMethodAdjustment } from "./shipping-method-adjustment" export { default as ShippingMethodTaxLine } from "./shipping-method-tax-line" - diff --git a/packages/modules/cart/src/models/line-item-adjustment.ts b/packages/modules/cart/src/models/line-item-adjustment.ts index a96426d615..f0c816d67d 100644 --- a/packages/modules/cart/src/models/line-item-adjustment.ts +++ b/packages/modules/cart/src/models/line-item-adjustment.ts @@ -1,6 +1,6 @@ import { - DALUtils, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, } from "@medusajs/framework/utils" import { diff --git a/packages/modules/cart/src/models/line-item-tax-line.ts b/packages/modules/cart/src/models/line-item-tax-line.ts index d857078826..4a773c07c9 100644 --- a/packages/modules/cart/src/models/line-item-tax-line.ts +++ b/packages/modules/cart/src/models/line-item-tax-line.ts @@ -1,6 +1,6 @@ import { - DALUtils, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, } from "@medusajs/framework/utils" import { diff --git a/packages/modules/cart/src/models/line-item.ts b/packages/modules/cart/src/models/line-item.ts index bffabc97d0..5165632000 100644 --- a/packages/modules/cart/src/models/line-item.ts +++ b/packages/modules/cart/src/models/line-item.ts @@ -1,10 +1,10 @@ import { BigNumberRawValue, DAL } from "@medusajs/framework/types" import { BigNumber, - DALUtils, - MikroOrmBigNumberProperty, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, + MikroOrmBigNumberProperty, } from "@medusajs/framework/utils" import { BeforeCreate, @@ -13,8 +13,8 @@ import { Entity, Filter, ManyToOne, - OnInit, OneToMany, + OnInit, OptionalProps, PrimaryKey, Property, diff --git a/packages/modules/cart/src/models/shipping-method-adjustment.ts b/packages/modules/cart/src/models/shipping-method-adjustment.ts index 22c7a3ce91..8e9702741d 100644 --- a/packages/modules/cart/src/models/shipping-method-adjustment.ts +++ b/packages/modules/cart/src/models/shipping-method-adjustment.ts @@ -1,6 +1,6 @@ import { - DALUtils, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, } from "@medusajs/framework/utils" import { diff --git a/packages/modules/cart/src/models/shipping-method-tax-line.ts b/packages/modules/cart/src/models/shipping-method-tax-line.ts index d24db596fc..697dd156b7 100644 --- a/packages/modules/cart/src/models/shipping-method-tax-line.ts +++ b/packages/modules/cart/src/models/shipping-method-tax-line.ts @@ -1,6 +1,6 @@ import { - DALUtils, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, } from "@medusajs/framework/utils" import { diff --git a/packages/modules/cart/src/models/shipping-method.ts b/packages/modules/cart/src/models/shipping-method.ts index 0bee5d79f9..6da5721656 100644 --- a/packages/modules/cart/src/models/shipping-method.ts +++ b/packages/modules/cart/src/models/shipping-method.ts @@ -1,10 +1,10 @@ import { BigNumberRawValue, DAL } from "@medusajs/framework/types" import { BigNumber, - DALUtils, - MikroOrmBigNumberProperty, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, + MikroOrmBigNumberProperty, } from "@medusajs/framework/utils" import { BeforeCreate, @@ -14,8 +14,8 @@ import { Entity, Filter, ManyToOne, - OnInit, OneToMany, + OnInit, OptionalProps, PrimaryKey, Property, diff --git a/packages/modules/cart/src/services/index.ts b/packages/modules/cart/src/services/index.ts index 440fec6e50..2ed2053ffc 100644 --- a/packages/modules/cart/src/services/index.ts +++ b/packages/modules/cart/src/services/index.ts @@ -1 +1 @@ -export { default as CartModuleService } from "./cart-module"; +export { default as CartModuleService } from "./cart-module" diff --git a/packages/modules/customer/src/migrations/.snapshot-medusa-customer.json b/packages/modules/customer/src/migrations/.snapshot-medusa-customer.json index f906791ac2..e5c88e7365 100644 --- a/packages/modules/customer/src/migrations/.snapshot-medusa-customer.json +++ b/packages/modules/customer/src/migrations/.snapshot-medusa-customer.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -134,9 +132,7 @@ }, { "keyName": "customer_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -320,9 +316,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "customer_id" - ], + "columnNames": ["customer_id"], "composite": false, "keyName": "IDX_customer_address_customer_id", "primary": false, @@ -346,9 +340,7 @@ }, { "keyName": "customer_address_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -358,13 +350,9 @@ "foreignKeys": { "customer_address_customer_id_foreign": { "constraintName": "customer_address_customer_id_foreign", - "columnNames": [ - "customer_id" - ], + "columnNames": ["customer_id"], "localTableName": "public.customer_address", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.customer", "deleteRule": "cascade", "updateRule": "cascade" @@ -447,9 +435,7 @@ "indexes": [ { "keyName": "IDX_customer_group_name_unique", - "columnNames": [ - "name" - ], + "columnNames": ["name"], "composite": false, "primary": false, "unique": false, @@ -457,9 +443,7 @@ }, { "keyName": "customer_group_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -542,18 +526,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "customer_group_id" - ], + "columnNames": ["customer_group_id"], "composite": false, "keyName": "IDX_customer_group_customer_group_id", "primary": false, "unique": false }, { - "columnNames": [ - "customer_id" - ], + "columnNames": ["customer_id"], "composite": false, "keyName": "IDX_customer_group_customer_customer_id", "primary": false, @@ -561,9 +541,7 @@ }, { "keyName": "customer_group_customer_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -573,25 +551,17 @@ "foreignKeys": { "customer_group_customer_customer_group_id_foreign": { "constraintName": "customer_group_customer_customer_group_id_foreign", - "columnNames": [ - "customer_group_id" - ], + "columnNames": ["customer_group_id"], "localTableName": "public.customer_group_customer", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.customer_group", "deleteRule": "cascade" }, "customer_group_customer_customer_id_foreign": { "constraintName": "customer_group_customer_customer_id_foreign", - "columnNames": [ - "customer_id" - ], + "columnNames": ["customer_id"], "localTableName": "public.customer_group_customer", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.customer", "deleteRule": "cascade" } diff --git a/packages/modules/customer/src/migrations/Migration20240524123112.ts b/packages/modules/customer/src/migrations/Migration20240524123112.ts index 199ba6c529..39701451eb 100644 --- a/packages/modules/customer/src/migrations/Migration20240524123112.ts +++ b/packages/modules/customer/src/migrations/Migration20240524123112.ts @@ -1,21 +1,39 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240524123112 extends Migration { async up(): Promise { - this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_email_has_account_unique" ON "customer" (email, has_account) WHERE deleted_at IS NULL;'); + this.addSql( + 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_email_has_account_unique" ON "customer" (email, has_account) WHERE deleted_at IS NULL;' + ) - this.addSql('drop index if exists "IDX_customer_address_unqiue_customer_billing";'); - this.addSql('drop index if exists "IDX_customer_address_unqiue_customer_shipping";'); - this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_billing" ON "customer_address" (customer_id) WHERE "is_default_billing" = true;'); - this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_shipping" ON "customer_address" (customer_id) WHERE "is_default_shipping" = true;'); + this.addSql( + 'drop index if exists "IDX_customer_address_unqiue_customer_billing";' + ) + this.addSql( + 'drop index if exists "IDX_customer_address_unqiue_customer_shipping";' + ) + this.addSql( + 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_billing" ON "customer_address" (customer_id) WHERE "is_default_billing" = true;' + ) + this.addSql( + 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_shipping" ON "customer_address" (customer_id) WHERE "is_default_shipping" = true;' + ) } async down(): Promise { - this.addSql('drop index if exists "IDX_customer_email_has_account_unique";'); + this.addSql('drop index if exists "IDX_customer_email_has_account_unique";') - this.addSql('drop index if exists "IDX_customer_address_unique_customer_billing";'); - this.addSql('drop index if exists "IDX_customer_address_unique_customer_shipping";'); - this.addSql('create unique index if not exists "IDX_customer_address_unqiue_customer_billing" on "customer_address" ("customer_id") where "is_default_billing" = true;'); - this.addSql('create unique index if not exists "IDX_customer_address_unique_customer_shipping" on "customer_address" ("customer_id") where "is_default_shipping" = true;'); + this.addSql( + 'drop index if exists "IDX_customer_address_unique_customer_billing";' + ) + this.addSql( + 'drop index if exists "IDX_customer_address_unique_customer_shipping";' + ) + this.addSql( + 'create unique index if not exists "IDX_customer_address_unqiue_customer_billing" on "customer_address" ("customer_id") where "is_default_billing" = true;' + ) + this.addSql( + 'create unique index if not exists "IDX_customer_address_unique_customer_shipping" on "customer_address" ("customer_id") where "is_default_shipping" = true;' + ) } } diff --git a/packages/modules/event-bus-local/README.md b/packages/modules/event-bus-local/README.md index 1c625dcf8d..39517465e3 100644 --- a/packages/modules/event-bus-local/README.md +++ b/packages/modules/event-bus-local/README.md @@ -38,7 +38,7 @@ An open source composable commerce engine built for developers. Local Event Bus module for Medusa. When installed, the events system of Medusa is powered by the Node EventEmitter. This module installed by default in new (> v1.8.0) Medusa projects. -The Node EventEmitter is limited to a single process environment. We generally recommend using the `@medusajs/event-bus-redis` module in a production environment. +The Node EventEmitter is limited to a single process environment. We generally recommend using the `@medusajs/event-bus-redis` module in a production environment. ## Getting started @@ -48,7 +48,7 @@ Install the module: yarn add @medusajs/event-bus-local ``` -You don't need to add the module to your project configuration as it is the default one. Medusa will try to use it, if no other event buses are installed. +You don't need to add the module to your project configuration as it is the default one. Medusa will try to use it, if no other event buses are installed. ```js module.exports = { @@ -60,4 +60,4 @@ module.exports = { ## Configuration -The module comes with no configuration options. \ No newline at end of file +The module comes with no configuration options. diff --git a/packages/modules/event-bus-redis/README.md b/packages/modules/event-bus-redis/README.md index 2e4406683a..d383dcc1c8 100644 --- a/packages/modules/event-bus-redis/README.md +++ b/packages/modules/event-bus-redis/README.md @@ -55,7 +55,7 @@ module.exports = { { resolve: "@medusajs/event-bus-redis", options: { - redisUrl: "redis:.." + redisUrl: "redis:..", }, }, ], @@ -67,13 +67,13 @@ module.exports = { The module can be configured with the following options: -| Option | Type | Description | Default | -| --------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -| `redisUrl` | `string` | URL of the Redis instance to connect to. | `events-worker` | -| `queueName` | `string?` | Name of the BullMQ queue. | `events-queue` | -| `queueOptions` | `object?` | Options for the BullMQ queue. See BullMQ's [documentation](https://api.docs.bullmq.io/interfaces/QueueOptions.html). | `{}` | -| `redisOptions` | `object?` | Options for the Redis instance. See `io-redis`'s [documentation](https://luin.github.io/ioredis/index.html#RedisOptions) | `{}` | +| Option | Type | Description | Default | +| -------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ | --------------- | +| `redisUrl` | `string` | URL of the Redis instance to connect to. | `events-worker` | +| `queueName` | `string?` | Name of the BullMQ queue. | `events-queue` | +| `queueOptions` | `object?` | Options for the BullMQ queue. See BullMQ's [documentation](https://api.docs.bullmq.io/interfaces/QueueOptions.html). | `{}` | +| `redisOptions` | `object?` | Options for the Redis instance. See `io-redis`'s [documentation](https://luin.github.io/ioredis/index.html#RedisOptions) | `{}` | **Info**: See how the options are applied in the [RedisEventBusService](https://github.com/medusajs/medusa/blob/0c1d1d590463fa30b083c4312293348bdf6596be/packages/event-bus-redis/src/services/event-bus-redis.ts#L52) and [loader](https://github.com/medusajs/medusa/blob/0c1d1d590463fa30b083c4312293348bdf6596be/packages/event-bus-redis/src/loaders/index.ts). -If you do not provide a `redisUrl` in the module options, the server will fail to start. \ No newline at end of file +If you do not provide a `redisUrl` in the module options, the server will fail to start. diff --git a/packages/modules/file/src/loaders/providers.ts b/packages/modules/file/src/loaders/providers.ts index 630d839d39..502fab79fc 100644 --- a/packages/modules/file/src/loaders/providers.ts +++ b/packages/modules/file/src/loaders/providers.ts @@ -9,7 +9,7 @@ import { FileProviderIdentifierRegistrationName, FileProviderRegistrationPrefix, } from "@types" -import { Lifetime, asFunction, asValue } from "awilix" +import { asFunction, asValue, Lifetime } from "awilix" const registrationFn = async (klass, container, pluginOptions) => { const key = FileProviderService.getRegistrationIdentifier( diff --git a/packages/modules/fulfillment/src/migrations/.snapshot-medusa-fulfillment.json b/packages/modules/fulfillment/src/migrations/.snapshot-medusa-fulfillment.json index d3e275ed93..aaffec751b 100644 --- a/packages/modules/fulfillment/src/migrations/.snapshot-medusa-fulfillment.json +++ b/packages/modules/fulfillment/src/migrations/.snapshot-medusa-fulfillment.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -152,9 +150,7 @@ "indexes": [ { "keyName": "IDX_fulfillment_address_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -162,9 +158,7 @@ }, { "keyName": "fulfillment_address_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -200,9 +194,7 @@ "indexes": [ { "keyName": "fulfillment_provider_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -287,9 +279,7 @@ "indexes": [ { "keyName": "IDX_fulfillment_set_name_unique", - "columnNames": [ - "name" - ], + "columnNames": ["name"], "composite": false, "primary": false, "unique": false, @@ -297,9 +287,7 @@ }, { "keyName": "IDX_fulfillment_set_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -307,9 +295,7 @@ }, { "keyName": "fulfillment_set_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -394,9 +380,7 @@ "indexes": [ { "keyName": "IDX_service_zone_name_unique", - "columnNames": [ - "name" - ], + "columnNames": ["name"], "composite": false, "primary": false, "unique": false, @@ -404,9 +388,7 @@ }, { "keyName": "IDX_service_zone_fulfillment_set_id", - "columnNames": [ - "fulfillment_set_id" - ], + "columnNames": ["fulfillment_set_id"], "composite": false, "primary": false, "unique": false, @@ -414,9 +396,7 @@ }, { "keyName": "IDX_service_zone_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -424,9 +404,7 @@ }, { "keyName": "service_zone_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -436,13 +414,9 @@ "foreignKeys": { "service_zone_fulfillment_set_id_foreign": { "constraintName": "service_zone_fulfillment_set_id_foreign", - "columnNames": [ - "fulfillment_set_id" - ], + "columnNames": ["fulfillment_set_id"], "localTableName": "public.service_zone", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.fulfillment_set", "deleteRule": "cascade", "updateRule": "cascade" @@ -468,12 +442,7 @@ "primary": false, "nullable": false, "default": "'country'", - "enumItems": [ - "country", - "province", - "city", - "zip" - ], + "enumItems": ["country", "province", "city", "zip"], "mappedType": "enum" }, "country_code": { @@ -568,9 +537,7 @@ "indexes": [ { "keyName": "IDX_geo_zone_country_code", - "columnNames": [ - "country_code" - ], + "columnNames": ["country_code"], "composite": false, "primary": false, "unique": false, @@ -578,9 +545,7 @@ }, { "keyName": "IDX_geo_zone_province_code", - "columnNames": [ - "province_code" - ], + "columnNames": ["province_code"], "composite": false, "primary": false, "unique": false, @@ -588,9 +553,7 @@ }, { "keyName": "IDX_geo_zone_city", - "columnNames": [ - "city" - ], + "columnNames": ["city"], "composite": false, "primary": false, "unique": false, @@ -598,9 +561,7 @@ }, { "keyName": "IDX_geo_zone_service_zone_id", - "columnNames": [ - "service_zone_id" - ], + "columnNames": ["service_zone_id"], "composite": false, "primary": false, "unique": false, @@ -608,9 +569,7 @@ }, { "keyName": "IDX_geo_zone_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -618,9 +577,7 @@ }, { "keyName": "geo_zone_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -630,13 +587,9 @@ "foreignKeys": { "geo_zone_service_zone_id_foreign": { "constraintName": "geo_zone_service_zone_id_foreign", - "columnNames": [ - "service_zone_id" - ], + "columnNames": ["service_zone_id"], "localTableName": "public.geo_zone", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.service_zone", "deleteRule": "cascade", "updateRule": "cascade" @@ -719,9 +672,7 @@ "indexes": [ { "keyName": "IDX_shipping_option_type_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -729,9 +680,7 @@ }, { "keyName": "shipping_option_type_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -816,9 +765,7 @@ "indexes": [ { "keyName": "IDX_shipping_profile_name_unique", - "columnNames": [ - "name" - ], + "columnNames": ["name"], "composite": false, "primary": false, "unique": false, @@ -826,9 +773,7 @@ }, { "keyName": "IDX_shipping_profile_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -836,9 +781,7 @@ }, { "keyName": "shipping_profile_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -875,10 +818,7 @@ "primary": false, "nullable": false, "default": "'flat'", - "enumItems": [ - "calculated", - "flat" - ], + "enumItems": ["calculated", "flat"], "mappedType": "enum" }, "service_zone_id": { @@ -972,9 +912,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "shipping_option_type_id" - ], + "columnNames": ["shipping_option_type_id"], "composite": false, "keyName": "shipping_option_shipping_option_type_id_unique", "primary": false, @@ -982,9 +920,7 @@ }, { "keyName": "IDX_shipping_option_service_zone_id", - "columnNames": [ - "service_zone_id" - ], + "columnNames": ["service_zone_id"], "composite": false, "primary": false, "unique": false, @@ -992,9 +928,7 @@ }, { "keyName": "IDX_shipping_option_shipping_profile_id", - "columnNames": [ - "shipping_profile_id" - ], + "columnNames": ["shipping_profile_id"], "composite": false, "primary": false, "unique": false, @@ -1002,9 +936,7 @@ }, { "keyName": "IDX_shipping_option_provider_id", - "columnNames": [ - "provider_id" - ], + "columnNames": ["provider_id"], "composite": false, "primary": false, "unique": false, @@ -1012,9 +944,7 @@ }, { "keyName": "IDX_shipping_option_shipping_option_type_id", - "columnNames": [ - "shipping_option_type_id" - ], + "columnNames": ["shipping_option_type_id"], "composite": false, "primary": false, "unique": false, @@ -1022,9 +952,7 @@ }, { "keyName": "IDX_shipping_option_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1032,9 +960,7 @@ }, { "keyName": "shipping_option_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1044,52 +970,36 @@ "foreignKeys": { "shipping_option_service_zone_id_foreign": { "constraintName": "shipping_option_service_zone_id_foreign", - "columnNames": [ - "service_zone_id" - ], + "columnNames": ["service_zone_id"], "localTableName": "public.shipping_option", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.service_zone", "deleteRule": "cascade", "updateRule": "cascade" }, "shipping_option_shipping_profile_id_foreign": { "constraintName": "shipping_option_shipping_profile_id_foreign", - "columnNames": [ - "shipping_profile_id" - ], + "columnNames": ["shipping_profile_id"], "localTableName": "public.shipping_option", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.shipping_profile", "deleteRule": "set null", "updateRule": "cascade" }, "shipping_option_provider_id_foreign": { "constraintName": "shipping_option_provider_id_foreign", - "columnNames": [ - "provider_id" - ], + "columnNames": ["provider_id"], "localTableName": "public.shipping_option", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.fulfillment_provider", "deleteRule": "set null", "updateRule": "cascade" }, "shipping_option_shipping_option_type_id_foreign": { "constraintName": "shipping_option_shipping_option_type_id_foreign", - "columnNames": [ - "shipping_option_type_id" - ], + "columnNames": ["shipping_option_type_id"], "localTableName": "public.shipping_option", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.shipping_option_type", "deleteRule": "cascade", "updateRule": "cascade" @@ -1123,16 +1033,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "in", - "eq", - "ne", - "gt", - "gte", - "lt", - "lte", - "nin" - ], + "enumItems": ["in", "eq", "ne", "gt", "gte", "lt", "lte", "nin"], "mappedType": "enum" }, "value": { @@ -1191,9 +1092,7 @@ "indexes": [ { "keyName": "IDX_shipping_option_rule_shipping_option_id", - "columnNames": [ - "shipping_option_id" - ], + "columnNames": ["shipping_option_id"], "composite": false, "primary": false, "unique": false, @@ -1201,9 +1100,7 @@ }, { "keyName": "IDX_shipping_option_rule_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1211,9 +1108,7 @@ }, { "keyName": "shipping_option_rule_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1223,13 +1118,9 @@ "foreignKeys": { "shipping_option_rule_shipping_option_id_foreign": { "constraintName": "shipping_option_rule_shipping_option_id_foreign", - "columnNames": [ - "shipping_option_id" - ], + "columnNames": ["shipping_option_id"], "localTableName": "public.shipping_option_rule", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.shipping_option", "deleteRule": "cascade", "updateRule": "cascade" @@ -1406,9 +1297,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "delivery_address_id" - ], + "columnNames": ["delivery_address_id"], "composite": false, "keyName": "fulfillment_delivery_address_id_unique", "primary": false, @@ -1416,9 +1305,7 @@ }, { "keyName": "IDX_fulfillment_location_id", - "columnNames": [ - "location_id" - ], + "columnNames": ["location_id"], "composite": false, "primary": false, "unique": false, @@ -1426,9 +1313,7 @@ }, { "keyName": "IDX_fulfillment_provider_id", - "columnNames": [ - "provider_id" - ], + "columnNames": ["provider_id"], "composite": false, "primary": false, "unique": false, @@ -1436,9 +1321,7 @@ }, { "keyName": "IDX_fulfillment_shipping_option_id", - "columnNames": [ - "shipping_option_id" - ], + "columnNames": ["shipping_option_id"], "composite": false, "primary": false, "unique": false, @@ -1446,9 +1329,7 @@ }, { "keyName": "IDX_fulfillment_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1456,9 +1337,7 @@ }, { "keyName": "fulfillment_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1468,39 +1347,27 @@ "foreignKeys": { "fulfillment_provider_id_foreign": { "constraintName": "fulfillment_provider_id_foreign", - "columnNames": [ - "provider_id" - ], + "columnNames": ["provider_id"], "localTableName": "public.fulfillment", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.fulfillment_provider", "deleteRule": "set null", "updateRule": "cascade" }, "fulfillment_shipping_option_id_foreign": { "constraintName": "fulfillment_shipping_option_id_foreign", - "columnNames": [ - "shipping_option_id" - ], + "columnNames": ["shipping_option_id"], "localTableName": "public.fulfillment", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.shipping_option", "deleteRule": "set null", "updateRule": "cascade" }, "fulfillment_delivery_address_id_foreign": { "constraintName": "fulfillment_delivery_address_id_foreign", - "columnNames": [ - "delivery_address_id" - ], + "columnNames": ["delivery_address_id"], "localTableName": "public.fulfillment", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.fulfillment_address", "deleteRule": "cascade", "updateRule": "cascade" @@ -1592,9 +1459,7 @@ "indexes": [ { "keyName": "IDX_fulfillment_label_fulfillment_id", - "columnNames": [ - "fulfillment_id" - ], + "columnNames": ["fulfillment_id"], "composite": false, "primary": false, "unique": false, @@ -1602,9 +1467,7 @@ }, { "keyName": "IDX_fulfillment_label_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1612,9 +1475,7 @@ }, { "keyName": "fulfillment_label_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1624,13 +1485,9 @@ "foreignKeys": { "fulfillment_label_fulfillment_id_foreign": { "constraintName": "fulfillment_label_fulfillment_id_foreign", - "columnNames": [ - "fulfillment_id" - ], + "columnNames": ["fulfillment_id"], "localTableName": "public.fulfillment_label", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.fulfillment", "deleteRule": "cascade", "updateRule": "cascade" @@ -1758,9 +1615,7 @@ "indexes": [ { "keyName": "IDX_fulfillment_item_line_item_id", - "columnNames": [ - "line_item_id" - ], + "columnNames": ["line_item_id"], "composite": false, "primary": false, "unique": false, @@ -1768,9 +1623,7 @@ }, { "keyName": "IDX_fulfillment_item_inventory_item_id", - "columnNames": [ - "inventory_item_id" - ], + "columnNames": ["inventory_item_id"], "composite": false, "primary": false, "unique": false, @@ -1778,9 +1631,7 @@ }, { "keyName": "IDX_fulfillment_item_fulfillment_id", - "columnNames": [ - "fulfillment_id" - ], + "columnNames": ["fulfillment_id"], "composite": false, "primary": false, "unique": false, @@ -1788,9 +1639,7 @@ }, { "keyName": "IDX_fulfillment_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1798,9 +1647,7 @@ }, { "keyName": "fulfillment_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1810,13 +1657,9 @@ "foreignKeys": { "fulfillment_item_fulfillment_id_foreign": { "constraintName": "fulfillment_item_fulfillment_id_foreign", - "columnNames": [ - "fulfillment_id" - ], + "columnNames": ["fulfillment_id"], "localTableName": "public.fulfillment_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.fulfillment", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/inventory-next/src/migrations/.snapshot-medusa-inventory.json b/packages/modules/inventory-next/src/migrations/.snapshot-medusa-inventory.json index 8034b02003..f59b0c2ac3 100644 --- a/packages/modules/inventory-next/src/migrations/.snapshot-medusa-inventory.json +++ b/packages/modules/inventory-next/src/migrations/.snapshot-medusa-inventory.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -180,9 +178,7 @@ "indexes": [ { "keyName": "IDX_inventory_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -190,9 +186,7 @@ }, { "keyName": "IDX_inventory_item_sku_unique", - "columnNames": [ - "sku" - ], + "columnNames": ["sku"], "composite": false, "primary": false, "unique": false, @@ -200,9 +194,7 @@ }, { "keyName": "inventory_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -317,9 +309,7 @@ "indexes": [ { "keyName": "IDX_inventory_level_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -327,9 +317,7 @@ }, { "keyName": "IDX_inventory_level_inventory_item_id", - "columnNames": [ - "inventory_item_id" - ], + "columnNames": ["inventory_item_id"], "composite": false, "primary": false, "unique": false, @@ -337,9 +325,7 @@ }, { "keyName": "IDX_inventory_level_location_id", - "columnNames": [ - "location_id" - ], + "columnNames": ["location_id"], "composite": false, "primary": false, "unique": false, @@ -355,9 +341,7 @@ }, { "keyName": "inventory_level_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -367,13 +351,9 @@ "foreignKeys": { "inventory_level_inventory_item_id_foreign": { "constraintName": "inventory_level_inventory_item_id_foreign", - "columnNames": [ - "inventory_item_id" - ], + "columnNames": ["inventory_item_id"], "localTableName": "public.inventory_level", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.inventory_item", "deleteRule": "cascade", "updateRule": "cascade" @@ -501,9 +481,7 @@ "indexes": [ { "keyName": "IDX_reservation_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -511,9 +489,7 @@ }, { "keyName": "IDX_reservation_item_line_item_id", - "columnNames": [ - "line_item_id" - ], + "columnNames": ["line_item_id"], "composite": false, "primary": false, "unique": false, @@ -521,9 +497,7 @@ }, { "keyName": "IDX_reservation_item_location_id", - "columnNames": [ - "location_id" - ], + "columnNames": ["location_id"], "composite": false, "primary": false, "unique": false, @@ -531,9 +505,7 @@ }, { "keyName": "IDX_reservation_item_inventory_item_id", - "columnNames": [ - "inventory_item_id" - ], + "columnNames": ["inventory_item_id"], "composite": false, "primary": false, "unique": false, @@ -541,9 +513,7 @@ }, { "keyName": "reservation_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -553,13 +523,9 @@ "foreignKeys": { "reservation_item_inventory_item_id_foreign": { "constraintName": "reservation_item_inventory_item_id_foreign", - "columnNames": [ - "inventory_item_id" - ], + "columnNames": ["inventory_item_id"], "localTableName": "public.reservation_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.inventory_item", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/notification/src/migrations/.snapshot-medusa-notification.json b/packages/modules/notification/src/migrations/.snapshot-medusa-notification.json index 57b5f9fd6c..00f8a26dd7 100644 --- a/packages/modules/notification/src/migrations/.snapshot-medusa-notification.json +++ b/packages/modules/notification/src/migrations/.snapshot-medusa-notification.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -91,9 +89,7 @@ "indexes": [ { "keyName": "notification_provider_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -220,11 +216,7 @@ "primary": false, "nullable": false, "default": "'pending'", - "enumItems": [ - "pending", - "success", - "failure" - ], + "enumItems": ["pending", "success", "failure"], "mappedType": "enum" }, "provider_id": { @@ -298,9 +290,7 @@ }, { "keyName": "notification_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -310,13 +300,9 @@ "foreignKeys": { "notification_provider_id_foreign": { "constraintName": "notification_provider_id_foreign", - "columnNames": [ - "provider_id" - ], + "columnNames": ["provider_id"], "localTableName": "public.notification", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.notification_provider", "deleteRule": "set null", "updateRule": "cascade" diff --git a/packages/modules/notification/src/migrations/Migration20240830094712.ts b/packages/modules/notification/src/migrations/Migration20240830094712.ts index 240579cacf..52f55833b6 100644 --- a/packages/modules/notification/src/migrations/Migration20240830094712.ts +++ b/packages/modules/notification/src/migrations/Migration20240830094712.ts @@ -1,13 +1,15 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240830094712 extends Migration { - async up(): Promise { - this.addSql('alter table if exists "notification" add column if not exists "status" text check ("status" in (\'pending\', \'success\', \'failure\')) not null default \'pending\';'); + this.addSql( + "alter table if exists \"notification\" add column if not exists \"status\" text check (\"status\" in ('pending', 'success', 'failure')) not null default 'pending';" + ) } async down(): Promise { - this.addSql('alter table if exists "notification" drop column if exists "status";'); + this.addSql( + 'alter table if exists "notification" drop column if exists "status";' + ) } - } diff --git a/packages/modules/order/src/migrations/.snapshot-medusa-order.json b/packages/modules/order/src/migrations/.snapshot-medusa-order.json index 0aa7c0dccc..893e5c204a 100644 --- a/packages/modules/order/src/migrations/.snapshot-medusa-order.json +++ b/packages/modules/order/src/migrations/.snapshot-medusa-order.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -151,9 +149,7 @@ "indexes": [ { "keyName": "IDX_order_address_customer_id", - "columnNames": [ - "customer_id" - ], + "columnNames": ["customer_id"], "composite": false, "primary": false, "unique": false, @@ -161,9 +157,7 @@ }, { "keyName": "order_address_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -359,9 +353,7 @@ "indexes": [ { "keyName": "IDX_order_display_id", - "columnNames": [ - "display_id" - ], + "columnNames": ["display_id"], "composite": false, "primary": false, "unique": false, @@ -369,9 +361,7 @@ }, { "keyName": "IDX_order_region_id", - "columnNames": [ - "region_id" - ], + "columnNames": ["region_id"], "composite": false, "primary": false, "unique": false, @@ -379,9 +369,7 @@ }, { "keyName": "IDX_order_customer_id", - "columnNames": [ - "customer_id" - ], + "columnNames": ["customer_id"], "composite": false, "primary": false, "unique": false, @@ -389,9 +377,7 @@ }, { "keyName": "IDX_order_customer_id", - "columnNames": [ - "sales_channel_id" - ], + "columnNames": ["sales_channel_id"], "composite": false, "primary": false, "unique": false, @@ -399,9 +385,7 @@ }, { "keyName": "IDX_order_is_draft_order", - "columnNames": [ - "is_draft_order" - ], + "columnNames": ["is_draft_order"], "composite": false, "primary": false, "unique": false, @@ -409,9 +393,7 @@ }, { "keyName": "IDX_order_currency_code", - "columnNames": [ - "currency_code" - ], + "columnNames": ["currency_code"], "composite": false, "primary": false, "unique": false, @@ -419,9 +401,7 @@ }, { "keyName": "IDX_order_shipping_address_id", - "columnNames": [ - "shipping_address_id" - ], + "columnNames": ["shipping_address_id"], "composite": false, "primary": false, "unique": false, @@ -429,9 +409,7 @@ }, { "keyName": "IDX_order_billing_address_id", - "columnNames": [ - "billing_address_id" - ], + "columnNames": ["billing_address_id"], "composite": false, "primary": false, "unique": false, @@ -439,9 +417,7 @@ }, { "keyName": "IDX_order_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -449,9 +425,7 @@ }, { "keyName": "order_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -461,26 +435,18 @@ "foreignKeys": { "order_shipping_address_id_foreign": { "constraintName": "order_shipping_address_id_foreign", - "columnNames": [ - "shipping_address_id" - ], + "columnNames": ["shipping_address_id"], "localTableName": "public.order", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_address", "deleteRule": "set null", "updateRule": "cascade" }, "order_billing_address_id_foreign": { "constraintName": "order_billing_address_id_foreign", - "columnNames": [ - "billing_address_id" - ], + "columnNames": ["billing_address_id"], "localTableName": "public.order", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_address", "deleteRule": "set null", "updateRule": "cascade" @@ -753,9 +719,7 @@ "indexes": [ { "keyName": "IDX_order_line_item_variant_id", - "columnNames": [ - "variant_id" - ], + "columnNames": ["variant_id"], "composite": false, "primary": false, "unique": false, @@ -763,9 +727,7 @@ }, { "keyName": "IDX_order_line_item_product_id", - "columnNames": [ - "product_id" - ], + "columnNames": ["product_id"], "composite": false, "primary": false, "unique": false, @@ -773,9 +735,7 @@ }, { "keyName": "IDX_order_line_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -783,9 +743,7 @@ }, { "keyName": "order_line_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1030,9 +988,7 @@ "indexes": [ { "keyName": "IDX_order_item_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -1040,9 +996,7 @@ }, { "keyName": "IDX_order_item_version", - "columnNames": [ - "version" - ], + "columnNames": ["version"], "composite": false, "primary": false, "unique": false, @@ -1050,9 +1004,7 @@ }, { "keyName": "IDX_order_item_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -1060,9 +1012,7 @@ }, { "keyName": "IDX_order_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1070,9 +1020,7 @@ }, { "keyName": "order_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1082,25 +1030,17 @@ "foreignKeys": { "order_item_order_id_foreign": { "constraintName": "order_item_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "updateRule": "cascade" }, "order_item_item_id_foreign": { "constraintName": "order_item_item_id_foreign", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "localTableName": "public.order_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_line_item", "updateRule": "cascade" } @@ -1218,9 +1158,7 @@ "indexes": [ { "keyName": "IDX_order_line_item_adjustment_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -1228,9 +1166,7 @@ }, { "keyName": "order_line_item_adjustment_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1240,13 +1176,9 @@ "foreignKeys": { "order_line_item_adjustment_item_id_foreign": { "constraintName": "order_line_item_adjustment_item_id_foreign", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "localTableName": "public.order_line_item_adjustment", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_line_item", "deleteRule": "cascade", "updateRule": "cascade" @@ -1365,9 +1297,7 @@ "indexes": [ { "keyName": "IDX_order_line_item_tax_line_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -1375,9 +1305,7 @@ }, { "keyName": "order_line_item_tax_line_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1387,13 +1315,9 @@ "foreignKeys": { "order_line_item_tax_line_item_id_foreign": { "constraintName": "order_line_item_tax_line_item_id_foreign", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "localTableName": "public.order_line_item_tax_line", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_line_item", "deleteRule": "cascade", "updateRule": "cascade" @@ -1532,9 +1456,7 @@ "indexes": [ { "keyName": "IDX_order_shipping_method_shipping_option_id", - "columnNames": [ - "shipping_option_id" - ], + "columnNames": ["shipping_option_id"], "composite": false, "primary": false, "unique": false, @@ -1542,9 +1464,7 @@ }, { "keyName": "IDX_order_shipping_method_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1552,9 +1472,7 @@ }, { "keyName": "order_shipping_method_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1675,9 +1593,7 @@ "indexes": [ { "keyName": "IDX_order_shipping_method_adjustment_shipping_method_id", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "composite": false, "primary": false, "unique": false, @@ -1685,9 +1601,7 @@ }, { "keyName": "order_shipping_method_adjustment_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1697,13 +1611,9 @@ "foreignKeys": { "order_shipping_method_adjustment_shipping_method_id_foreign": { "constraintName": "order_shipping_method_adjustment_shipping_method_id_foreign", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "localTableName": "public.order_shipping_method_adjustment", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_shipping_method", "deleteRule": "cascade", "updateRule": "cascade" @@ -1822,9 +1732,7 @@ "indexes": [ { "keyName": "IDX_order_shipping_method_tax_line_shipping_method_id", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "composite": false, "primary": false, "unique": false, @@ -1832,9 +1740,7 @@ }, { "keyName": "order_shipping_method_tax_line_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1844,13 +1750,9 @@ "foreignKeys": { "order_shipping_method_tax_line_shipping_method_id_foreign": { "constraintName": "order_shipping_method_tax_line_shipping_method_id_foreign", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "localTableName": "public.order_shipping_method_tax_line", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_shipping_method", "deleteRule": "cascade", "updateRule": "cascade" @@ -1934,9 +1836,7 @@ "indexes": [ { "keyName": "IDX_order_summary_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -1952,9 +1852,7 @@ }, { "keyName": "order_summary_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1964,13 +1862,9 @@ "foreignKeys": { "order_summary_order_id_foreign": { "constraintName": "order_summary_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_summary", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "deleteRule": "cascade", "updateRule": "cascade" @@ -2171,18 +2065,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "composite": false, "keyName": "return_exchange_id_unique", "primary": false, "unique": true }, { - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "composite": false, "keyName": "return_claim_id_unique", "primary": false, @@ -2190,9 +2080,7 @@ }, { "keyName": "IDX_return_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -2200,9 +2088,7 @@ }, { "keyName": "IDX_return_exchange_id", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "composite": false, "primary": false, "unique": false, @@ -2210,9 +2096,7 @@ }, { "keyName": "IDX_return_claim_id", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "composite": false, "primary": false, "unique": false, @@ -2220,9 +2104,7 @@ }, { "keyName": "IDX_return_display_id", - "columnNames": [ - "display_id" - ], + "columnNames": ["display_id"], "composite": false, "primary": false, "unique": false, @@ -2230,9 +2112,7 @@ }, { "keyName": "IDX_return_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -2240,9 +2120,7 @@ }, { "keyName": "return_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -2252,38 +2130,26 @@ "foreignKeys": { "return_order_id_foreign": { "constraintName": "return_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.return", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "updateRule": "cascade" }, "return_exchange_id_foreign": { "constraintName": "return_exchange_id_foreign", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "localTableName": "public.return", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_exchange", "deleteRule": "set null", "updateRule": "cascade" }, "return_claim_id_foreign": { "constraintName": "return_claim_id_foreign", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "localTableName": "public.return", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_claim", "deleteRule": "set null", "updateRule": "cascade" @@ -2439,9 +2305,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "keyName": "order_exchange_return_id_unique", "primary": false, @@ -2449,9 +2313,7 @@ }, { "keyName": "IDX_order_exchange_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -2459,9 +2321,7 @@ }, { "keyName": "IDX_order_exchange_return_id", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "primary": false, "unique": false, @@ -2469,9 +2329,7 @@ }, { "keyName": "IDX_order_exchange_display_id", - "columnNames": [ - "display_id" - ], + "columnNames": ["display_id"], "composite": false, "primary": false, "unique": false, @@ -2479,9 +2337,7 @@ }, { "keyName": "IDX_order_exchange_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -2489,9 +2345,7 @@ }, { "keyName": "order_exchange_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -2501,25 +2355,17 @@ "foreignKeys": { "order_exchange_order_id_foreign": { "constraintName": "order_exchange_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_exchange", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "updateRule": "cascade" }, "order_exchange_return_id_foreign": { "constraintName": "order_exchange_return_id_foreign", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "localTableName": "public.order_exchange", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return", "deleteRule": "set null", "updateRule": "cascade" @@ -2629,9 +2475,7 @@ "indexes": [ { "keyName": "IDX_order_exchange_item_exchange_id", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "composite": false, "primary": false, "unique": false, @@ -2639,9 +2483,7 @@ }, { "keyName": "IDX_order_exchange_item_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -2649,9 +2491,7 @@ }, { "keyName": "IDX_order_claim_item_image_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -2659,9 +2499,7 @@ }, { "keyName": "order_exchange_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -2671,26 +2509,18 @@ "foreignKeys": { "order_exchange_item_exchange_id_foreign": { "constraintName": "order_exchange_item_exchange_id_foreign", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "localTableName": "public.order_exchange_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_exchange", "deleteRule": "cascade", "updateRule": "cascade" }, "order_exchange_item_item_id_foreign": { "constraintName": "order_exchange_item_item_id_foreign", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "localTableName": "public.order_exchange_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_line_item", "updateRule": "cascade" } @@ -2750,10 +2580,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "refund", - "replace" - ], + "enumItems": ["refund", "replace"], "mappedType": "enum" }, "no_notification": { @@ -2848,9 +2675,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "keyName": "order_claim_return_id_unique", "primary": false, @@ -2858,9 +2683,7 @@ }, { "keyName": "IDX_order_claim_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -2868,9 +2691,7 @@ }, { "keyName": "IDX_order_claim_return_id", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "primary": false, "unique": false, @@ -2878,9 +2699,7 @@ }, { "keyName": "IDX_order_claim_display_id", - "columnNames": [ - "display_id" - ], + "columnNames": ["display_id"], "composite": false, "primary": false, "unique": false, @@ -2888,9 +2707,7 @@ }, { "keyName": "IDX_order_claim_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -2898,9 +2715,7 @@ }, { "keyName": "order_claim_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -2910,25 +2725,17 @@ "foreignKeys": { "order_claim_order_id_foreign": { "constraintName": "order_claim_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_claim", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "updateRule": "cascade" }, "order_claim_return_id_foreign": { "constraintName": "order_claim_return_id_foreign", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "localTableName": "public.order_claim", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return", "deleteRule": "set null", "updateRule": "cascade" @@ -3075,9 +2882,7 @@ "indexes": [ { "keyName": "IDX_order_transaction_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -3085,9 +2890,7 @@ }, { "keyName": "IDX_order_transaction_return_id", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "primary": false, "unique": false, @@ -3095,9 +2898,7 @@ }, { "keyName": "IDX_order_transaction_exchange_id", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "composite": false, "primary": false, "unique": false, @@ -3105,9 +2906,7 @@ }, { "keyName": "IDX_order_transaction_claim_id", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "composite": false, "primary": false, "unique": false, @@ -3115,9 +2914,7 @@ }, { "keyName": "IDX_order_transaction_currency_code", - "columnNames": [ - "currency_code" - ], + "columnNames": ["currency_code"], "composite": false, "primary": false, "unique": false, @@ -3125,9 +2922,7 @@ }, { "keyName": "IDX_order_transaction_reference_id", - "columnNames": [ - "reference_id" - ], + "columnNames": ["reference_id"], "composite": false, "primary": false, "unique": false, @@ -3135,9 +2930,7 @@ }, { "keyName": "IDX_order_transaction_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -3153,9 +2946,7 @@ }, { "keyName": "order_transaction_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -3165,52 +2956,36 @@ "foreignKeys": { "order_transaction_order_id_foreign": { "constraintName": "order_transaction_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_transaction", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "deleteRule": "cascade", "updateRule": "cascade" }, "order_transaction_return_id_foreign": { "constraintName": "order_transaction_return_id_foreign", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "localTableName": "public.order_transaction", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return", "deleteRule": "set null", "updateRule": "cascade" }, "order_transaction_exchange_id_foreign": { "constraintName": "order_transaction_exchange_id_foreign", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "localTableName": "public.order_transaction", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_exchange", "deleteRule": "set null", "updateRule": "cascade" }, "order_transaction_claim_id_foreign": { "constraintName": "order_transaction_claim_id_foreign", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "localTableName": "public.order_transaction", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_claim", "deleteRule": "set null", "updateRule": "cascade" @@ -3320,9 +3095,7 @@ "indexes": [ { "keyName": "IDX_order_shipping_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -3330,9 +3103,7 @@ }, { "keyName": "IDX_order_shipping_return_id", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "primary": false, "unique": false, @@ -3340,9 +3111,7 @@ }, { "keyName": "IDX_order_shipping_exchange_id", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "composite": false, "primary": false, "unique": false, @@ -3350,9 +3119,7 @@ }, { "keyName": "IDX_order_shipping_claim_id", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "composite": false, "primary": false, "unique": false, @@ -3360,9 +3127,7 @@ }, { "keyName": "IDX_order_shipping_version", - "columnNames": [ - "version" - ], + "columnNames": ["version"], "composite": false, "primary": false, "unique": false, @@ -3370,9 +3135,7 @@ }, { "keyName": "IDX_order_shipping_shipping_method_id", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "composite": false, "primary": false, "unique": false, @@ -3380,9 +3143,7 @@ }, { "keyName": "IDX_order_shipping_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -3390,9 +3151,7 @@ }, { "keyName": "order_shipping_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -3402,64 +3161,44 @@ "foreignKeys": { "order_shipping_order_id_foreign": { "constraintName": "order_shipping_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_shipping", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "updateRule": "cascade" }, "order_shipping_return_id_foreign": { "constraintName": "order_shipping_return_id_foreign", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "localTableName": "public.order_shipping", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return", "deleteRule": "set null", "updateRule": "cascade" }, "order_shipping_exchange_id_foreign": { "constraintName": "order_shipping_exchange_id_foreign", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "localTableName": "public.order_shipping", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_exchange", "deleteRule": "set null", "updateRule": "cascade" }, "order_shipping_claim_id_foreign": { "constraintName": "order_shipping_claim_id_foreign", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "localTableName": "public.order_shipping", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_claim", "deleteRule": "set null", "updateRule": "cascade" }, "order_shipping_shipping_method_id_foreign": { "constraintName": "order_shipping_shipping_method_id_foreign", - "columnNames": [ - "shipping_method_id" - ], + "columnNames": ["shipping_method_id"], "localTableName": "public.order_shipping", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_shipping_method", "updateRule": "cascade" } @@ -3593,9 +3332,7 @@ "indexes": [ { "keyName": "IDX_order_claim_item_claim_id", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "composite": false, "primary": false, "unique": false, @@ -3603,9 +3340,7 @@ }, { "keyName": "IDX_order_claim_item_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -3613,9 +3348,7 @@ }, { "keyName": "IDX_order_claim_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -3623,9 +3356,7 @@ }, { "keyName": "order_claim_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -3635,26 +3366,18 @@ "foreignKeys": { "order_claim_item_claim_id_foreign": { "constraintName": "order_claim_item_claim_id_foreign", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "localTableName": "public.order_claim_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_claim", "deleteRule": "cascade", "updateRule": "cascade" }, "order_claim_item_item_id_foreign": { "constraintName": "order_claim_item_item_id_foreign", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "localTableName": "public.order_claim_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_line_item", "updateRule": "cascade" } @@ -3736,9 +3459,7 @@ "indexes": [ { "keyName": "IDX_order_claim_item_image_claim_item_id", - "columnNames": [ - "claim_item_id" - ], + "columnNames": ["claim_item_id"], "composite": false, "primary": false, "unique": false, @@ -3746,9 +3467,7 @@ }, { "keyName": "IDX_order_claim_item_image_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -3756,9 +3475,7 @@ }, { "keyName": "order_claim_item_image_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -3768,13 +3485,9 @@ "foreignKeys": { "order_claim_item_image_claim_item_id_foreign": { "constraintName": "order_claim_item_image_claim_item_id_foreign", - "columnNames": [ - "claim_item_id" - ], + "columnNames": ["claim_item_id"], "localTableName": "public.order_claim_item_image", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_claim_item", "updateRule": "cascade" } @@ -4021,9 +3734,7 @@ "indexes": [ { "keyName": "IDX_order_change_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -4031,9 +3742,7 @@ }, { "keyName": "IDX_order_change_return_id", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "primary": false, "unique": false, @@ -4041,9 +3750,7 @@ }, { "keyName": "IDX_order_change_claim_id", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "composite": false, "primary": false, "unique": false, @@ -4051,9 +3758,7 @@ }, { "keyName": "IDX_order_change_exchange_id", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "composite": false, "primary": false, "unique": false, @@ -4061,9 +3766,7 @@ }, { "keyName": "IDX_order_change_order_id_version", - "columnNames": [ - "version" - ], + "columnNames": ["version"], "composite": false, "primary": false, "unique": false, @@ -4071,9 +3774,7 @@ }, { "keyName": "IDX_order_change_status", - "columnNames": [ - "status" - ], + "columnNames": ["status"], "composite": false, "primary": false, "unique": false, @@ -4081,9 +3782,7 @@ }, { "keyName": "IDX_order_change_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -4099,9 +3798,7 @@ }, { "keyName": "order_change_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -4111,52 +3808,36 @@ "foreignKeys": { "order_change_order_id_foreign": { "constraintName": "order_change_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_change", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "deleteRule": "cascade", "updateRule": "cascade" }, "order_change_return_id_foreign": { "constraintName": "order_change_return_id_foreign", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "localTableName": "public.order_change", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return", "deleteRule": "set null", "updateRule": "cascade" }, "order_change_claim_id_foreign": { "constraintName": "order_change_claim_id_foreign", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "localTableName": "public.order_change", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_claim", "deleteRule": "set null", "updateRule": "cascade" }, "order_change_exchange_id_foreign": { "constraintName": "order_change_exchange_id_foreign", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "localTableName": "public.order_change", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_exchange", "deleteRule": "set null", "updateRule": "cascade" @@ -4348,9 +4029,7 @@ "indexes": [ { "keyName": "IDX_order_change_action_ordering", - "columnNames": [ - "ordering" - ], + "columnNames": ["ordering"], "composite": false, "primary": false, "unique": false, @@ -4358,9 +4037,7 @@ }, { "keyName": "IDX_order_change_action_order_id", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "composite": false, "primary": false, "unique": false, @@ -4368,9 +4045,7 @@ }, { "keyName": "IDX_order_change_action_return_id", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "primary": false, "unique": false, @@ -4378,9 +4053,7 @@ }, { "keyName": "IDX_order_change_action_claim_id", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "composite": false, "primary": false, "unique": false, @@ -4388,9 +4061,7 @@ }, { "keyName": "IDX_order_change_action_exchange_id", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "composite": false, "primary": false, "unique": false, @@ -4398,9 +4069,7 @@ }, { "keyName": "IDX_order_change_action_order_change_id", - "columnNames": [ - "order_change_id" - ], + "columnNames": ["order_change_id"], "composite": false, "primary": false, "unique": false, @@ -4408,9 +4077,7 @@ }, { "keyName": "IDX_order_change_action_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -4418,9 +4085,7 @@ }, { "keyName": "order_change_action_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -4430,65 +4095,45 @@ "foreignKeys": { "order_change_action_order_id_foreign": { "constraintName": "order_change_action_order_id_foreign", - "columnNames": [ - "order_id" - ], + "columnNames": ["order_id"], "localTableName": "public.order_change_action", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order", "deleteRule": "cascade", "updateRule": "cascade" }, "order_change_action_return_id_foreign": { "constraintName": "order_change_action_return_id_foreign", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "localTableName": "public.order_change_action", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return", "deleteRule": "set null", "updateRule": "cascade" }, "order_change_action_claim_id_foreign": { "constraintName": "order_change_action_claim_id_foreign", - "columnNames": [ - "claim_id" - ], + "columnNames": ["claim_id"], "localTableName": "public.order_change_action", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_claim", "deleteRule": "set null", "updateRule": "cascade" }, "order_change_action_exchange_id_foreign": { "constraintName": "order_change_action_exchange_id_foreign", - "columnNames": [ - "exchange_id" - ], + "columnNames": ["exchange_id"], "localTableName": "public.order_change_action", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_exchange", "deleteRule": "set null", "updateRule": "cascade" }, "order_change_action_order_change_id_foreign": { "constraintName": "order_change_action_order_change_id_foreign", - "columnNames": [ - "order_change_id" - ], + "columnNames": ["order_change_id"], "localTableName": "public.order_change_action", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_change", "deleteRule": "cascade", "updateRule": "cascade" @@ -4589,9 +4234,7 @@ "indexes": [ { "keyName": "IDX_return_reason_value", - "columnNames": [ - "value" - ], + "columnNames": ["value"], "composite": false, "primary": false, "unique": false, @@ -4599,9 +4242,7 @@ }, { "keyName": "IDX_return_reason_parent_return_reason_id", - "columnNames": [ - "parent_return_reason_id" - ], + "columnNames": ["parent_return_reason_id"], "composite": false, "primary": false, "unique": false, @@ -4609,9 +4250,7 @@ }, { "keyName": "IDX_return_reason_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -4619,9 +4258,7 @@ }, { "keyName": "return_reason_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -4631,13 +4268,9 @@ "foreignKeys": { "return_reason_parent_return_reason_id_foreign": { "constraintName": "return_reason_parent_return_reason_id_foreign", - "columnNames": [ - "parent_return_reason_id" - ], + "columnNames": ["parent_return_reason_id"], "localTableName": "public.return_reason", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return_reason", "deleteRule": "set null", "updateRule": "cascade" @@ -4794,9 +4427,7 @@ "indexes": [ { "keyName": "IDX_return_item_reason_id", - "columnNames": [ - "reason_id" - ], + "columnNames": ["reason_id"], "composite": false, "primary": false, "unique": false, @@ -4804,9 +4435,7 @@ }, { "keyName": "IDX_return_item_return_id", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "composite": false, "primary": false, "unique": false, @@ -4814,9 +4443,7 @@ }, { "keyName": "IDX_return_item_item_id", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "composite": false, "primary": false, "unique": false, @@ -4824,9 +4451,7 @@ }, { "keyName": "IDX_return_item_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -4834,9 +4459,7 @@ }, { "keyName": "return_item_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -4846,39 +4469,27 @@ "foreignKeys": { "return_item_reason_id_foreign": { "constraintName": "return_item_reason_id_foreign", - "columnNames": [ - "reason_id" - ], + "columnNames": ["reason_id"], "localTableName": "public.return_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return_reason", "deleteRule": "set null", "updateRule": "cascade" }, "return_item_return_id_foreign": { "constraintName": "return_item_return_id_foreign", - "columnNames": [ - "return_id" - ], + "columnNames": ["return_id"], "localTableName": "public.return_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.return", "deleteRule": "cascade", "updateRule": "cascade" }, "return_item_item_id_foreign": { "constraintName": "return_item_item_id_foreign", - "columnNames": [ - "item_id" - ], + "columnNames": ["item_id"], "localTableName": "public.return_item", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.order_line_item", "updateRule": "cascade" } diff --git a/packages/modules/order/src/migrations/Migration20240902195921.ts b/packages/modules/order/src/migrations/Migration20240902195921.ts index 4bb6982256..d0ed2be64e 100644 --- a/packages/modules/order/src/migrations/Migration20240902195921.ts +++ b/packages/modules/order/src/migrations/Migration20240902195921.ts @@ -1,17 +1,23 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240902195921 extends Migration { - async up(): Promise { - this.addSql('alter table if exists "order_line_item" add column if not exists "is_custom_price" boolean not null default false;'); + this.addSql( + 'alter table if exists "order_line_item" add column if not exists "is_custom_price" boolean not null default false;' + ) - this.addSql('alter table if exists "order_shipping_method" add column if not exists "is_custom_amount" boolean not null default false;'); + this.addSql( + 'alter table if exists "order_shipping_method" add column if not exists "is_custom_amount" boolean not null default false;' + ) } async down(): Promise { - this.addSql('alter table if exists "order_line_item" drop column if exists "is_custom_price";'); + this.addSql( + 'alter table if exists "order_line_item" drop column if exists "is_custom_price";' + ) - this.addSql('alter table if exists "order_shipping_method" drop column if exists "is_custom_amount";'); + this.addSql( + 'alter table if exists "order_shipping_method" drop column if exists "is_custom_amount";' + ) } - } diff --git a/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json b/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json index 47226f14e8..e95dc6a972 100644 --- a/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json +++ b/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -178,18 +176,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "region_id" - ], + "columnNames": ["region_id"], "composite": false, "keyName": "IDX_payment_collection_region_id", "primary": false, "unique": false }, { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_payment_collection_deleted_at", "primary": false, @@ -197,9 +191,7 @@ }, { "keyName": "payment_collection_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -310,9 +302,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_payment_method_token_deleted_at", "primary": false, @@ -320,9 +310,7 @@ }, { "keyName": "payment_method_token_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -358,9 +346,7 @@ "indexes": [ { "keyName": "payment_provider_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -395,10 +381,7 @@ "indexes": [ { "keyName": "payment_collection_payment_providers_pkey", - "columnNames": [ - "payment_collection_id", - "payment_provider_id" - ], + "columnNames": ["payment_collection_id", "payment_provider_id"], "composite": true, "primary": true, "unique": true @@ -408,26 +391,18 @@ "foreignKeys": { "payment_collection_payment_providers_payment_coll_aa276_foreign": { "constraintName": "payment_collection_payment_providers_payment_coll_aa276_foreign", - "columnNames": [ - "payment_collection_id" - ], + "columnNames": ["payment_collection_id"], "localTableName": "public.payment_collection_payment_providers", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.payment_collection", "deleteRule": "cascade", "updateRule": "cascade" }, "payment_collection_payment_providers_payment_provider_id_foreign": { "constraintName": "payment_collection_payment_providers_payment_provider_id_foreign", - "columnNames": [ - "payment_provider_id" - ], + "columnNames": ["payment_provider_id"], "localTableName": "public.payment_collection_payment_providers", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.payment_provider", "deleteRule": "cascade", "updateRule": "cascade" @@ -582,18 +557,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "payment_collection_id" - ], + "columnNames": ["payment_collection_id"], "composite": false, "keyName": "IDX_payment_session_payment_collection_id", "primary": false, "unique": false }, { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_payment_session_deleted_at", "primary": false, @@ -601,9 +572,7 @@ }, { "keyName": "payment_session_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -613,13 +582,9 @@ "foreignKeys": { "payment_session_payment_collection_id_foreign": { "constraintName": "payment_session_payment_collection_id_foreign", - "columnNames": [ - "payment_collection_id" - ], + "columnNames": ["payment_collection_id"], "localTableName": "public.payment_session", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.payment_collection", "updateRule": "cascade" } @@ -792,36 +757,28 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_payment_deleted_at", "primary": false, "unique": false }, { - "columnNames": [ - "payment_collection_id" - ], + "columnNames": ["payment_collection_id"], "composite": false, "keyName": "IDX_payment_payment_collection_id", "primary": false, "unique": false }, { - "columnNames": [ - "payment_session_id" - ], + "columnNames": ["payment_session_id"], "composite": false, "keyName": "IDX_payment_payment_session_id", "primary": false, "unique": false }, { - "columnNames": [ - "payment_session_id" - ], + "columnNames": ["payment_session_id"], "composite": false, "keyName": "payment_payment_session_id_unique", "primary": false, @@ -829,9 +786,7 @@ }, { "keyName": "IDX_payment_provider_id", - "columnNames": [ - "provider_id" - ], + "columnNames": ["provider_id"], "composite": false, "primary": false, "unique": false, @@ -839,9 +794,7 @@ }, { "keyName": "payment_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -851,25 +804,17 @@ "foreignKeys": { "payment_payment_collection_id_foreign": { "constraintName": "payment_payment_collection_id_foreign", - "columnNames": [ - "payment_collection_id" - ], + "columnNames": ["payment_collection_id"], "localTableName": "public.payment", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.payment_collection", "updateRule": "cascade" }, "payment_payment_session_id_foreign": { "constraintName": "payment_payment_session_id_foreign", - "columnNames": [ - "payment_session_id" - ], + "columnNames": ["payment_session_id"], "localTableName": "public.payment", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.payment_session", "updateRule": "cascade" } @@ -968,18 +913,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "payment_id" - ], + "columnNames": ["payment_id"], "composite": false, "keyName": "IDX_capture_payment_id", "primary": false, "unique": false }, { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_capture_deleted_at", "primary": false, @@ -987,9 +928,7 @@ }, { "keyName": "capture_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -999,13 +938,9 @@ "foreignKeys": { "capture_payment_id_foreign": { "constraintName": "capture_payment_id_foreign", - "columnNames": [ - "payment_id" - ], + "columnNames": ["payment_id"], "localTableName": "public.capture", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.payment", "deleteRule": "cascade", "updateRule": "cascade" @@ -1088,9 +1023,7 @@ "indexes": [ { "keyName": "refund_reason_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1210,18 +1143,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "payment_id" - ], + "columnNames": ["payment_id"], "composite": false, "keyName": "IDX_refund_payment_id", "primary": false, "unique": false }, { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_refund_deleted_at", "primary": false, @@ -1229,9 +1158,7 @@ }, { "keyName": "refund_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1241,26 +1168,18 @@ "foreignKeys": { "refund_payment_id_foreign": { "constraintName": "refund_payment_id_foreign", - "columnNames": [ - "payment_id" - ], + "columnNames": ["payment_id"], "localTableName": "public.refund", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.payment", "deleteRule": "cascade", "updateRule": "cascade" }, "refund_refund_reason_id_foreign": { "constraintName": "refund_refund_reason_id_foreign", - "columnNames": [ - "refund_reason_id" - ], + "columnNames": ["refund_reason_id"], "localTableName": "public.refund", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.refund_reason", "deleteRule": "set null", "updateRule": "cascade" diff --git a/packages/modules/payment/src/services/index.ts b/packages/modules/payment/src/services/index.ts index dcd1312a42..b331c37d29 100644 --- a/packages/modules/payment/src/services/index.ts +++ b/packages/modules/payment/src/services/index.ts @@ -1,3 +1,2 @@ export { default as PaymentModuleService } from "./payment-module" export { default as PaymentProviderService } from "./payment-provider" - diff --git a/packages/modules/pricing/src/migrations/.snapshot-medusa-pricing.json b/packages/modules/pricing/src/migrations/.snapshot-medusa-pricing.json index 7439ea81fa..46f12f4a56 100644 --- a/packages/modules/pricing/src/migrations/.snapshot-medusa-pricing.json +++ b/packages/modules/pricing/src/migrations/.snapshot-medusa-pricing.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -41,10 +39,7 @@ "primary": false, "nullable": false, "default": "'draft'", - "enumItems": [ - "active", - "draft" - ], + "enumItems": ["active", "draft"], "mappedType": "enum" }, "type": { @@ -55,10 +50,7 @@ "primary": false, "nullable": false, "default": "'sale'", - "enumItems": [ - "sale", - "override" - ], + "enumItems": ["sale", "override"], "mappedType": "enum" }, "starts_at": { @@ -129,9 +121,7 @@ "indexes": [ { "keyName": "IDX_price_list_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -139,9 +129,7 @@ }, { "keyName": "price_list_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -226,9 +214,7 @@ "indexes": [ { "keyName": "IDX_price_list_rule_price_list_id", - "columnNames": [ - "price_list_id" - ], + "columnNames": ["price_list_id"], "composite": false, "primary": false, "unique": false, @@ -236,9 +222,7 @@ }, { "keyName": "IDX_price_list_rule_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -246,9 +230,7 @@ }, { "keyName": "price_list_rule_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -258,13 +240,9 @@ "foreignKeys": { "price_list_rule_price_list_id_foreign": { "constraintName": "price_list_rule_price_list_id_foreign", - "columnNames": [ - "price_list_id" - ], + "columnNames": ["price_list_id"], "localTableName": "public.price_list_rule", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.price_list", "deleteRule": "cascade", "updateRule": "cascade" @@ -348,9 +326,7 @@ "indexes": [ { "keyName": "IDX_price_preference_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -366,9 +342,7 @@ }, { "keyName": "price_preference_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -426,9 +400,7 @@ "indexes": [ { "keyName": "IDX_price_set_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -436,9 +408,7 @@ }, { "keyName": "price_set_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -578,9 +548,7 @@ "indexes": [ { "keyName": "IDX_price_currency_code", - "columnNames": [ - "currency_code" - ], + "columnNames": ["currency_code"], "composite": false, "primary": false, "unique": false, @@ -588,9 +556,7 @@ }, { "keyName": "IDX_price_price_set_id", - "columnNames": [ - "price_set_id" - ], + "columnNames": ["price_set_id"], "composite": false, "primary": false, "unique": false, @@ -598,9 +564,7 @@ }, { "keyName": "IDX_price_price_list_id", - "columnNames": [ - "price_list_id" - ], + "columnNames": ["price_list_id"], "composite": false, "primary": false, "unique": false, @@ -608,9 +572,7 @@ }, { "keyName": "IDX_price_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -618,9 +580,7 @@ }, { "keyName": "price_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -630,26 +590,18 @@ "foreignKeys": { "price_price_set_id_foreign": { "constraintName": "price_price_set_id_foreign", - "columnNames": [ - "price_set_id" - ], + "columnNames": ["price_set_id"], "localTableName": "public.price", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.price_set", "deleteRule": "cascade", "updateRule": "cascade" }, "price_price_list_id_foreign": { "constraintName": "price_price_list_id_foreign", - "columnNames": [ - "price_list_id" - ], + "columnNames": ["price_list_id"], "localTableName": "public.price", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.price_list", "deleteRule": "cascade", "updateRule": "cascade" @@ -742,9 +694,7 @@ "indexes": [ { "keyName": "IDX_price_rule_price_id_attribute_unique", - "columnNames": [ - "price_id" - ], + "columnNames": ["price_id"], "composite": false, "primary": false, "unique": false, @@ -752,9 +702,7 @@ }, { "keyName": "IDX_price_rule_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -762,9 +710,7 @@ }, { "keyName": "price_rule_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -774,13 +720,9 @@ "foreignKeys": { "price_rule_price_id_foreign": { "constraintName": "price_rule_price_id_foreign", - "columnNames": [ - "price_id" - ], + "columnNames": ["price_id"], "localTableName": "public.price_rule", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.price", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/pricing/src/migrations/Migration20240322094407.ts b/packages/modules/pricing/src/migrations/Migration20240322094407.ts index aa1f684e1c..65199ef4f9 100644 --- a/packages/modules/pricing/src/migrations/Migration20240322094407.ts +++ b/packages/modules/pricing/src/migrations/Migration20240322094407.ts @@ -1,15 +1,19 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240322094407 extends Migration { - async up(): Promise { - this.addSql('drop table if exists "money_amount" cascade;'); + this.addSql('drop table if exists "money_amount" cascade;') } async down(): Promise { - this.addSql('create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));'); - this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;'); - this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;'); + this.addSql( + 'create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));' + ) + this.addSql( + 'CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;' + ) + this.addSql( + 'CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;' + ) } - } diff --git a/packages/modules/pricing/src/migrations/Migration20240704094505.ts b/packages/modules/pricing/src/migrations/Migration20240704094505.ts index 0afcefc05d..520b835c3d 100644 --- a/packages/modules/pricing/src/migrations/Migration20240704094505.ts +++ b/packages/modules/pricing/src/migrations/Migration20240704094505.ts @@ -1,15 +1,19 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240704094505 extends Migration { - async up(): Promise { - this.addSql('create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));'); - this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;'); - this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;'); + this.addSql( + 'create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));' + ) + this.addSql( + 'CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;' + ) + this.addSql( + 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;' + ) } async down(): Promise { - this.addSql('drop table if exists "price_preference" cascade;'); + this.addSql('drop table if exists "price_preference" cascade;') } - } diff --git a/packages/modules/product/src/migrations/.snapshot-medusa-products.json b/packages/modules/product/src/migrations/.snapshot-medusa-products.json index 0c1027f2c3..a561010919 100644 --- a/packages/modules/product/src/migrations/.snapshot-medusa-products.json +++ b/packages/modules/product/src/migrations/.snapshot-medusa-products.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -128,9 +126,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_category_deleted_at", "primary": false, @@ -138,9 +134,7 @@ }, { "keyName": "product_category_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -150,13 +144,9 @@ "foreignKeys": { "product_category_parent_category_id_foreign": { "constraintName": "product_category_parent_category_id_foreign", - "columnNames": [ - "parent_category_id" - ], + "columnNames": ["parent_category_id"], "localTableName": "public.product_category", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_category", "deleteRule": "cascade", "updateRule": "cascade" @@ -238,9 +228,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_collection_deleted_at", "primary": false, @@ -248,9 +236,7 @@ }, { "keyName": "product_collection_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -325,9 +311,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_image_deleted_at", "primary": false, @@ -335,9 +319,7 @@ }, { "keyName": "image_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -412,9 +394,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_tag_deleted_at", "primary": false, @@ -422,9 +402,7 @@ }, { "keyName": "product_tag_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -499,9 +477,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_type_deleted_at", "primary": false, @@ -509,9 +485,7 @@ }, { "keyName": "product_type_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -584,12 +558,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "draft", - "proposed", - "published", - "rejected" - ], + "enumItems": ["draft", "proposed", "published", "rejected"], "mappedType": "enum" }, "thumbnail": { @@ -756,9 +725,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_deleted_at", "primary": false, @@ -766,9 +733,7 @@ }, { "keyName": "product_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -778,26 +743,18 @@ "foreignKeys": { "product_collection_id_foreign": { "constraintName": "product_collection_id_foreign", - "columnNames": [ - "collection_id" - ], + "columnNames": ["collection_id"], "localTableName": "public.product", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_collection", "deleteRule": "set null", "updateRule": "cascade" }, "product_type_id_foreign": { "constraintName": "product_type_id_foreign", - "columnNames": [ - "type_id" - ], + "columnNames": ["type_id"], "localTableName": "public.product", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_type", "deleteRule": "set null", "updateRule": "cascade" @@ -879,9 +836,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_option_deleted_at", "primary": false, @@ -889,9 +844,7 @@ }, { "keyName": "product_option_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -901,13 +854,9 @@ "foreignKeys": { "product_option_product_id_foreign": { "constraintName": "product_option_product_id_foreign", - "columnNames": [ - "product_id" - ], + "columnNames": ["product_id"], "localTableName": "public.product_option", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product", "deleteRule": "cascade", "updateRule": "cascade" @@ -989,9 +938,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_option_value_deleted_at", "primary": false, @@ -999,9 +946,7 @@ }, { "keyName": "product_option_value_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1011,13 +956,9 @@ "foreignKeys": { "product_option_value_option_id_foreign": { "constraintName": "product_option_value_option_id_foreign", - "columnNames": [ - "option_id" - ], + "columnNames": ["option_id"], "localTableName": "public.product_option_value", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_option", "deleteRule": "cascade", "updateRule": "cascade" @@ -1050,10 +991,7 @@ "indexes": [ { "keyName": "product_tags_pkey", - "columnNames": [ - "product_id", - "product_tag_id" - ], + "columnNames": ["product_id", "product_tag_id"], "composite": true, "primary": true, "unique": true @@ -1063,26 +1001,18 @@ "foreignKeys": { "product_tags_product_id_foreign": { "constraintName": "product_tags_product_id_foreign", - "columnNames": [ - "product_id" - ], + "columnNames": ["product_id"], "localTableName": "public.product_tags", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product", "deleteRule": "cascade", "updateRule": "cascade" }, "product_tags_product_tag_id_foreign": { "constraintName": "product_tags_product_tag_id_foreign", - "columnNames": [ - "product_tag_id" - ], + "columnNames": ["product_tag_id"], "localTableName": "public.product_tags", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_tag", "deleteRule": "cascade", "updateRule": "cascade" @@ -1115,10 +1045,7 @@ "indexes": [ { "keyName": "product_images_pkey", - "columnNames": [ - "product_id", - "image_id" - ], + "columnNames": ["product_id", "image_id"], "composite": true, "primary": true, "unique": true @@ -1128,26 +1055,18 @@ "foreignKeys": { "product_images_product_id_foreign": { "constraintName": "product_images_product_id_foreign", - "columnNames": [ - "product_id" - ], + "columnNames": ["product_id"], "localTableName": "public.product_images", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product", "deleteRule": "cascade", "updateRule": "cascade" }, "product_images_image_id_foreign": { "constraintName": "product_images_image_id_foreign", - "columnNames": [ - "image_id" - ], + "columnNames": ["image_id"], "localTableName": "public.product_images", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.image", "deleteRule": "cascade", "updateRule": "cascade" @@ -1180,10 +1099,7 @@ "indexes": [ { "keyName": "product_category_product_pkey", - "columnNames": [ - "product_id", - "product_category_id" - ], + "columnNames": ["product_id", "product_category_id"], "composite": true, "primary": true, "unique": true @@ -1193,26 +1109,18 @@ "foreignKeys": { "product_category_product_product_id_foreign": { "constraintName": "product_category_product_product_id_foreign", - "columnNames": [ - "product_id" - ], + "columnNames": ["product_id"], "localTableName": "public.product_category_product", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product", "deleteRule": "cascade", "updateRule": "cascade" }, "product_category_product_product_category_id_foreign": { "constraintName": "product_category_product_product_category_id_foreign", - "columnNames": [ - "product_category_id" - ], + "columnNames": ["product_category_id"], "localTableName": "public.product_category_product", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_category", "deleteRule": "cascade", "updateRule": "cascade" @@ -1432,9 +1340,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_product_variant_deleted_at", "primary": false, @@ -1442,9 +1348,7 @@ }, { "keyName": "product_variant_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1454,13 +1358,9 @@ "foreignKeys": { "product_variant_product_id_foreign": { "constraintName": "product_variant_product_id_foreign", - "columnNames": [ - "product_id" - ], + "columnNames": ["product_id"], "localTableName": "public.product_variant", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product", "deleteRule": "cascade", "updateRule": "cascade" @@ -1493,10 +1393,7 @@ "indexes": [ { "keyName": "product_variant_option_pkey", - "columnNames": [ - "variant_id", - "option_value_id" - ], + "columnNames": ["variant_id", "option_value_id"], "composite": true, "primary": true, "unique": true @@ -1506,26 +1403,18 @@ "foreignKeys": { "product_variant_option_variant_id_foreign": { "constraintName": "product_variant_option_variant_id_foreign", - "columnNames": [ - "variant_id" - ], + "columnNames": ["variant_id"], "localTableName": "public.product_variant_option", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_variant", "deleteRule": "cascade", "updateRule": "cascade" }, "product_variant_option_option_value_id_foreign": { "constraintName": "product_variant_option_option_value_id_foreign", - "columnNames": [ - "option_value_id" - ], + "columnNames": ["option_value_id"], "localTableName": "public.product_variant_option", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.product_option_value", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/product/src/migrations/Migration202408271511.ts b/packages/modules/product/src/migrations/Migration202408271511.ts index e443347a43..4598eb3231 100644 --- a/packages/modules/product/src/migrations/Migration202408271511.ts +++ b/packages/modules/product/src/migrations/Migration202408271511.ts @@ -4,12 +4,12 @@ export class Migration202408271511 extends Migration { async up(): Promise { this.addSql( 'alter table if exists "product_category" add column if not exists "metadata" jsonb;' - ); + ) } async down(): Promise { this.addSql( 'alter table if exists "product_category" drop column if exists "metadata";' - ); + ) } } diff --git a/packages/modules/promotion/src/migrations/.snapshot-medusa-promotion.json b/packages/modules/promotion/src/migrations/.snapshot-medusa-promotion.json index 597f6c69d6..da37995ce8 100644 --- a/packages/modules/promotion/src/migrations/.snapshot-medusa-promotion.json +++ b/packages/modules/promotion/src/migrations/.snapshot-medusa-promotion.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -100,9 +98,7 @@ "indexes": [ { "keyName": "IDX_promotion_campaign_campaign_identifier_unique", - "columnNames": [ - "campaign_identifier" - ], + "columnNames": ["campaign_identifier"], "composite": false, "primary": false, "unique": false, @@ -110,9 +106,7 @@ }, { "keyName": "promotion_campaign_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -139,10 +133,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "spend", - "usage" - ], + "enumItems": ["spend", "usage"], "mappedType": "enum" }, "campaign_id": { @@ -237,18 +228,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "type" - ], + "columnNames": ["type"], "composite": false, "keyName": "IDX_campaign_budget_type", "primary": false, "unique": false }, { - "columnNames": [ - "campaign_id" - ], + "columnNames": ["campaign_id"], "composite": false, "keyName": "promotion_campaign_budget_campaign_id_unique", "primary": false, @@ -256,9 +243,7 @@ }, { "keyName": "promotion_campaign_budget_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -268,13 +253,9 @@ "foreignKeys": { "promotion_campaign_budget_campaign_id_foreign": { "constraintName": "promotion_campaign_budget_campaign_id_foreign", - "columnNames": [ - "campaign_id" - ], + "columnNames": ["campaign_id"], "localTableName": "public.promotion_campaign_budget", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_campaign", "updateRule": "cascade" } @@ -326,10 +307,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "standard", - "buyget" - ], + "enumItems": ["standard", "buyget"], "mappedType": "enum" }, "created_at": { @@ -369,18 +347,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "code" - ], + "columnNames": ["code"], "composite": false, "keyName": "IDX_promotion_code", "primary": false, "unique": false }, { - "columnNames": [ - "type" - ], + "columnNames": ["type"], "composite": false, "keyName": "IDX_promotion_type", "primary": false, @@ -388,18 +362,14 @@ }, { "keyName": "IDX_promotion_code_unique", - "columnNames": [ - "code" - ], + "columnNames": ["code"], "composite": false, "primary": false, "unique": true }, { "keyName": "promotion_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -409,13 +379,9 @@ "foreignKeys": { "promotion_campaign_id_foreign": { "constraintName": "promotion_campaign_id_foreign", - "columnNames": [ - "campaign_id" - ], + "columnNames": ["campaign_id"], "localTableName": "public.promotion", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_campaign", "deleteRule": "set null", "updateRule": "cascade" @@ -494,10 +460,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "fixed", - "percentage" - ], + "enumItems": ["fixed", "percentage"], "mappedType": "enum" }, "target_type": { @@ -507,11 +470,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "order", - "shipping_methods", - "items" - ], + "enumItems": ["order", "shipping_methods", "items"], "mappedType": "enum" }, "allocation": { @@ -521,10 +480,7 @@ "autoincrement": false, "primary": false, "nullable": true, - "enumItems": [ - "each", - "across" - ], + "enumItems": ["each", "across"], "mappedType": "enum" }, "promotion_id": { @@ -573,36 +529,28 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "type" - ], + "columnNames": ["type"], "composite": false, "keyName": "IDX_application_method_type", "primary": false, "unique": false }, { - "columnNames": [ - "target_type" - ], + "columnNames": ["target_type"], "composite": false, "keyName": "IDX_application_method_target_type", "primary": false, "unique": false }, { - "columnNames": [ - "allocation" - ], + "columnNames": ["allocation"], "composite": false, "keyName": "IDX_application_method_allocation", "primary": false, "unique": false }, { - "columnNames": [ - "promotion_id" - ], + "columnNames": ["promotion_id"], "composite": false, "keyName": "promotion_application_method_promotion_id_unique", "primary": false, @@ -610,9 +558,7 @@ }, { "keyName": "IDX_promotion_application_method_currency_code", - "columnNames": [ - "currency_code" - ], + "columnNames": ["currency_code"], "composite": false, "primary": false, "unique": false, @@ -620,9 +566,7 @@ }, { "keyName": "promotion_application_method_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -632,13 +576,9 @@ "foreignKeys": { "promotion_application_method_promotion_id_foreign": { "constraintName": "promotion_application_method_promotion_id_foreign", - "columnNames": [ - "promotion_id" - ], + "columnNames": ["promotion_id"], "localTableName": "public.promotion_application_method", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion", "deleteRule": "cascade", "updateRule": "cascade" @@ -681,15 +621,7 @@ "autoincrement": false, "primary": false, "nullable": false, - "enumItems": [ - "gte", - "lte", - "gt", - "lt", - "eq", - "ne", - "in" - ], + "enumItems": ["gte", "lte", "gt", "lt", "eq", "ne", "in"], "mappedType": "enum" }, "created_at": { @@ -729,18 +661,14 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "attribute" - ], + "columnNames": ["attribute"], "composite": false, "keyName": "IDX_promotion_rule_attribute", "primary": false, "unique": false }, { - "columnNames": [ - "operator" - ], + "columnNames": ["operator"], "composite": false, "keyName": "IDX_promotion_rule_operator", "primary": false, @@ -748,9 +676,7 @@ }, { "keyName": "promotion_rule_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -785,10 +711,7 @@ "indexes": [ { "keyName": "promotion_promotion_rule_pkey", - "columnNames": [ - "promotion_id", - "promotion_rule_id" - ], + "columnNames": ["promotion_id", "promotion_rule_id"], "composite": true, "primary": true, "unique": true @@ -798,26 +721,18 @@ "foreignKeys": { "promotion_promotion_rule_promotion_id_foreign": { "constraintName": "promotion_promotion_rule_promotion_id_foreign", - "columnNames": [ - "promotion_id" - ], + "columnNames": ["promotion_id"], "localTableName": "public.promotion_promotion_rule", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion", "deleteRule": "cascade", "updateRule": "cascade" }, "promotion_promotion_rule_promotion_rule_id_foreign": { "constraintName": "promotion_promotion_rule_promotion_rule_id_foreign", - "columnNames": [ - "promotion_rule_id" - ], + "columnNames": ["promotion_rule_id"], "localTableName": "public.promotion_promotion_rule", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_rule", "deleteRule": "cascade", "updateRule": "cascade" @@ -850,10 +765,7 @@ "indexes": [ { "keyName": "application_method_target_rules_pkey", - "columnNames": [ - "application_method_id", - "promotion_rule_id" - ], + "columnNames": ["application_method_id", "promotion_rule_id"], "composite": true, "primary": true, "unique": true @@ -863,26 +775,18 @@ "foreignKeys": { "application_method_target_rules_application_method_id_foreign": { "constraintName": "application_method_target_rules_application_method_id_foreign", - "columnNames": [ - "application_method_id" - ], + "columnNames": ["application_method_id"], "localTableName": "public.application_method_target_rules", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_application_method", "deleteRule": "cascade", "updateRule": "cascade" }, "application_method_target_rules_promotion_rule_id_foreign": { "constraintName": "application_method_target_rules_promotion_rule_id_foreign", - "columnNames": [ - "promotion_rule_id" - ], + "columnNames": ["promotion_rule_id"], "localTableName": "public.application_method_target_rules", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_rule", "deleteRule": "cascade", "updateRule": "cascade" @@ -915,10 +819,7 @@ "indexes": [ { "keyName": "application_method_buy_rules_pkey", - "columnNames": [ - "application_method_id", - "promotion_rule_id" - ], + "columnNames": ["application_method_id", "promotion_rule_id"], "composite": true, "primary": true, "unique": true @@ -928,26 +829,18 @@ "foreignKeys": { "application_method_buy_rules_application_method_id_foreign": { "constraintName": "application_method_buy_rules_application_method_id_foreign", - "columnNames": [ - "application_method_id" - ], + "columnNames": ["application_method_id"], "localTableName": "public.application_method_buy_rules", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_application_method", "deleteRule": "cascade", "updateRule": "cascade" }, "application_method_buy_rules_promotion_rule_id_foreign": { "constraintName": "application_method_buy_rules_promotion_rule_id_foreign", - "columnNames": [ - "promotion_rule_id" - ], + "columnNames": ["promotion_rule_id"], "localTableName": "public.application_method_buy_rules", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_rule", "deleteRule": "cascade", "updateRule": "cascade" @@ -1020,9 +913,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "promotion_rule_id" - ], + "columnNames": ["promotion_rule_id"], "composite": false, "keyName": "IDX_promotion_rule_promotion_rule_value_id", "primary": false, @@ -1030,9 +921,7 @@ }, { "keyName": "promotion_rule_value_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -1042,13 +931,9 @@ "foreignKeys": { "promotion_rule_value_promotion_rule_id_foreign": { "constraintName": "promotion_rule_value_promotion_rule_id_foreign", - "columnNames": [ - "promotion_rule_id" - ], + "columnNames": ["promotion_rule_id"], "localTableName": "public.promotion_rule_value", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.promotion_rule", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/providers/payment-stripe/src/services/index.ts b/packages/modules/providers/payment-stripe/src/services/index.ts index 517e1e5fa0..6a3ccaeb5a 100644 --- a/packages/modules/providers/payment-stripe/src/services/index.ts +++ b/packages/modules/providers/payment-stripe/src/services/index.ts @@ -4,4 +4,3 @@ export { default as StripeGiropayService } from "./stripe-giropay" export { default as StripeIdealService } from "./stripe-ideal" export { default as StripeProviderService } from "./stripe-provider" export { default as StripePrzelewy24Service } from "./stripe-przelewy24" - diff --git a/packages/modules/region/src/migrations/.snapshot-medusa-region.json b/packages/modules/region/src/migrations/.snapshot-medusa-region.json index a2e69d800c..48042b3afc 100644 --- a/packages/modules/region/src/migrations/.snapshot-medusa-region.json +++ b/packages/modules/region/src/migrations/.snapshot-medusa-region.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -90,9 +88,7 @@ "indexes": [ { "keyName": "region_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -212,9 +208,7 @@ }, { "keyName": "region_country_pkey", - "columnNames": [ - "iso_2" - ], + "columnNames": ["iso_2"], "composite": false, "primary": true, "unique": true @@ -224,13 +218,9 @@ "foreignKeys": { "region_country_region_id_foreign": { "constraintName": "region_country_region_id_foreign", - "columnNames": [ - "region_id" - ], + "columnNames": ["region_id"], "localTableName": "public.region_country", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.region", "deleteRule": "set null", "updateRule": "cascade" diff --git a/packages/modules/region/src/services/index.ts b/packages/modules/region/src/services/index.ts index 8cc30b5477..f8d0ebf5d5 100644 --- a/packages/modules/region/src/services/index.ts +++ b/packages/modules/region/src/services/index.ts @@ -1,2 +1 @@ -export { default as RegionModuleService } from "./region-module"; - +export { default as RegionModuleService } from "./region-module" diff --git a/packages/modules/sales-channel/src/migrations/.snapshot-medusa-sales-channel-tst.json b/packages/modules/sales-channel/src/migrations/.snapshot-medusa-sales-channel-tst.json index 8b8535569a..28e401f5f7 100644 --- a/packages/modules/sales-channel/src/migrations/.snapshot-medusa-sales-channel-tst.json +++ b/packages/modules/sales-channel/src/migrations/.snapshot-medusa-sales-channel-tst.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -89,9 +87,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "keyName": "IDX_sales_channel_deleted_at", "primary": false, @@ -99,9 +95,7 @@ }, { "keyName": "sales_channel_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true diff --git a/packages/modules/stock-location-next/src/migrations/.snapshot-medusa-stock-location.json b/packages/modules/stock-location-next/src/migrations/.snapshot-medusa-stock-location.json index 14628770a4..e12721eec8 100644 --- a/packages/modules/stock-location-next/src/migrations/.snapshot-medusa-stock-location.json +++ b/packages/modules/stock-location-next/src/migrations/.snapshot-medusa-stock-location.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -134,9 +132,7 @@ "indexes": [ { "keyName": "IDX_stock_location_address_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -144,9 +140,7 @@ }, { "keyName": "stock_location_address_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -231,9 +225,7 @@ "indexes": [ { "keyName": "IDX_stock_location_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -241,9 +233,7 @@ }, { "keyName": "stock_location_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -253,13 +243,9 @@ "foreignKeys": { "stock_location_address_id_foreign": { "constraintName": "stock_location_address_id_foreign", - "columnNames": [ - "address_id" - ], + "columnNames": ["address_id"], "localTableName": "public.stock_location", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.stock_location_address", "deleteRule": "set null", "updateRule": "cascade" diff --git a/packages/modules/stock-location-next/src/migrations/Migration20240307161216.ts b/packages/modules/stock-location-next/src/migrations/Migration20240307161216.ts index ca82b0db33..65a2768bb2 100644 --- a/packages/modules/stock-location-next/src/migrations/Migration20240307161216.ts +++ b/packages/modules/stock-location-next/src/migrations/Migration20240307161216.ts @@ -1,23 +1,33 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240307161216 extends Migration { - async up(): Promise { - this.addSql('create table if not exists "stock_location_address" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "address_1" text not null, "address_2" text null, "company" text null, "city" text null, "country_code" text not null, "phone" text null, "province" text null, "postal_code" text null, "metadata" jsonb null, constraint "stock_location_address_pkey" primary key ("id"));'); - this.addSql('CREATE INDEX IF NOT EXISTS "IDX_stock_location_address_deleted_at" ON "stock_location_address" (deleted_at) WHERE deleted_at IS NOT NULL;'); + this.addSql( + 'create table if not exists "stock_location_address" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "address_1" text not null, "address_2" text null, "company" text null, "city" text null, "country_code" text not null, "phone" text null, "province" text null, "postal_code" text null, "metadata" jsonb null, constraint "stock_location_address_pkey" primary key ("id"));' + ) + this.addSql( + 'CREATE INDEX IF NOT EXISTS "IDX_stock_location_address_deleted_at" ON "stock_location_address" (deleted_at) WHERE deleted_at IS NOT NULL;' + ) - this.addSql('create table if not exists "stock_location" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "name" text not null, "address_id" text null, "metadata" jsonb null, constraint "stock_location_pkey" primary key ("id"));'); - this.addSql('CREATE INDEX IF NOT EXISTS "IDX_stock_location_deleted_at" ON "stock_location" (deleted_at) WHERE deleted_at IS NOT NULL;'); + this.addSql( + 'create table if not exists "stock_location" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "name" text not null, "address_id" text null, "metadata" jsonb null, constraint "stock_location_pkey" primary key ("id"));' + ) + this.addSql( + 'CREATE INDEX IF NOT EXISTS "IDX_stock_location_deleted_at" ON "stock_location" (deleted_at) WHERE deleted_at IS NOT NULL;' + ) - this.addSql('alter table if exists "stock_location" add constraint "stock_location_address_id_foreign" foreign key ("address_id") references "stock_location_address" ("id") on update cascade on delete set null;'); + this.addSql( + 'alter table if exists "stock_location" add constraint "stock_location_address_id_foreign" foreign key ("address_id") references "stock_location_address" ("id") on update cascade on delete set null;' + ) } async down(): Promise { - this.addSql('alter table if exists "stock_location" drop constraint if exists "stock_location_address_id_foreign";'); + this.addSql( + 'alter table if exists "stock_location" drop constraint if exists "stock_location_address_id_foreign";' + ) - this.addSql('drop table if exists "stock_location_address" cascade;'); + this.addSql('drop table if exists "stock_location_address" cascade;') - this.addSql('drop table if exists "stock_location" cascade;'); + this.addSql('drop table if exists "stock_location" cascade;') } - } diff --git a/packages/modules/store/src/migrations/.snapshot-medusa-store.json b/packages/modules/store/src/migrations/.snapshot-medusa-store.json index fc1df79d3e..a1b4e14977 100644 --- a/packages/modules/store/src/migrations/.snapshot-medusa-store.json +++ b/packages/modules/store/src/migrations/.snapshot-medusa-store.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -99,9 +97,7 @@ "indexes": [ { "keyName": "IDX_store_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -109,9 +105,7 @@ }, { "keyName": "store_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -197,9 +191,7 @@ "indexes": [ { "keyName": "IDX_store_currency_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -207,9 +199,7 @@ }, { "keyName": "store_currency_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -219,13 +209,9 @@ "foreignKeys": { "store_currency_store_id_foreign": { "constraintName": "store_currency_store_id_foreign", - "columnNames": [ - "store_id" - ], + "columnNames": ["store_id"], "localTableName": "public.store_currency", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.store", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/tax/src/loaders/providers.ts b/packages/modules/tax/src/loaders/providers.ts index ef59cecd3e..9c6268e6d8 100644 --- a/packages/modules/tax/src/loaders/providers.ts +++ b/packages/modules/tax/src/loaders/providers.ts @@ -5,7 +5,7 @@ import { ModuleProvider, ModulesSdkTypes, } from "@medusajs/framework/types" -import { Lifetime, asFunction } from "awilix" +import { asFunction, Lifetime } from "awilix" import * as providers from "../providers" diff --git a/packages/modules/tax/src/migrations/.snapshot-medusa-tax.json b/packages/modules/tax/src/migrations/.snapshot-medusa-tax.json index bf78915d63..0c76f681c9 100644 --- a/packages/modules/tax/src/migrations/.snapshot-medusa-tax.json +++ b/packages/modules/tax/src/migrations/.snapshot-medusa-tax.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -31,9 +29,7 @@ "indexes": [ { "keyName": "tax_provider_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -144,9 +140,7 @@ "schema": "public", "indexes": [ { - "columnNames": [ - "parent_id" - ], + "columnNames": ["parent_id"], "composite": false, "keyName": "IDX_tax_region_parent_id", "primary": false, @@ -154,9 +148,7 @@ }, { "keyName": "IDX_tax_region_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -180,9 +172,7 @@ }, { "keyName": "tax_region_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -203,26 +193,18 @@ "foreignKeys": { "tax_region_provider_id_foreign": { "constraintName": "tax_region_provider_id_foreign", - "columnNames": [ - "provider_id" - ], + "columnNames": ["provider_id"], "localTableName": "public.tax_region", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.tax_provider", "deleteRule": "set null", "updateRule": "cascade" }, "tax_region_parent_id_foreign": { "constraintName": "tax_region_parent_id_foreign", - "columnNames": [ - "parent_id" - ], + "columnNames": ["parent_id"], "localTableName": "public.tax_region", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.tax_region", "deleteRule": "cascade", "updateRule": "cascade" @@ -352,9 +334,7 @@ "indexes": [ { "keyName": "IDX_tax_rate_tax_region_id", - "columnNames": [ - "tax_region_id" - ], + "columnNames": ["tax_region_id"], "composite": false, "primary": false, "unique": false, @@ -362,9 +342,7 @@ }, { "keyName": "IDX_tax_rate_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -380,9 +358,7 @@ }, { "keyName": "tax_rate_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -392,13 +368,9 @@ "foreignKeys": { "tax_rate_tax_region_id_foreign": { "constraintName": "tax_rate_tax_region_id_foreign", - "columnNames": [ - "tax_region_id" - ], + "columnNames": ["tax_region_id"], "localTableName": "public.tax_rate", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.tax_region", "deleteRule": "cascade", "updateRule": "cascade" @@ -499,9 +471,7 @@ "indexes": [ { "keyName": "IDX_tax_rate_rule_tax_rate_id", - "columnNames": [ - "tax_rate_id" - ], + "columnNames": ["tax_rate_id"], "composite": false, "primary": false, "unique": false, @@ -509,9 +479,7 @@ }, { "keyName": "IDX_tax_rate_rule_reference_id", - "columnNames": [ - "reference_id" - ], + "columnNames": ["reference_id"], "composite": false, "primary": false, "unique": false, @@ -519,9 +487,7 @@ }, { "keyName": "IDX_tax_rate_rule_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -537,9 +503,7 @@ }, { "keyName": "tax_rate_rule_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -549,13 +513,9 @@ "foreignKeys": { "tax_rate_rule_tax_rate_id_foreign": { "constraintName": "tax_rate_rule_tax_rate_id_foreign", - "columnNames": [ - "tax_rate_id" - ], + "columnNames": ["tax_rate_id"], "localTableName": "public.tax_rate_rule", - "referencedColumnNames": [ - "id" - ], + "referencedColumnNames": ["id"], "referencedTableName": "public.tax_rate", "deleteRule": "cascade", "updateRule": "cascade" diff --git a/packages/modules/tax/src/migrations/Migration20240710135844.ts b/packages/modules/tax/src/migrations/Migration20240710135844.ts index dc889699e7..93e1b299b2 100644 --- a/packages/modules/tax/src/migrations/Migration20240710135844.ts +++ b/packages/modules/tax/src/migrations/Migration20240710135844.ts @@ -1,17 +1,27 @@ -import { Migration } from '@mikro-orm/migrations'; +import { Migration } from "@mikro-orm/migrations" export class Migration20240710135844 extends Migration { - async up(): Promise { - this.addSql('drop index if exists "IDX_tax_region_unique_country_province";'); - this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code) WHERE deleted_at IS NULL;'); - this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_nullable_province" ON "tax_region" (country_code) WHERE province_code IS NULL AND deleted_at IS NULL;'); + this.addSql( + 'drop index if exists "IDX_tax_region_unique_country_province";' + ) + this.addSql( + 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code) WHERE deleted_at IS NULL;' + ) + this.addSql( + 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_nullable_province" ON "tax_region" (country_code) WHERE province_code IS NULL AND deleted_at IS NULL;' + ) } async down(): Promise { - this.addSql('drop index if exists "IDX_tax_region_unique_country_province";'); - this.addSql('drop index if exists "IDX_tax_region_unique_country_nullable_province";'); - this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code);'); + this.addSql( + 'drop index if exists "IDX_tax_region_unique_country_province";' + ) + this.addSql( + 'drop index if exists "IDX_tax_region_unique_country_nullable_province";' + ) + this.addSql( + 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code);' + ) } - } diff --git a/packages/modules/tax/src/migrations/Migration20240924114005.ts b/packages/modules/tax/src/migrations/Migration20240924114005.ts index fe9ff8d0b2..fce6b6ed7e 100644 --- a/packages/modules/tax/src/migrations/Migration20240924114005.ts +++ b/packages/modules/tax/src/migrations/Migration20240924114005.ts @@ -2,9 +2,7 @@ import { Migration } from "@mikro-orm/migrations" export class Migration20240924114005 extends Migration { async up(): Promise { - this.addSql( - `UPDATE "tax_rate" SET code = 'default' WHERE code IS NULL;` - ) + this.addSql(`UPDATE "tax_rate" SET code = 'default' WHERE code IS NULL;`) this.addSql( `ALTER TABLE IF EXISTS "tax_rate" ALTER COLUMN "code" SET NOT NULL;` ) diff --git a/packages/modules/tax/src/models/tax-rate-rule.ts b/packages/modules/tax/src/models/tax-rate-rule.ts index a27fa65086..a76b940f58 100644 --- a/packages/modules/tax/src/models/tax-rate-rule.ts +++ b/packages/modules/tax/src/models/tax-rate-rule.ts @@ -1,7 +1,7 @@ import { DAL } from "@medusajs/framework/types" import { - DALUtils, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, } from "@medusajs/framework/utils" import { diff --git a/packages/modules/tax/src/models/tax-region.ts b/packages/modules/tax/src/models/tax-region.ts index 95b7c5f832..65afb90097 100644 --- a/packages/modules/tax/src/models/tax-region.ts +++ b/packages/modules/tax/src/models/tax-region.ts @@ -1,9 +1,9 @@ import { DAL } from "@medusajs/framework/types" import { - DALUtils, - Searchable, createPsqlIndexStatementHelper, + DALUtils, generateEntityId, + Searchable, } from "@medusajs/framework/utils" import { BeforeCreate, @@ -13,8 +13,8 @@ import { Entity, Filter, ManyToOne, - OnInit, OneToMany, + OnInit, OptionalProps, PrimaryKey, Property, diff --git a/packages/modules/user/src/migrations/.snapshot-medusa-user.json b/packages/modules/user/src/migrations/.snapshot-medusa-user.json index bde5888069..b6643bf04d 100644 --- a/packages/modules/user/src/migrations/.snapshot-medusa-user.json +++ b/packages/modules/user/src/migrations/.snapshot-medusa-user.json @@ -1,7 +1,5 @@ { - "namespaces": [ - "public" - ], + "namespaces": ["public"], "name": "public", "tables": [ { @@ -100,9 +98,7 @@ "indexes": [ { "keyName": "IDX_invite_email", - "columnNames": [ - "email" - ], + "columnNames": ["email"], "composite": false, "primary": false, "unique": false, @@ -110,9 +106,7 @@ }, { "keyName": "IDX_invite_token", - "columnNames": [ - "token" - ], + "columnNames": ["token"], "composite": false, "primary": false, "unique": false, @@ -120,9 +114,7 @@ }, { "keyName": "IDX_invite_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -130,9 +122,7 @@ }, { "keyName": "invite_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true @@ -235,9 +225,7 @@ "indexes": [ { "keyName": "IDX_user_email", - "columnNames": [ - "email" - ], + "columnNames": ["email"], "composite": false, "primary": false, "unique": false, @@ -245,9 +233,7 @@ }, { "keyName": "IDX_user_deleted_at", - "columnNames": [ - "deleted_at" - ], + "columnNames": ["deleted_at"], "composite": false, "primary": false, "unique": false, @@ -255,9 +241,7 @@ }, { "keyName": "user_pkey", - "columnNames": [ - "id" - ], + "columnNames": ["id"], "composite": false, "primary": true, "unique": true diff --git a/yarn.lock b/yarn.lock index d6835ef30d..77df120a5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5662,6 +5662,7 @@ __metadata: "@mikro-orm/postgresql": 5.9.7 "@swc/core": ^1.7.28 "@swc/jest": ^0.2.36 + "@types/express": ^4.17.17 "@types/yargs": ^15.0.15 awilix: ^8.0.1 chalk: ^4.0.0 @@ -24359,6 +24360,7 @@ __metadata: "@mikro-orm/knex": 5.9.7 "@mikro-orm/migrations": 5.9.7 "@mikro-orm/postgresql": 5.9.7 + "@types/express": ^4.17.17 awilix: ^8.0.1 axios: ^0.21.4 express: ^4.21.0