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.44

vholik25b29710996f
diff --git a/bun.lock b/bun.lock
index 5cfd9f54f..88f13db26 100644
--- a/bun.lock
+++ b/bun.lock
@@ -78,7 +78,7 @@
},
"packages/admin": {
"name": "@mercurjs/admin",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"dependencies": {
"@ariakit/react": "^0.4.15",
"@babel/runtime": "^7.26.10",
@@ -138,7 +138,7 @@
},
"packages/cli": {
"name": "@mercurjs/cli",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"bin": {
"mercurjs": "./dist/index.js",
},
@@ -178,7 +178,7 @@
},
"packages/client": {
"name": "@mercurjs/client",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"dependencies": {
"@tanstack/react-query": "^5.64.2",
"qs": "^6.12.1",
@@ -195,7 +195,7 @@
},
"packages/core-plugin": {
"name": "@mercurjs/core-plugin",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"devDependencies": {
"@medusajs/cli": "^2.13.3",
"@medusajs/core-flows": "^2.13.3",
@@ -234,7 +234,7 @@
},
"packages/dashboard-sdk": {
"name": "@mercurjs/dashboard-sdk",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"dependencies": {
"esbuild-register": "^3.6.0",
},
@@ -248,7 +248,7 @@
},
"packages/dashboard-shared": {
"name": "@mercurjs/dashboard-shared",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"dependencies": {
"@ariakit/react": "^0.4.15",
"@babel/runtime": "^7.26.10",
@@ -338,7 +338,7 @@
},
"packages/types": {
"name": "@mercurjs/types",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"dependencies": {
"@medusajs/types": "2.13.3",
},
@@ -348,7 +348,7 @@
},
"packages/vendor": {
"name": "@mercurjs/vendor",
- "version": "2.0.0-canary.41",
+ "version": "2.0.0-canary.43",
"dependencies": {
"@ariakit/react": "^0.4.15",
"@babel/runtime": "^7.26.10",
diff --git a/packages/admin/package.json b/packages/admin/package.json
index 156fbcb15..83f780322 100644
--- a/packages/admin/package.json
+++ b/packages/admin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/admin",
- "version": "2.0.0-canary.43",
+ "version": "2.0.0-canary.44",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 63e9dd610..dd6eefc85 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/cli",
- "version": "2.0.0-canary.43",
+ "version": "2.0.0-canary.44",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/client/package.json b/packages/client/package.json
index 4cc816657..ca094e754 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/client",
- "version": "2.0.0-canary.43",
+ "version": "2.0.0-canary.44",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/core-plugin/package.json b/packages/core-plugin/package.json
index 872dc50f1..ce3b25155 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.43",
+ "version": "2.0.0-canary.44",
"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 5999439fe..11845f419 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
@@ -103,14 +103,14 @@ export default class CustomFieldsModuleService {
async create(
alias: string,
- data: { id: string;[key: string]: unknown }[]
+ data: { id: string;[key: string]: unknown } | { id: string;[key: string]: unknown }[]
) {
+ const items = Array.isArray(data) ? data : [data];
const snakeEntity = this.resolveAlias_(alias);
const tableName = compressName(`${snakeEntity}_custom_fields`);
const knex = this.pgConnection_;
-
- const rows = data.map((entry) => {
+ const rows = items.map((entry) => {
const { id, ...fields } = entry
return {
...fields,
@@ -128,34 +128,36 @@ export default class CustomFieldsModuleService {
async update(
alias: string,
- data: { id: string;[key: string]: unknown }[],
+ data: { id: string;[key: string]: unknown } | { id: string;[key: string]: unknown }[],
) {
+ const items = Array.isArray(data) ? data : [data];
const snakeEntity = this.resolveAlias_(alias);
const tableName = compressName(`${snakeEntity}_custom_fields`);
const knex = this.pgConnection_;
await knex.transaction(async (trx) => {
- for (const { id, ...fields } of data) {
+ for (const { id, ...fields } of items) {
await trx(tableName)
.where(`${snakeEntity + '_id'}`, id)
.update({ ...fields, updated_at: new Date() });
}
});
- return data;
+ return items;
}
async delete(
alias: string,
- ids: string[],
+ ids: string | string[],
) {
+ const items = Array.isArray(ids) ? ids : [ids];
const snakeEntity = this.resolveAlias_(alias);
const tableName = compressName(`${snakeEntity}_custom_fields`);
const knex = this.pgConnection_;
await knex.transaction(async (trx) => {
await trx(tableName)
- .whereIn('id', ids)
+ .whereIn('id', items)
.update({ deleted_at: new Date() });
});
}
diff --git a/packages/core-plugin/src/modules/custom-fields/utils/generate-entity.ts b/packages/core-plugin/src/modules/custom-fields/utils/generate-entity.ts
index 4d30035cf..0b0771ea2 100644
--- a/packages/core-plugin/src/modules/custom-fields/utils/generate-entity.ts
+++ b/packages/core-plugin/src/modules/custom-fields/utils/generate-entity.ts
@@ -123,6 +123,12 @@ export function generateEntity(
properties: ["deleted_at"],
name: "IDX_deleted_at_" + hashTableName,
},
+ {
+ properties: [foreignKeyName as EntityKey<{ id: any; } & { deleted_at: any; }, false>],
+ name: "IDX_unique_" + hashTableName,
+ options: { unique: true },
+ expression: `CREATE UNIQUE INDEX IF NOT EXISTS "IDX_unique_${hashTableName}" ON "${compressed}" ("${foreignKeyName}") WHERE "deleted_at" IS NULL`,
+ },
],
})
}
diff --git a/packages/dashboard-sdk/package.json b/packages/dashboard-sdk/package.json
index 02c177a7e..37b5533cf 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.43",
+ "version": "2.0.0-canary.44",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/dashboard-shared/package.json b/packages/dashboard-shared/package.json
index 0b0e7b3c0..e882f5a65 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.43",
+ "version": "2.0.0-canary.44",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/types/package.json b/packages/types/package.json
index e2469eda6..fc05d10ca 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/types",
- "version": "2.0.0-canary.43",
+ "version": "2.0.0-canary.44",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/vendor/package.json b/packages/vendor/package.json
index 7161844fa..066bfcf17 100644
--- a/packages/vendor/package.json
+++ b/packages/vendor/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/vendor",
- "version": "2.0.0-canary.43",
+ "version": "2.0.0-canary.44",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",