@open-mercato/core 0.6.7-develop.6834.1.e76f4b8cbc → 0.6.7-develop.6851.1.c1680b00d8

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 (88) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/customers/components/detail/ActivitiesDayStrip.js +2 -3
  3. package/dist/modules/customers/components/detail/ActivitiesDayStrip.js.map +2 -2
  4. package/dist/modules/dashboards/lib/aggregations.js +20 -6
  5. package/dist/modules/dashboards/lib/aggregations.js.map +2 -2
  6. package/dist/modules/entities/api/definitions.js +2 -0
  7. package/dist/modules/entities/api/definitions.js.map +2 -2
  8. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +18 -3
  9. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
  10. package/dist/modules/entities/components/RecordListRelationCell.js +63 -0
  11. package/dist/modules/entities/components/RecordListRelationCell.js.map +7 -0
  12. package/dist/modules/entities/components/recordListRelationDisplays.js +80 -0
  13. package/dist/modules/entities/components/recordListRelationDisplays.js.map +7 -0
  14. package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js +14 -1
  15. package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js.map +2 -2
  16. package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js +22 -17
  17. package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js.map +2 -2
  18. package/dist/modules/query_index/api/reindex.js +10 -0
  19. package/dist/modules/query_index/api/reindex.js.map +2 -2
  20. package/dist/modules/query_index/cli.js +125 -1
  21. package/dist/modules/query_index/cli.js.map +2 -2
  22. package/dist/modules/query_index/lib/coverage.js +19 -7
  23. package/dist/modules/query_index/lib/coverage.js.map +2 -2
  24. package/dist/modules/query_index/lib/reindexer.js +43 -37
  25. package/dist/modules/query_index/lib/reindexer.js.map +2 -2
  26. package/dist/modules/sales/commands/documents.js +27 -0
  27. package/dist/modules/sales/commands/documents.js.map +2 -2
  28. package/dist/modules/sales/data/validators.js +2 -0
  29. package/dist/modules/sales/data/validators.js.map +2 -2
  30. package/package.json +8 -8
  31. package/src/modules/api_keys/i18n/ko.json +42 -0
  32. package/src/modules/attachments/i18n/ko.json +172 -0
  33. package/src/modules/audit_logs/i18n/ko.json +66 -0
  34. package/src/modules/auth/i18n/ko.json +255 -0
  35. package/src/modules/business_rules/i18n/ko.json +396 -0
  36. package/src/modules/catalog/i18n/ko.json +723 -0
  37. package/src/modules/communication_channels/i18n/ko.json +138 -0
  38. package/src/modules/configs/i18n/ko.json +197 -0
  39. package/src/modules/currencies/i18n/de.json +1 -0
  40. package/src/modules/currencies/i18n/en.json +1 -0
  41. package/src/modules/currencies/i18n/es.json +1 -0
  42. package/src/modules/currencies/i18n/ko.json +160 -0
  43. package/src/modules/currencies/i18n/pl.json +1 -0
  44. package/src/modules/customer_accounts/i18n/ko.json +354 -0
  45. package/src/modules/customers/components/detail/ActivitiesDayStrip.tsx +2 -3
  46. package/src/modules/customers/i18n/de.json +10 -0
  47. package/src/modules/customers/i18n/en.json +10 -0
  48. package/src/modules/customers/i18n/es.json +10 -0
  49. package/src/modules/customers/i18n/ko.json +2855 -0
  50. package/src/modules/customers/i18n/pl.json +10 -0
  51. package/src/modules/dashboards/i18n/ko.json +118 -0
  52. package/src/modules/dashboards/lib/aggregations.ts +42 -6
  53. package/src/modules/data_sync/i18n/ko.json +125 -0
  54. package/src/modules/design_system/i18n/ko.json +58 -0
  55. package/src/modules/dictionaries/i18n/ko.json +130 -0
  56. package/src/modules/directory/i18n/ko.json +105 -0
  57. package/src/modules/entities/api/definitions.ts +4 -0
  58. package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +94 -77
  59. package/src/modules/entities/components/RecordListRelationCell.tsx +90 -0
  60. package/src/modules/entities/components/recordListRelationDisplays.ts +109 -0
  61. package/src/modules/entities/i18n/ko.json +260 -0
  62. package/src/modules/feature_toggles/i18n/ko.json +96 -0
  63. package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.ts +17 -1
  64. package/src/modules/inbox_ops/components/proposals/EditActionDialog.tsx +21 -16
  65. package/src/modules/inbox_ops/components/proposals/types.ts +1 -0
  66. package/src/modules/inbox_ops/i18n/ko.json +196 -0
  67. package/src/modules/integrations/i18n/ko.json +129 -0
  68. package/src/modules/messages/i18n/ko.json +263 -0
  69. package/src/modules/notifications/i18n/ko.json +55 -0
  70. package/src/modules/payment_gateways/i18n/ko.json +87 -0
  71. package/src/modules/planner/i18n/ko.json +565 -0
  72. package/src/modules/portal/i18n/ko.json +143 -0
  73. package/src/modules/progress/i18n/ko.json +20 -0
  74. package/src/modules/query_index/api/reindex.ts +15 -0
  75. package/src/modules/query_index/cli.ts +180 -1
  76. package/src/modules/query_index/i18n/ko.json +69 -0
  77. package/src/modules/query_index/lib/coverage.ts +38 -8
  78. package/src/modules/query_index/lib/reindexer.ts +62 -40
  79. package/src/modules/resources/i18n/ko.json +770 -0
  80. package/src/modules/sales/commands/documents.ts +49 -0
  81. package/src/modules/sales/data/validators.ts +2 -0
  82. package/src/modules/sales/i18n/ko.json +1442 -0
  83. package/src/modules/shipping_carriers/i18n/ko.json +85 -0
  84. package/src/modules/staff/i18n/ko.json +1162 -0
  85. package/src/modules/sync_excel/i18n/ko.json +107 -0
  86. package/src/modules/translations/i18n/ko.json +45 -0
  87. package/src/modules/wms/i18n/ko.json +1053 -0
  88. package/src/modules/workflows/i18n/ko.json +1203 -0
