Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

chore: v2.0.0-canary.48

vholikafd1dd481445
diff --git a/packages/admin/package.json b/packages/admin/package.json
index 672342333..662c8c239 100644
--- a/packages/admin/package.json
+++ b/packages/admin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/admin",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index a3f88e48b..94118ca79 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/cli",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/client/package.json b/packages/client/package.json
index eeaa505e1..0e58e8550 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/client",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/core-plugin/package.json b/packages/core-plugin/package.json
index efa728105..49ca8a321 100644
--- a/packages/core-plugin/package.json
+++ b/packages/core-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/core-plugin",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/core-plugin/src/modules/custom-fields/services/custom-fields-module-service.ts b/packages/core-plugin/src/modules/custom-fields/services/custom-fields-module-service.ts
index 994fabb84..b30696115 100644
--- a/packages/core-plugin/src/modules/custom-fields/services/custom-fields-module-service.ts
+++ b/packages/core-plugin/src/modules/custom-fields/services/custom-fields-module-service.ts
@@ -62,26 +62,51 @@ export default class CustomFieldsModuleService {
async list(
filter: Record<string, string | string[]>,
config: FindConfig<any>,
+ ): Promise<any[]>;
+ async list(
+ alias: string,
+ filters: Record<string, string | string[]>,
+ config: FindConfig<any>,
+ ): Promise<any[]>;
+
+ async list(
+ filterOrAlias: Record<string, string | string[]> | string,
+ filtersOrConfig: Record<string, string | string[]> | FindConfig<any>,
+ maybeConfig?: FindConfig<any>,
) {
- if (Object.keys(filter).length !== 1) {
- throw new MedusaError(
- MedusaError.Types.INVALID_ARGUMENT,
- "Only single filter is allowed",
- );
+ let alias: string;
+ let filters: Record<string, string | string[]>;
+ let config: FindConfig<any>;
+
+ if (typeof filterOrAlias === "string") {
+ alias = filterOrAlias;
+ filters = filtersOrConfig as Record<string, string | string[]>;
+ config = maybeConfig!;
+ } else {
+ const filter = filterOrAlias;
+ if (Object.keys(filter).length !== 1) {
+ throw new MedusaError(
+ MedusaError.Types.INVALID_ARGUMENT,
+ "Only single filter is allowed",
+ );
+ }
+ const filterKey = Object.keys(filter)[0];
+ alias = filterKey.split("_").slice(0, -1).join("_");
+ filters = filter;
+ config = filtersOrConfig as FindConfig<any>;
}
- const filterKey = Object.keys(filter)[0];
- const filterValue = filter[filterKey];
- const alias = filterKey.split("_").slice(0, -1).join("_");
const tableName = compressName(`${alias}_custom_fields`);
const knex = this.pgConnection_;
const query = knex(tableName).whereNull("deleted_at");
- if (Array.isArray(filterValue)) {
- query.whereIn(filterKey, filterValue);
- } else {
- query.where(filterKey, filterValue);
+ for (const [filterKey, filterValue] of Object.entries(filters)) {
+ if (Array.isArray(filterValue)) {
+ query.whereIn(filterKey, filterValue);
+ } else {
+ query.where(filterKey, filterValue);
+ }
}
if (config.select) {
diff --git a/packages/dashboard-sdk/package.json b/packages/dashboard-sdk/package.json
index d17a16dea..b38eef503 100644
--- a/packages/dashboard-sdk/package.json
+++ b/packages/dashboard-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-sdk",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/dashboard-shared/package.json b/packages/dashboard-shared/package.json
index 3b91a5400..c1c6735f2 100644
--- a/packages/dashboard-shared/package.json
+++ b/packages/dashboard-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-shared",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/types/package.json b/packages/types/package.json
index c18db470d..1e5708ac9 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/types",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/vendor/package.json b/packages/vendor/package.json
index 52a7ec57f..4fe0cae9b 100644
--- a/packages/vendor/package.json
+++ b/packages/vendor/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/vendor",
- "version": "2.0.0-canary.47",
+ "version": "2.0.0-canary.48",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",