diff --git a/.changeset/fix-collection-store-circular-type.md b/.changeset/fix-collection-store-circular-type.md new file mode 100644 index 0000000000..14fbb3ebaf --- /dev/null +++ b/.changeset/fix-collection-store-circular-type.md @@ -0,0 +1,5 @@ +--- +"@medusajs/types": patch +--- + +fix(types): resolve circular type reference in StoreCollectionListParams interface diff --git a/packages/core/js-sdk/src/store/index.ts b/packages/core/js-sdk/src/store/index.ts index 38339e7942..a108e1f8c0 100644 --- a/packages/core/js-sdk/src/store/index.ts +++ b/packages/core/js-sdk/src/store/index.ts @@ -184,7 +184,7 @@ export class Store { * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations). */ list: async ( - query?: FindParams & HttpTypes.StoreCollectionFilters, + query?: FindParams & HttpTypes.StoreCollectionListParams, headers?: ClientHeaders ) => { return this.client.fetch( @@ -478,7 +478,7 @@ export class Store { /** * Related guides: [How to implement carts in the storefront](https://docs.medusajs.com/resources/storefront-development/cart). - * + * * @tags cart */ public cart = { diff --git a/packages/core/types/src/http/collection/store/queries.ts b/packages/core/types/src/http/collection/store/queries.ts index 0dfa10a564..42025198d9 100644 --- a/packages/core/types/src/http/collection/store/queries.ts +++ b/packages/core/types/src/http/collection/store/queries.ts @@ -1,5 +1,6 @@ -import { BaseCollectionListParams } from "../common" +import { BaseCollectionListParams, BaseCollectionParams } from "../common" -export interface StoreCollectionFilters - extends Omit { -} +export interface StoreCollectionListParams + extends Omit {} + +export interface StoreCollectionParams extends BaseCollectionParams {} diff --git a/packages/medusa/src/api/store/collections/route.ts b/packages/medusa/src/api/store/collections/route.ts index 64535999a7..85280ae77f 100644 --- a/packages/medusa/src/api/store/collections/route.ts +++ b/packages/medusa/src/api/store/collections/route.ts @@ -10,7 +10,7 @@ import { } from "@medusajs/framework/utils" export const GET = async ( - req: AuthenticatedMedusaRequest, + req: AuthenticatedMedusaRequest, res: MedusaResponse ) => { const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) diff --git a/packages/medusa/src/api/store/collections/validators.ts b/packages/medusa/src/api/store/collections/validators.ts index 625f43d6ef..f38a515159 100644 --- a/packages/medusa/src/api/store/collections/validators.ts +++ b/packages/medusa/src/api/store/collections/validators.ts @@ -10,6 +10,7 @@ export const StoreGetCollectionParams = createSelectParams() export const StoreGetCollectionsParamsFields = z.object({ q: z.string().optional(), + id: z.union([z.string(), z.array(z.string())]).optional(), title: z.union([z.string(), z.array(z.string())]).optional(), handle: z.union([z.string(), z.array(z.string())]).optional(), created_at: createOperatorMap().optional(),