@open-mercato/core 0.6.6-develop.6296.1.5e8bdfee17 → 0.6.6-develop.6300.1.08ff40c897

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.
Files changed (36) hide show
  1. package/AGENTS.md +8 -0
  2. package/dist/generated/entities/module_config/index.js +4 -0
  3. package/dist/generated/entities/module_config/index.js.map +2 -2
  4. package/dist/generated/entity-fields-registry.js +2 -0
  5. package/dist/generated/entity-fields-registry.js.map +2 -2
  6. package/dist/modules/auth/lib/setup-app.js +1 -1
  7. package/dist/modules/auth/lib/setup-app.js.map +2 -2
  8. package/dist/modules/configs/data/entities.js +15 -1
  9. package/dist/modules/configs/data/entities.js.map +2 -2
  10. package/dist/modules/configs/lib/module-config-service.js +52 -19
  11. package/dist/modules/configs/lib/module-config-service.js.map +3 -3
  12. package/dist/modules/configs/migrations/Migration20260617150000.js +21 -0
  13. package/dist/modules/configs/migrations/Migration20260617150000.js.map +7 -0
  14. package/dist/modules/customers/api/activities/route.js.map +2 -2
  15. package/dist/modules/customers/backend/customers/deals/pipeline/page.js +26 -22
  16. package/dist/modules/customers/backend/customers/deals/pipeline/page.js.map +2 -2
  17. package/dist/modules/customers/components/detail/CompanyKpiBar.js +8 -7
  18. package/dist/modules/customers/components/detail/CompanyKpiBar.js.map +2 -2
  19. package/dist/modules/customers/components/detail/CompanyPeopleSection.js +6 -5
  20. package/dist/modules/customers/components/detail/CompanyPeopleSection.js.map +2 -2
  21. package/generated/entities/module_config/index.ts +2 -0
  22. package/generated/entity-fields-registry.ts +2 -0
  23. package/package.json +7 -7
  24. package/src/modules/auth/lib/setup-app.ts +1 -1
  25. package/src/modules/configs/data/entities.ts +17 -1
  26. package/src/modules/configs/lib/module-config-service.ts +83 -24
  27. package/src/modules/configs/migrations/.snapshot-open-mercato.json +41 -4
  28. package/src/modules/configs/migrations/.snapshot-openmercato.json +41 -4
  29. package/src/modules/configs/migrations/Migration20260617150000.ts +21 -0
  30. package/src/modules/customers/api/activities/route.ts +6 -0
  31. package/src/modules/customers/backend/customers/deals/pipeline/page.tsx +29 -22
  32. package/src/modules/customers/components/detail/CompanyKpiBar.tsx +8 -7
  33. package/src/modules/customers/components/detail/CompanyPeopleSection.tsx +6 -5
  34. package/dist/modules/customers/components/detail/CompanyDashboardTab.js +0 -133
  35. package/dist/modules/customers/components/detail/CompanyDashboardTab.js.map +0 -7
  36. package/src/modules/customers/components/detail/CompanyDashboardTab.tsx +0 -161
package/AGENTS.md CHANGED
@@ -703,3 +703,11 @@ When the opt-in CRUD list cache (`ENABLE_CRUD_API_CACHE`) is enabled, the factor
703
703
  ## Upgrade Actions
704
704
 
705
705
  Declare once per version in `src/modules/configs/lib/upgrade-actions.ts`. Keep them idempotent, reuse module helpers. Access guarded by `configs.manage`.
706
+
707
+ ## Module Config (tenant scope)
708
+
709
+ `ModuleConfigService` (`src/modules/configs/lib/module-config-service.ts`) stores per-module key/value config in `module_configs`. Every method accepts an **optional** `scope: { tenantId?; organizationId? }`:
710
+
711
+ - **Reads** with a `tenantId` resolve scoped row → global row (`tenant_id IS NULL`) → not found; the returned record carries `source: 'tenant' | 'instance'`. Reads without a scope read the global row (unchanged legacy behavior).
712
+ - **Writes** with a `tenantId` create/update only that tenant's row and never touch the global row; writes without a scope update the global/instance row.
713
+ - Always derive `tenantId` from the authenticated context, never from request input. Omit `scope` for genuinely instance-global config so existing callers are unaffected (the no-scope path is byte-for-byte the prior behavior). `module_configs` uses partial unique indexes (global `WHERE tenant_id IS NULL`, scoped `WHERE tenant_id IS NOT NULL`) — never reintroduce a single `(module_id, name)` unique constraint.
@@ -2,6 +2,8 @@ const id = "id";
2
2
  const module_id = "module_id";
3
3
  const name = "name";
4
4
  const value_json = "value_json";
5
+ const organization_id = "organization_id";
6
+ const tenant_id = "tenant_id";
5
7
  const created_at = "created_at";
6
8
  const updated_at = "updated_at";
7
9
  export {
@@ -9,6 +11,8 @@ export {
9
11
  id,
10
12
  module_id,
11
13
  name,
14
+ organization_id,
15
+ tenant_id,
12
16
  updated_at,
13
17
  value_json
14
18
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../generated/entities/module_config/index.ts"],
4
- "sourcesContent": ["export const id = \"id\";\nexport const module_id = \"module_id\";\nexport const name = \"name\";\nexport const value_json = \"value_json\";\nexport const created_at = \"created_at\";\nexport const updated_at = \"updated_at\";\n"],
5
- "mappings": "AAAO,MAAM,KAAK;AACX,MAAM,YAAY;AAClB,MAAM,OAAO;AACb,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;",
4
+ "sourcesContent": ["export const id = \"id\";\nexport const module_id = \"module_id\";\nexport const name = \"name\";\nexport const value_json = \"value_json\";\nexport const organization_id = \"organization_id\";\nexport const tenant_id = \"tenant_id\";\nexport const created_at = \"created_at\";\nexport const updated_at = \"updated_at\";\n"],
5
+ "mappings": "AAAO,MAAM,KAAK;AACX,MAAM,YAAY;AAClB,MAAM,OAAO;AACb,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,YAAY;AAClB,MAAM,aAAa;AACnB,MAAM,aAAa;",
6
6
  "names": []
7
7
  }
@@ -1539,6 +1539,8 @@ const entityFieldsRegistry = {
1539
1539
  "module_id": "module_id",
1540
1540
  "name": "name",
1541
1541
  "value_json": "value_json",
1542
+ "organization_id": "organization_id",
1543
+ "tenant_id": "tenant_id",
1542
1544
  "created_at": "created_at",
1543
1545
  "updated_at": "updated_at"
1544
1546
  },