Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: map container types for core services to interface #11295

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

thetutlage
Copy link
Contributor

@thetutlage thetutlage commented Feb 4, 2025

Improves intellisense for service methods to retrieve, list and count entities via the auto-generated methods from DML.

Also, updates the container types generation to point to interface for core services. This way, we get accurate intellisense.

Fixes: FRMW-2902


Sample container types output.

import type { ICacheService } from '@medusajs/framework/types'
import type { IEventBusModuleService } from '@medusajs/framework/types'
import type { IWorkflowEngineService } from '@medusajs/framework/types'
import type { ILockingModule } from '@medusajs/framework/types'
import type { IStockLocationService } from '@medusajs/framework/types'
import type { IInventoryService } from '@medusajs/framework/types'
import type { IProductModuleService } from '@medusajs/framework/types'
import type { IPricingModuleService } from '@medusajs/framework/types'
import type { IPromotionModuleService } from '@medusajs/framework/types'
import type { ICustomerModuleService } from '@medusajs/framework/types'
import type { ISalesChannelModuleService } from '@medusajs/framework/types'
import type { ICartModuleService } from '@medusajs/framework/types'
import type { IRegionModuleService } from '@medusajs/framework/types'
import type { IApiKeyModuleService } from '@medusajs/framework/types'
import type { IStoreModuleService } from '@medusajs/framework/types'
import type { ITaxModuleService } from '@medusajs/framework/types'
import type { ICurrencyModuleService } from '@medusajs/framework/types'
import type { IPaymentModuleService } from '@medusajs/framework/types'
import type { IOrderModuleService } from '@medusajs/framework/types'
import type { IAuthModuleService } from '@medusajs/framework/types'
import type { IUserModuleService } from '@medusajs/framework/types'
import type { IFileModuleService } from '@medusajs/framework/types'
import type { IFulfillmentModuleService } from '@medusajs/framework/types'
import type { INotificationModuleService } from '@medusajs/framework/types'
import type Blog from '@blog/index'

declare module '@medusajs/framework/types' {
  interface ModuleImplementations {
    cache: ICacheService,
    event_bus: IEventBusModuleService,
    workflows: IWorkflowEngineService,
    locking: ILockingModule,
    stock_location: IStockLocationService,
    inventory: IInventoryService,
    product: IProductModuleService,
    pricing: IPricingModuleService,
    promotion: IPromotionModuleService,
    customer: ICustomerModuleService,
    sales_channel: ISalesChannelModuleService,
    cart: ICartModuleService,
    region: IRegionModuleService,
    api_key: IApiKeyModuleService,
    store: IStoreModuleService,
    tax: ITaxModuleService,
    currency: ICurrencyModuleService,
    payment: IPaymentModuleService,
    order: IOrderModuleService,
    auth: IAuthModuleService,
    user: IUserModuleService,
    file: IFileModuleService,
    fulfillment: IFulfillmentModuleService,
    notification: INotificationModuleService,
    blog: InstanceType<(typeof Blog)['service']>
  }
}

@thetutlage thetutlage requested a review from a team as a code owner February 4, 2025 08:01
Copy link

vercel bot commented Feb 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 4, 2025 8:51am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Feb 4, 2025 8:51am
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Feb 4, 2025 8:51am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Feb 4, 2025 8:51am
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Feb 4, 2025 8:51am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Feb 4, 2025 8:51am
resources-docs ⬜️ Ignored (Inspect) Visit Preview Feb 4, 2025 8:51am

Copy link

changeset-bot bot commented Feb 4, 2025

🦋 Changeset detected

Latest commit: 4f2d69c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 65 packages
Name Type
@medusajs/types Patch
@medusajs/utils Patch
@medusajs/dashboard Patch
integration-tests-http Patch
@medusajs/cli Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/workflow-engine-redis Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/framework Patch
@medusajs/js-sdk Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/workflows-sdk Patch
@medusajs/medusa-oas-cli Patch
@medusajs/oas-github-ci Patch
@medusajs/telemetry Patch
@medusajs/admin-bundler Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
create-medusa-app Patch
medusa-dev-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@thetutlage thetutlage merged commit 3c51709 into develop Feb 4, 2025
23 checks passed
@thetutlage thetutlage deleted the feat/intellisense-improvements branch February 4, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants