@open-mercato/cli 0.6.5-develop.4534.1.b459babe6d → 0.6.5-develop.4559.1.839e136509

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.
@@ -126,7 +126,7 @@ export class <Entity> {
126
126
  - Table name: **plural, snake_case** — matches module ID
127
127
  - PK: always `uuid` with `v4()` default
128
128
  - MUST include `organization_id` + `tenant_id` with `@Index()`
129
- - MUST include `created_at`, `updated_at`, `deleted_at`, `is_active`
129
+ - MUST include `created_at`, `updated_at`, `deleted_at`, `is_active`. The `updated_at` column is what OSS **optimistic locking** (default ON) compares — keep it on every user-editable entity, and make your CRUD GET/list responses return `updatedAt` so the UI can send the expected version.
130
130
  - Entity decorators MUST come from `@mikro-orm/decorators/legacy`
131
131
  - Cross-module references: store FK as `uuid` field (e.g., `customer_id`) — never use ORM `@ManyToOne`
132
132
  - Use `@Property({ type: 'jsonb' })` for flexible/nested data
@@ -234,6 +234,8 @@ export const openApi = {
234
234
 
235
235
  Use `CrudForm` and `DataTable` from `@open-mercato/ui`. See the `backend-ui-design` skill for full component reference.
236
236
 
237
+ > **Optimistic locking (default ON).** `CrudForm` in edit mode auto-derives the expected-version header from `initialValues.updatedAt` and applies it to **both** save and delete — so pass the loaded record's `updatedAt` into `initialValues`. For custom (non-`CrudForm`) list-row deletes or dialog mutations, wrap the call with `withScopedApiRequestHeaders(buildOptimisticLockHeader(record.updatedAt), () => deleteCrud(...))` and surface the 409 with `surfaceRecordConflict(err, t)` from `@open-mercato/ui/backend/conflicts`. Never leave a mutating edit/delete UI without a version header — concurrent edits would silently overwrite.
238
+
237
239
  ### Page Metadata & Sidebar Navigation
238
240
 
239
241
  **File**: `src/modules/<module_id>/backend/page.meta.ts`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/cli",
3
- "version": "0.6.5-develop.4534.1.b459babe6d",
3
+ "version": "0.6.5-develop.4559.1.839e136509",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
@@ -59,8 +59,8 @@
59
59
  "@mikro-orm/decorators": "^7.1.3",
60
60
  "@mikro-orm/migrations": "^7.1.3",
61
61
  "@mikro-orm/postgresql": "^7.1.3",
62
- "@open-mercato/queue": "0.6.5-develop.4534.1.b459babe6d",
63
- "@open-mercato/shared": "0.6.5-develop.4534.1.b459babe6d",
62
+ "@open-mercato/queue": "0.6.5-develop.4559.1.839e136509",
63
+ "@open-mercato/shared": "0.6.5-develop.4559.1.839e136509",
64
64
  "cross-spawn": "^7.0.6",
65
65
  "pg": "8.21.0",
66
66
  "semver": "^7.8.1",
@@ -70,10 +70,10 @@
70
70
  "typescript": "^6.0.3"
71
71
  },
72
72
  "peerDependencies": {
73
- "@open-mercato/shared": "0.6.5-develop.4534.1.b459babe6d"
73
+ "@open-mercato/shared": "0.6.5-develop.4559.1.839e136509"
74
74
  },
75
75
  "devDependencies": {
76
- "@open-mercato/shared": "0.6.5-develop.4534.1.b459babe6d",
76
+ "@open-mercato/shared": "0.6.5-develop.4559.1.839e136509",
77
77
  "@types/jest": "^30.0.0",
78
78
  "jest": "^30.4.2",
79
79
  "ts-jest": "^29.4.11"