@reactionary/medusa 0.7.0 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -139,7 +139,8 @@ class MedusaCategoryCapability extends CategoryCapability {
|
|
|
139
139
|
);
|
|
140
140
|
const result = this.factory.parseCategoryPaginatedResult(
|
|
141
141
|
this.context,
|
|
142
|
-
response
|
|
142
|
+
response,
|
|
143
|
+
payload
|
|
143
144
|
);
|
|
144
145
|
return success(result);
|
|
145
146
|
}
|
|
@@ -158,7 +159,8 @@ class MedusaCategoryCapability extends CategoryCapability {
|
|
|
158
159
|
);
|
|
159
160
|
const result = this.factory.parseCategoryPaginatedResult(
|
|
160
161
|
this.context,
|
|
161
|
-
response
|
|
162
|
+
response,
|
|
163
|
+
payload
|
|
162
164
|
);
|
|
163
165
|
return success(result);
|
|
164
166
|
}
|
|
@@ -26,15 +26,15 @@ class MedusaCategoryFactory {
|
|
|
26
26
|
};
|
|
27
27
|
return this.categorySchema.parse(result);
|
|
28
28
|
}
|
|
29
|
-
parseCategoryPaginatedResult(context, data) {
|
|
29
|
+
parseCategoryPaginatedResult(context, data, query) {
|
|
30
30
|
const items = data.product_categories.map((x) => this.parseCategory(context, x));
|
|
31
31
|
const totalPages = Math.ceil(
|
|
32
|
-
(data.count ?? 0) /
|
|
32
|
+
(data.count ?? 0) / query.paginationOptions.pageSize
|
|
33
33
|
);
|
|
34
|
-
const pageNumber =
|
|
34
|
+
const pageNumber = query.paginationOptions.pageNumber;
|
|
35
35
|
const result = {
|
|
36
36
|
pageNumber,
|
|
37
|
-
pageSize:
|
|
37
|
+
pageSize: query.paginationOptions.pageSize,
|
|
38
38
|
totalCount: data.count,
|
|
39
39
|
totalPages,
|
|
40
40
|
items
|
package/index.js
CHANGED
|
@@ -15,3 +15,6 @@ export * from "./capabilities/product-search.capability.js";
|
|
|
15
15
|
export * from "./capabilities/product-recommendations.capability.js";
|
|
16
16
|
export * from "./capabilities/product-associations.capability.js";
|
|
17
17
|
export * from "./capabilities/profile.capability.js";
|
|
18
|
+
export * from "./capabilities/category.capability.js";
|
|
19
|
+
export * from "./capabilities/checkout.capability.js";
|
|
20
|
+
export * from "./capabilities/product.capability.js";
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/medusa",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@medusajs/js-sdk": "^2.13.3",
|
|
9
|
-
"@reactionary/core": "0.7.
|
|
9
|
+
"@reactionary/core": "0.7.4",
|
|
10
10
|
"debug": "^4.4.3",
|
|
11
11
|
"@medusajs/types": "^2.13.3",
|
|
12
12
|
"zod": "4.1.9",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { StoreProductCategory, StoreProductCategoryListResponse } from '@medusajs/types';
|
|
2
|
-
import { type AnyCategoryPaginatedResultSchema, type AnyCategorySchema, type CategoryFactory, type CategoryPaginatedResultSchema, type CategorySchema, type RequestContext } from '@reactionary/core';
|
|
2
|
+
import { type AnyCategoryPaginatedResultSchema, type AnyCategorySchema, type CategoryFactory, type CategoryPaginatedResultSchema, type CategorySchema, type RequestContext, type CategoryQueryForTopCategories, type CategoryQueryForChildCategories } from '@reactionary/core';
|
|
3
3
|
import type * as z from 'zod';
|
|
4
4
|
export declare class MedusaCategoryFactory<TCategorySchema extends AnyCategorySchema = typeof CategorySchema, TCategoryPaginatedSchema extends AnyCategoryPaginatedResultSchema = typeof CategoryPaginatedResultSchema> implements CategoryFactory<TCategorySchema, TCategoryPaginatedSchema> {
|
|
5
5
|
readonly categorySchema: TCategorySchema;
|
|
6
6
|
readonly categoryPaginatedResultSchema: TCategoryPaginatedSchema;
|
|
7
7
|
constructor(categorySchema: TCategorySchema, categoryPaginatedResultSchema: TCategoryPaginatedSchema);
|
|
8
8
|
parseCategory(_context: RequestContext, data: StoreProductCategory): z.output<TCategorySchema>;
|
|
9
|
-
parseCategoryPaginatedResult(context: RequestContext, data: StoreProductCategoryListResponse): z.output<TCategoryPaginatedSchema>;
|
|
9
|
+
parseCategoryPaginatedResult(context: RequestContext, data: StoreProductCategoryListResponse, query: CategoryQueryForTopCategories | CategoryQueryForChildCategories): z.output<TCategoryPaginatedSchema>;
|
|
10
10
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -15,3 +15,6 @@ export * from './capabilities/product-search.capability.js';
|
|
|
15
15
|
export * from './capabilities/product-recommendations.capability.js';
|
|
16
16
|
export * from './capabilities/product-associations.capability.js';
|
|
17
17
|
export * from './capabilities/profile.capability.js';
|
|
18
|
+
export * from './capabilities/category.capability.js';
|
|
19
|
+
export * from './capabilities/checkout.capability.js';
|
|
20
|
+
export * from './capabilities/product.capability.js';
|