@@ -323,55 +323,77 @@ export async function reindexEntity(
323
323
 
324
324
  options?.onProgress?.({ processed, total, chunkSize: 0 })
325
325
 
326
- if (resetCoverage) {
327
- if (force) {
326
+ // Partitions run concurrently, so a scope-wide purge here would delete rows a sibling
327
+ // partition has already written and never rebuild them (the run still reports success
328
+ // because progress counts attempted writes). Each partition therefore purges only the
329
+ // slice it is about to rebuild, and every partition purges — restricting the purge to
330
+ // the coverage-resetting partition would otherwise leave the other slices' stale rows
331
+ // behind on a forced rebuild.
332
+ if (force && (resetCoverage || usingPartitions)) {
333
+ try {
334
+ let purgeQuery = db
335
+ .deleteFrom('entity_indexes' as any)
336
+ .where('entity_type' as any, '=', entityType)
337
+ if (tenantId !== undefined) {
338
+ purgeQuery = purgeQuery.where(sql<boolean>`tenant_id is not distinct from ${tenantId ?? null}`)
339
+ }
340
+ if (organizationId !== undefined) {
341
+ purgeQuery = purgeQuery.where(sql<boolean>`organization_id is not distinct from ${organizationId ?? null}`)
342
+ }
343
+ if (usingPartitions && partitionIndex !== null) {
344
+ purgeQuery = purgeQuery.where(
345
+ sql<boolean>`mod(abs(hashtext(entity_id::text)), ${partitionCountRaw}) = ${partitionIndex}`,
346
+ )
347
+ }
348
+ await purgeQuery.execute()
349
+ } catch (error) {
350
+ logger.warn('Failed to purge index rows before force reindex', {
351
+ entityType,
352
+ tenantId: tenantId ?? null,
353
+ organizationId: organizationId ?? null,
354
+ partitionIndex: usingPartitions ? partitionIndex : null,
355
+ error: error instanceof Error ? error.message : error,
356
+ })
357
+ }
358
+ }
359
+
360
+ // The vector purge is scope-wide and cannot be partitioned — the queued job deletes every
361
+ // vector for the scope. Emitting it from one partition while siblings are already queueing
362
+ // per-record vectorize jobs is the same race the row purge just had, so a partitioned run
363
+ // leaves it to the caller that owns the fan-out (`api/reindex.ts` queues it once, before
364
+ // dispatching any partition).
365
+ if (force && resetCoverage && !usingPartitions && emitVectorize && eventBus) {
366
+ if (tenantId !== undefined) {
367
+ const payload: Record<string, unknown> = {
368
+ entityType,
369
+ tenantId: tenantId ?? null,
370
+ }
371
+ if (organizationId !== undefined) payload.organizationId = organizationId ?? null
328
372
  try {
329
- let purgeQuery = db
330
- .deleteFrom('entity_indexes' as any)
331
- .where('entity_type' as any, '=', entityType)
332
- if (tenantId !== undefined) {
333
- purgeQuery = purgeQuery.where(sql<boolean>`tenant_id is not distinct from ${tenantId ?? null}`)
334
- }
335
- if (organizationId !== undefined) {
336
- purgeQuery = purgeQuery.where(sql<boolean>`organization_id is not distinct from ${organizationId ?? null}`)
337
- }
338
- await purgeQuery.execute()
339
- } catch (error) {
340
- logger.warn('Failed to purge index rows before force reindex', {
373
+ await eventBus.emitEvent('query_index.vectorize_purge', payload)
374
+ } catch (err) {
375
+ logger.warn('Failed to queue vector purge before force reindex', {
341
376
  entityType,
342
377
  tenantId: tenantId ?? null,
343
378
  organizationId: organizationId ?? null,
344
- error: error instanceof Error ? error.message : error,
379
+ error: err instanceof Error ? err.message : err,
345
380
  })
346
381
  }
347
-
348
- if (emitVectorize && eventBus) {
349
- if (tenantId !== undefined) {
350
- const payload: Record<string, unknown> = {
351
- entityType,
352
- tenantId: tenantId ?? null,
353
- }
354
- if (organizationId !== undefined) payload.organizationId = organizationId ?? null
355
- try {
356
- await eventBus.emitEvent('query_index.vectorize_purge', payload)
357
- } catch (err) {
358
- logger.warn('Failed to queue vector purge before force reindex', {
359
- entityType,
360
- tenantId: tenantId ?? null,
361
- organizationId: organizationId ?? null,
362
- error: err instanceof Error ? err.message : err,
363
- })
364
- }
365
- } else {
366
- logger.warn('Skipping vector purge for force reindex without tenant scope', {
367
- entityType,
368
- })
369
- }
370
- }
382
+ } else {
383
+ logger.warn('Skipping vector purge for force reindex without tenant scope', {
384
+ entityType,
385
+ })
371
386
  }
387
+ }
372
388
 
389
+ if (resetCoverage) {
390
+ // Only meaningful for an unpartitioned run: `baseCounts` holds this partition's slice,
391
+ // so writing it as the scope's base count under-reports by the partition factor, and
392
+ // zeroing indexed_count scope-wide discards deltas siblings have already applied. The
393
+ // authoritative `refreshCoverageSnapshot` at the end of every partition owns the counts
394
+ // for partitioned runs.
373
395
  const nowTs = Date.now()
374
- for (const scope of baseCounts.values()) {
396
+ for (const scope of usingPartitions ? [] : baseCounts.values()) {
375
397
  const key = `${entityType}|${scopeKey(scope.tenantId, scope.organizationId)}`
376
398
  const last = lastCoverageReset.get(key) ?? 0
377
399
  if (force || nowTs - last >= COVERAGE_REFRESH_THROTTLE_MS) {