@open-mercato/core 0.6.2-develop.3406.1.2b403f40da → 0.6.2-develop.3446.1.bd060c6017

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 (39) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/generated/entities/entity_index_row/index.js +2 -0
  3. package/dist/generated/entities/entity_index_row/index.js.map +2 -2
  4. package/dist/generated/entity-fields-registry.js +1 -0
  5. package/dist/generated/entity-fields-registry.js.map +2 -2
  6. package/dist/helpers/integration/queue-runner.js +58 -0
  7. package/dist/helpers/integration/queue-runner.js.map +7 -0
  8. package/dist/helpers/integration/queue.js +67 -0
  9. package/dist/helpers/integration/queue.js.map +7 -0
  10. package/dist/helpers/integration/salesUi.js +33 -15
  11. package/dist/helpers/integration/salesUi.js.map +2 -2
  12. package/dist/modules/customers/ai-agents.js +5 -2
  13. package/dist/modules/customers/ai-agents.js.map +2 -2
  14. package/dist/modules/customers/ai-tools/deals-pack.js +52 -8
  15. package/dist/modules/customers/ai-tools/deals-pack.js.map +2 -2
  16. package/dist/modules/customers/ai-tools/types.js.map +2 -2
  17. package/dist/modules/customers/api/people/[id]/route.js +10 -1
  18. package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
  19. package/dist/modules/query_index/data/entities.js +13 -1
  20. package/dist/modules/query_index/data/entities.js.map +2 -2
  21. package/dist/modules/query_index/migrations/Migration20260518162054_query_index.js +43 -0
  22. package/dist/modules/query_index/migrations/Migration20260518162054_query_index.js.map +7 -0
  23. package/generated/entities/entity_index_row/index.ts +1 -0
  24. package/generated/entity-fields-registry.ts +1 -0
  25. package/package.json +8 -8
  26. package/src/helpers/integration/queue-runner.ts +72 -0
  27. package/src/helpers/integration/queue.ts +70 -0
  28. package/src/helpers/integration/salesUi.ts +38 -23
  29. package/src/modules/attachments/i18n/de.json +13 -0
  30. package/src/modules/attachments/i18n/en.json +13 -0
  31. package/src/modules/attachments/i18n/es.json +13 -0
  32. package/src/modules/attachments/i18n/pl.json +13 -0
  33. package/src/modules/customers/ai-agents.ts +4 -1
  34. package/src/modules/customers/ai-tools/deals-pack.ts +68 -10
  35. package/src/modules/customers/ai-tools/types.ts +6 -0
  36. package/src/modules/customers/api/people/[id]/route.ts +10 -1
  37. package/src/modules/query_index/data/entities.ts +12 -0
  38. package/src/modules/query_index/migrations/.snapshot-open-mercato.json +792 -343
  39. package/src/modules/query_index/migrations/Migration20260518162054_query_index.ts +43 -0
@@ -0,0 +1,43 @@
1
+ import { Migration } from '@mikro-orm/migrations';
2
+
3
+ export class Migration20260518162054_query_index extends Migration {
4
+
5
+ override up(): void | Promise<void> {
6
+ this.addSql(`alter table "entity_indexes" add column if not exists "organization_id_coalesced" uuid generated always as (coalesce("organization_id", '00000000-0000-0000-0000-000000000000'::uuid)) stored not null;`);
7
+ this.addSql(`
8
+ delete from "entity_indexes" loser
9
+ using (
10
+ select "id"
11
+ from (
12
+ select
13
+ "id",
14
+ row_number() over (
15
+ partition by "entity_type", "entity_id", "organization_id_coalesced"
16
+ order by ("deleted_at" is null) desc, "updated_at" desc, "id" desc
17
+ ) as row_number
18
+ from "entity_indexes"
19
+ ) ranked
20
+ where ranked.row_number > 1
21
+ ) duplicates
22
+ where loser."id" = duplicates."id";
23
+ `);
24
+ this.addSql(`
25
+ do $$
26
+ begin
27
+ if not exists (
28
+ select 1
29
+ from pg_constraint
30
+ where conname = 'entity_indexes_type_entity_org_coalesced_unique'
31
+ ) then
32
+ alter table "entity_indexes" add constraint "entity_indexes_type_entity_org_coalesced_unique" unique ("entity_type", "entity_id", "organization_id_coalesced");
33
+ end if;
34
+ end $$;
35
+ `);
36
+ }
37
+
38
+ override down(): void | Promise<void> {
39
+ this.addSql(`alter table "entity_indexes" drop constraint if exists "entity_indexes_type_entity_org_coalesced_unique";`);
40
+ this.addSql(`alter table "entity_indexes" drop column "organization_id_coalesced";`);
41
+ }
42
+
43
+ }