@okf/ootils 1.44.1 → 1.45.0

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.
@@ -1145,6 +1145,43 @@ var BASE_BULLMQ_CONFIG = {
1145
1145
  maxStalledCount: 3
1146
1146
  }
1147
1147
  },
1148
+ /**
1149
+ * Collab-editing session-boundary side effects for CONTENT docs.
1150
+ * Enqueued by okf-sub's collab service when a field lock releases / the
1151
+ * last editor leaves a live doc; the worker calls okf-be's internal
1152
+ * contentDocCollabSessionSideEffects endpoint (tag-rename sync, chunks/annos
1153
+ * producers, Elastic sync, cache invalidations, analytics).
1154
+ * Queued (rather than fire-and-forget HTTP from the boundary) for retry
1155
+ * ability + Bullboard trackability — a failed boundary would otherwise be
1156
+ * silently lost when the doc unloads. Steps are idempotent except
1157
+ * analytics, which runs LAST so retries only duplicate it on a
1158
+ * lost-response network edge.
1159
+ */
1160
+ CONTENT_DOC_COLAB_SESH_SIDE_EFFECTS_QUEUE: {
1161
+ id: "content-doc-colab-sesh-side-effects-queue",
1162
+ queueConfig: {
1163
+ defaultJobOptions: {
1164
+ attempts: 3,
1165
+ backoff: {
1166
+ type: "exponential",
1167
+ delay: 5e3
1168
+ },
1169
+ removeOnComplete: 50,
1170
+ removeOnFail: 200
1171
+ },
1172
+ streams: {
1173
+ events: {
1174
+ maxLen: 1e3
1175
+ // SockerIOService QueueEvents tails this stream for progress tracking; trimming at 10 dropped completion events mid-burst (stuck FE tracker). Entries are small now that job returnvalues are trimmed, so 1000 is cheap.
1176
+ }
1177
+ }
1178
+ },
1179
+ workerConfig: {
1180
+ concurrency: 10,
1181
+ lockDuration: 9e4,
1182
+ maxStalledCount: 3
1183
+ }
1184
+ },
1148
1185
  SARVAM_TRANSCRIPTION_QUEUE: {
1149
1186
  id: "sarvam-transcription-queue",
1150
1187
  queueConfig: {
@@ -1421,6 +1458,10 @@ var mergeAnnoDataIntoAnnotationsTags = ({
1421
1458
  return newConsolidated;
1422
1459
  };
1423
1460
 
1461
+ // src/collab/isCollabEditableBlock.js
1462
+ var COLLAB_SYSTEM_PATH_REGEX = /(^|\.)kp_/;
1463
+ var isCollabEditableBlock = (block) => !!block?.valuePath && block.valuePath !== "." && !COLLAB_SYSTEM_PATH_REGEX.test(block.valuePath);
1464
+
1424
1465
  // src/utils/parseSpecialConfigSyntax.ts
1425
1466
  var parseSpecialConfigSyntax = ({
1426
1467
  config,
@@ -2436,6 +2477,13 @@ var deduplicateRollupTagFilters = (rollups) => {
2436
2477
  var injectFilterOptionsBy = (filters) => filters.map(
2437
2478
  (f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
2438
2479
  );
2480
+ var isRollupConfig = (f) => !!f.target?.rollupPath || f.target?.filterType === "rollupValuePathType";
2481
+ var dedupeSharedGroupConfigs = (configs) => {
2482
+ const rollups = configs.filter(isRollupConfig);
2483
+ const rollupSourceKeys = new Set(rollups.map((r) => JSON.stringify(r.source)));
2484
+ const directFilters = configs.filter((f) => !isRollupConfig(f)).filter((f) => !rollupSourceKeys.has(JSON.stringify(f.source)));
2485
+ return [...directFilters, ...deduplicateRollupTagFilters(rollups)];
2486
+ };
2439
2487
  var _self_managed_buildDocHierarchyConfig = ({
2440
2488
  combinedDocumentBlocks,
2441
2489
  docRollupBlocks,
@@ -2448,17 +2496,19 @@ var _self_managed_buildDocHierarchyConfig = ({
2448
2496
  const commonGroup = allGroups.find(
2449
2497
  (g) => g.contentTypes.length === selectedTpls.length
2450
2498
  );
2451
- const commonFilterConfigs = commonGroup ? injectFilterOptionsBy(
2499
+ const commonFilterConfigs = commonGroup && selectedTpls.length >= 2 ? injectFilterOptionsBy(
2452
2500
  sortFiltersHierarchically(
2453
2501
  attachParentFields(
2454
- buildFilterConfigurations({
2455
- groups: [commonGroup],
2456
- type: "tags",
2457
- selectedTpls,
2458
- allTpls,
2459
- isRollup: false,
2460
- isAnno: false
2461
- }).flatMap((s) => s.configs),
2502
+ dedupeSharedGroupConfigs(
2503
+ buildFilterConfigurations({
2504
+ groups: [commonGroup],
2505
+ type: "tags",
2506
+ selectedTpls,
2507
+ allTpls,
2508
+ isRollup: false,
2509
+ isAnno: false
2510
+ }).flatMap((s) => s.configs)
2511
+ ),
2462
2512
  allTpls
2463
2513
  )
2464
2514
  )
@@ -2470,14 +2520,16 @@ var _self_managed_buildDocHierarchyConfig = ({
2470
2520
  const groupFilterConfigs = injectFilterOptionsBy(
2471
2521
  sortFiltersHierarchically(
2472
2522
  attachParentFields(
2473
- buildFilterConfigurations({
2474
- groups: [group],
2475
- type: "tags",
2476
- selectedTpls,
2477
- allTpls,
2478
- isRollup: false,
2479
- isAnno: false
2480
- }).flatMap((s) => s.configs),
2523
+ dedupeSharedGroupConfigs(
2524
+ buildFilterConfigurations({
2525
+ groups: [group],
2526
+ type: "tags",
2527
+ selectedTpls,
2528
+ allTpls,
2529
+ isRollup: false,
2530
+ isAnno: false
2531
+ }).flatMap((s) => s.configs)
2532
+ ),
2481
2533
  allTpls
2482
2534
  )
2483
2535
  )
@@ -2833,6 +2885,7 @@ export {
2833
2885
  BASE_BULLMQ_CONFIG,
2834
2886
  BlockRegistry,
2835
2887
  CHUNKING_PRESETS,
2888
+ COLLAB_SYSTEM_PATH_REGEX,
2836
2889
  ELASTIC_MAPPING_PRESETS,
2837
2890
  FILTER_IDS,
2838
2891
  MONGO_SCHEMA_PRESETS,
@@ -2866,6 +2919,7 @@ export {
2866
2919
  getRoutePathToTCI,
2867
2920
  getRoutePathToTagCategoryLanding,
2868
2921
  getVal,
2922
+ isCollabEditableBlock,
2869
2923
  isTplAnnotationEnabled,
2870
2924
  mergeAnnoDataIntoAnnotationsTags,
2871
2925
  parseSpecialConfigSyntax,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.44.1",
6
+ "version": "1.45.0",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",