@okf/ootils 1.32.0 → 1.32.2

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.
@@ -1418,6 +1418,15 @@ declare const UI_CONTENT: {
1418
1418
  */
1419
1419
  declare const genCleanCamelCaseId: (id: string) => string;
1420
1420
 
1421
+ /**
1422
+ * Convert a plain text string into the standard Lexical value shape
1423
+ * used across the platform: { allText, isLexical, editorState }.
1424
+ *
1425
+ * If the value is already Lexical (has `isLexical: true`), returns it as-is.
1426
+ * Each line in the text becomes its own paragraph node.
1427
+ */
1428
+ declare const plainTextToLexical: (value: string | number | any) => any;
1429
+
1421
1430
  /**
1422
1431
  * BlockDef — single source of truth for a tplBlock's cross-cutting configuration.
1423
1432
  *
@@ -1452,6 +1461,13 @@ interface BlockDef {
1452
1461
  plainTextString?: string | null;
1453
1462
  /** Path appended to valuePath for ES/listing search (e.g. 'allText'). null = valuePath used directly. */
1454
1463
  searchField?: string | null;
1464
+ /**
1465
+ * Sub-path from valuePath to the Lexical object ({ allText, isLexical, editorState }).
1466
+ * null = the value at valuePath IS the Lexical object (e.g. LexicalTextEditor).
1467
+ * For AudioInput: '0.transcription.result.finalText' (the Lexical object is nested).
1468
+ * Used by annotation services that need to read/write editorState + allText.
1469
+ */
1470
+ lexicalValue?: string | null;
1455
1471
  };
1456
1472
  validation: {
1457
1473
  /** Name of the "is populated" validator fn (resolved by consumer) */
@@ -1589,8 +1605,12 @@ declare const ELASTIC_MAPPING_PRESETS: {
1589
1605
  readonly result: {
1590
1606
  readonly properties: {
1591
1607
  readonly finalText: {
1592
- readonly type: "text";
1593
- readonly analyzer: "LargeTextAnalyzer";
1608
+ readonly properties: {
1609
+ readonly allText: {
1610
+ readonly type: "text";
1611
+ readonly analyzer: "LargeTextAnalyzer";
1612
+ };
1613
+ };
1594
1614
  };
1595
1615
  };
1596
1616
  };
@@ -1702,4 +1722,4 @@ declare class BlockRegistry {
1702
1722
  /** Singleton instance — the one registry shared across the app. */
1703
1723
  declare const blockRegistry: BlockRegistry;
1704
1724
 
1705
- export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
1725
+ export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
package/dist/browser.d.ts CHANGED
@@ -1418,6 +1418,15 @@ declare const UI_CONTENT: {
1418
1418
  */
1419
1419
  declare const genCleanCamelCaseId: (id: string) => string;
1420
1420
 
1421
+ /**
1422
+ * Convert a plain text string into the standard Lexical value shape
1423
+ * used across the platform: { allText, isLexical, editorState }.
1424
+ *
1425
+ * If the value is already Lexical (has `isLexical: true`), returns it as-is.
1426
+ * Each line in the text becomes its own paragraph node.
1427
+ */
1428
+ declare const plainTextToLexical: (value: string | number | any) => any;
1429
+
1421
1430
  /**
1422
1431
  * BlockDef — single source of truth for a tplBlock's cross-cutting configuration.
1423
1432
  *
@@ -1452,6 +1461,13 @@ interface BlockDef {
1452
1461
  plainTextString?: string | null;
1453
1462
  /** Path appended to valuePath for ES/listing search (e.g. 'allText'). null = valuePath used directly. */
1454
1463
  searchField?: string | null;
1464
+ /**
1465
+ * Sub-path from valuePath to the Lexical object ({ allText, isLexical, editorState }).
1466
+ * null = the value at valuePath IS the Lexical object (e.g. LexicalTextEditor).
1467
+ * For AudioInput: '0.transcription.result.finalText' (the Lexical object is nested).
1468
+ * Used by annotation services that need to read/write editorState + allText.
1469
+ */
1470
+ lexicalValue?: string | null;
1455
1471
  };
1456
1472
  validation: {
1457
1473
  /** Name of the "is populated" validator fn (resolved by consumer) */
@@ -1589,8 +1605,12 @@ declare const ELASTIC_MAPPING_PRESETS: {
1589
1605
  readonly result: {
1590
1606
  readonly properties: {
1591
1607
  readonly finalText: {
1592
- readonly type: "text";
1593
- readonly analyzer: "LargeTextAnalyzer";
1608
+ readonly properties: {
1609
+ readonly allText: {
1610
+ readonly type: "text";
1611
+ readonly analyzer: "LargeTextAnalyzer";
1612
+ };
1613
+ };
1594
1614
  };
1595
1615
  };
1596
1616
  };
@@ -1702,4 +1722,4 @@ declare class BlockRegistry {
1702
1722
  /** Singleton instance — the one registry shared across the app. */
1703
1723
  declare const blockRegistry: BlockRegistry;
1704
1724
 
1705
- export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
1725
+ export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
package/dist/browser.js CHANGED
@@ -57,6 +57,7 @@ __export(browser_exports, {
57
57
  isTplAnnotationEnabled: () => isTplAnnotationEnabled,
58
58
  mergeAnnoDataIntoAnnotationsTags: () => mergeAnnoDataIntoAnnotationsTags,
59
59
  parseSpecialConfigSyntax: () => parseSpecialConfigSyntax,
60
+ plainTextToLexical: () => plainTextToLexical,
60
61
  processAuthorAndCommonFilters: () => processAuthorAndCommonFilters,
61
62
  recursivelyExtractBlocks: () => _recursExtractBlocks,
62
63
  segrigateDocs: () => segrigateDocs,
@@ -391,8 +392,9 @@ var ELASTIC_MAPPING_PRESETS = {
391
392
  }
392
393
  }
393
394
  },
394
- // Audio file value (array of one object) — only the transcription.result.finalText
395
- // is indexed as searchable text. Everything else on the audio object is ignored.
395
+ // Audio file value (array of one object) — only the transcription.result.finalText.allText
396
+ // is indexed as searchable text. finalText is stored in Lexical shape; allText is the
397
+ // plain text within it. Everything else on the audio object is ignored by ES.
396
398
  audioTranscription: {
397
399
  properties: {
398
400
  transcription: {
@@ -400,8 +402,12 @@ var ELASTIC_MAPPING_PRESETS = {
400
402
  result: {
401
403
  properties: {
402
404
  finalText: {
403
- type: "text",
404
- analyzer: "LargeTextAnalyzer"
405
+ properties: {
406
+ allText: {
407
+ type: "text",
408
+ analyzer: "LargeTextAnalyzer"
409
+ }
410
+ }
405
411
  }
406
412
  }
407
413
  }
@@ -449,7 +455,8 @@ var LexicalTextEditor = {
449
455
  // Field paths
450
456
  fieldPaths: {
451
457
  plainTextString: "allText",
452
- searchField: "allText"
458
+ searchField: "allText",
459
+ lexicalValue: null
453
460
  },
454
461
  // Validation
455
462
  validation: {
@@ -527,8 +534,9 @@ var AudioInput = {
527
534
  // array index). `searchField` is the ES path — ES flattens arrays of objects
528
535
  // so no index is needed there.
529
536
  fieldPaths: {
530
- plainTextString: "0.transcription.result.finalText",
531
- searchField: "transcription.result.finalText"
537
+ plainTextString: "0.transcription.result.finalText.allText",
538
+ searchField: "transcription.result.finalText.allText",
539
+ lexicalValue: "0.transcription.result.finalText"
532
540
  },
533
541
  // Validation
534
542
  validation: {
@@ -2569,6 +2577,38 @@ var genCleanCamelCaseId = (id) => {
2569
2577
  if (/^\d/.test(result)) result = "a" + result;
2570
2578
  return result.slice(0, MAX_LENGTH);
2571
2579
  };
2580
+
2581
+ // src/utils/plainTextToLexical.ts
2582
+ var plainTextToLexical = (value) => {
2583
+ if (!value && value !== 0) return void 0;
2584
+ if (value?.isLexical === true) return value;
2585
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
2586
+ const text = String(value);
2587
+ const lines = text.split(/\r?\n/);
2588
+ const paragraphNodes = lines.map((line) => ({
2589
+ type: "paragraph",
2590
+ children: [
2591
+ {
2592
+ type: "text",
2593
+ text: line
2594
+ }
2595
+ ]
2596
+ }));
2597
+ return {
2598
+ allText: text,
2599
+ isLexical: true,
2600
+ editorState: {
2601
+ root: {
2602
+ children: paragraphNodes,
2603
+ direction: "ltr",
2604
+ format: "",
2605
+ indent: 0,
2606
+ type: "root",
2607
+ version: 1
2608
+ }
2609
+ }
2610
+ };
2611
+ };
2572
2612
  // Annotate the CommonJS export names for ESM import in node:
2573
2613
  0 && (module.exports = {
2574
2614
  BASE_BULLMQ_CONFIG,
@@ -2608,6 +2648,7 @@ var genCleanCamelCaseId = (id) => {
2608
2648
  isTplAnnotationEnabled,
2609
2649
  mergeAnnoDataIntoAnnotationsTags,
2610
2650
  parseSpecialConfigSyntax,
2651
+ plainTextToLexical,
2611
2652
  processAuthorAndCommonFilters,
2612
2653
  recursivelyExtractBlocks,
2613
2654
  segrigateDocs,
package/dist/browser.mjs CHANGED
@@ -324,8 +324,9 @@ var ELASTIC_MAPPING_PRESETS = {
324
324
  }
325
325
  }
326
326
  },
327
- // Audio file value (array of one object) — only the transcription.result.finalText
328
- // is indexed as searchable text. Everything else on the audio object is ignored.
327
+ // Audio file value (array of one object) — only the transcription.result.finalText.allText
328
+ // is indexed as searchable text. finalText is stored in Lexical shape; allText is the
329
+ // plain text within it. Everything else on the audio object is ignored by ES.
329
330
  audioTranscription: {
330
331
  properties: {
331
332
  transcription: {
@@ -333,8 +334,12 @@ var ELASTIC_MAPPING_PRESETS = {
333
334
  result: {
334
335
  properties: {
335
336
  finalText: {
336
- type: "text",
337
- analyzer: "LargeTextAnalyzer"
337
+ properties: {
338
+ allText: {
339
+ type: "text",
340
+ analyzer: "LargeTextAnalyzer"
341
+ }
342
+ }
338
343
  }
339
344
  }
340
345
  }
@@ -382,7 +387,8 @@ var LexicalTextEditor = {
382
387
  // Field paths
383
388
  fieldPaths: {
384
389
  plainTextString: "allText",
385
- searchField: "allText"
390
+ searchField: "allText",
391
+ lexicalValue: null
386
392
  },
387
393
  // Validation
388
394
  validation: {
@@ -460,8 +466,9 @@ var AudioInput = {
460
466
  // array index). `searchField` is the ES path — ES flattens arrays of objects
461
467
  // so no index is needed there.
462
468
  fieldPaths: {
463
- plainTextString: "0.transcription.result.finalText",
464
- searchField: "transcription.result.finalText"
469
+ plainTextString: "0.transcription.result.finalText.allText",
470
+ searchField: "transcription.result.finalText.allText",
471
+ lexicalValue: "0.transcription.result.finalText"
465
472
  },
466
473
  // Validation
467
474
  validation: {
@@ -2502,6 +2509,38 @@ var genCleanCamelCaseId = (id) => {
2502
2509
  if (/^\d/.test(result)) result = "a" + result;
2503
2510
  return result.slice(0, MAX_LENGTH);
2504
2511
  };
2512
+
2513
+ // src/utils/plainTextToLexical.ts
2514
+ var plainTextToLexical = (value) => {
2515
+ if (!value && value !== 0) return void 0;
2516
+ if (value?.isLexical === true) return value;
2517
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
2518
+ const text = String(value);
2519
+ const lines = text.split(/\r?\n/);
2520
+ const paragraphNodes = lines.map((line) => ({
2521
+ type: "paragraph",
2522
+ children: [
2523
+ {
2524
+ type: "text",
2525
+ text: line
2526
+ }
2527
+ ]
2528
+ }));
2529
+ return {
2530
+ allText: text,
2531
+ isLexical: true,
2532
+ editorState: {
2533
+ root: {
2534
+ children: paragraphNodes,
2535
+ direction: "ltr",
2536
+ format: "",
2537
+ indent: 0,
2538
+ type: "root",
2539
+ version: 1
2540
+ }
2541
+ }
2542
+ };
2543
+ };
2505
2544
  export {
2506
2545
  BASE_BULLMQ_CONFIG,
2507
2546
  BlockRegistry,
@@ -2540,6 +2579,7 @@ export {
2540
2579
  isTplAnnotationEnabled,
2541
2580
  mergeAnnoDataIntoAnnotationsTags,
2542
2581
  parseSpecialConfigSyntax,
2582
+ plainTextToLexical,
2543
2583
  processAuthorAndCommonFilters,
2544
2584
  _recursExtractBlocks as recursivelyExtractBlocks,
2545
2585
  segrigateDocs,
package/dist/node.d.mts CHANGED
@@ -1425,6 +1425,15 @@ declare const UI_CONTENT: {
1425
1425
  */
1426
1426
  declare const genCleanCamelCaseId: (id: string) => string;
1427
1427
 
1428
+ /**
1429
+ * Convert a plain text string into the standard Lexical value shape
1430
+ * used across the platform: { allText, isLexical, editorState }.
1431
+ *
1432
+ * If the value is already Lexical (has `isLexical: true`), returns it as-is.
1433
+ * Each line in the text becomes its own paragraph node.
1434
+ */
1435
+ declare const plainTextToLexical: (value: string | number | any) => any;
1436
+
1428
1437
  /**
1429
1438
  * BlockDef — single source of truth for a tplBlock's cross-cutting configuration.
1430
1439
  *
@@ -1459,6 +1468,13 @@ interface BlockDef {
1459
1468
  plainTextString?: string | null;
1460
1469
  /** Path appended to valuePath for ES/listing search (e.g. 'allText'). null = valuePath used directly. */
1461
1470
  searchField?: string | null;
1471
+ /**
1472
+ * Sub-path from valuePath to the Lexical object ({ allText, isLexical, editorState }).
1473
+ * null = the value at valuePath IS the Lexical object (e.g. LexicalTextEditor).
1474
+ * For AudioInput: '0.transcription.result.finalText' (the Lexical object is nested).
1475
+ * Used by annotation services that need to read/write editorState + allText.
1476
+ */
1477
+ lexicalValue?: string | null;
1462
1478
  };
1463
1479
  validation: {
1464
1480
  /** Name of the "is populated" validator fn (resolved by consumer) */
@@ -1596,8 +1612,12 @@ declare const ELASTIC_MAPPING_PRESETS: {
1596
1612
  readonly result: {
1597
1613
  readonly properties: {
1598
1614
  readonly finalText: {
1599
- readonly type: "text";
1600
- readonly analyzer: "LargeTextAnalyzer";
1615
+ readonly properties: {
1616
+ readonly allText: {
1617
+ readonly type: "text";
1618
+ readonly analyzer: "LargeTextAnalyzer";
1619
+ };
1620
+ };
1601
1621
  };
1602
1622
  };
1603
1623
  };
@@ -2443,4 +2463,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
2443
2463
  };
2444
2464
  }): Object;
2445
2465
 
2446
- export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
2466
+ export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
package/dist/node.d.ts CHANGED
@@ -1425,6 +1425,15 @@ declare const UI_CONTENT: {
1425
1425
  */
1426
1426
  declare const genCleanCamelCaseId: (id: string) => string;
1427
1427
 
1428
+ /**
1429
+ * Convert a plain text string into the standard Lexical value shape
1430
+ * used across the platform: { allText, isLexical, editorState }.
1431
+ *
1432
+ * If the value is already Lexical (has `isLexical: true`), returns it as-is.
1433
+ * Each line in the text becomes its own paragraph node.
1434
+ */
1435
+ declare const plainTextToLexical: (value: string | number | any) => any;
1436
+
1428
1437
  /**
1429
1438
  * BlockDef — single source of truth for a tplBlock's cross-cutting configuration.
1430
1439
  *
@@ -1459,6 +1468,13 @@ interface BlockDef {
1459
1468
  plainTextString?: string | null;
1460
1469
  /** Path appended to valuePath for ES/listing search (e.g. 'allText'). null = valuePath used directly. */
1461
1470
  searchField?: string | null;
1471
+ /**
1472
+ * Sub-path from valuePath to the Lexical object ({ allText, isLexical, editorState }).
1473
+ * null = the value at valuePath IS the Lexical object (e.g. LexicalTextEditor).
1474
+ * For AudioInput: '0.transcription.result.finalText' (the Lexical object is nested).
1475
+ * Used by annotation services that need to read/write editorState + allText.
1476
+ */
1477
+ lexicalValue?: string | null;
1462
1478
  };
1463
1479
  validation: {
1464
1480
  /** Name of the "is populated" validator fn (resolved by consumer) */
@@ -1596,8 +1612,12 @@ declare const ELASTIC_MAPPING_PRESETS: {
1596
1612
  readonly result: {
1597
1613
  readonly properties: {
1598
1614
  readonly finalText: {
1599
- readonly type: "text";
1600
- readonly analyzer: "LargeTextAnalyzer";
1615
+ readonly properties: {
1616
+ readonly allText: {
1617
+ readonly type: "text";
1618
+ readonly analyzer: "LargeTextAnalyzer";
1619
+ };
1620
+ };
1601
1621
  };
1602
1622
  };
1603
1623
  };
@@ -2443,4 +2463,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
2443
2463
  };
2444
2464
  }): Object;
2445
2465
 
2446
- export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
2466
+ export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
package/dist/node.js CHANGED
@@ -2035,6 +2035,7 @@ __export(node_exports, {
2035
2035
  isTplAnnotationEnabled: () => isTplAnnotationEnabled,
2036
2036
  mergeAnnoDataIntoAnnotationsTags: () => mergeAnnoDataIntoAnnotationsTags,
2037
2037
  parseSpecialConfigSyntax: () => parseSpecialConfigSyntax,
2038
+ plainTextToLexical: () => plainTextToLexical,
2038
2039
  processAuthorAndCommonFilters: () => processAuthorAndCommonFilters,
2039
2040
  recursivelyExtractBlocks: () => _recursExtractBlocks,
2040
2041
  segrigateDocs: () => segrigateDocs,
@@ -2369,8 +2370,9 @@ var ELASTIC_MAPPING_PRESETS = {
2369
2370
  }
2370
2371
  }
2371
2372
  },
2372
- // Audio file value (array of one object) — only the transcription.result.finalText
2373
- // is indexed as searchable text. Everything else on the audio object is ignored.
2373
+ // Audio file value (array of one object) — only the transcription.result.finalText.allText
2374
+ // is indexed as searchable text. finalText is stored in Lexical shape; allText is the
2375
+ // plain text within it. Everything else on the audio object is ignored by ES.
2374
2376
  audioTranscription: {
2375
2377
  properties: {
2376
2378
  transcription: {
@@ -2378,8 +2380,12 @@ var ELASTIC_MAPPING_PRESETS = {
2378
2380
  result: {
2379
2381
  properties: {
2380
2382
  finalText: {
2381
- type: "text",
2382
- analyzer: "LargeTextAnalyzer"
2383
+ properties: {
2384
+ allText: {
2385
+ type: "text",
2386
+ analyzer: "LargeTextAnalyzer"
2387
+ }
2388
+ }
2383
2389
  }
2384
2390
  }
2385
2391
  }
@@ -2427,7 +2433,8 @@ var LexicalTextEditor = {
2427
2433
  // Field paths
2428
2434
  fieldPaths: {
2429
2435
  plainTextString: "allText",
2430
- searchField: "allText"
2436
+ searchField: "allText",
2437
+ lexicalValue: null
2431
2438
  },
2432
2439
  // Validation
2433
2440
  validation: {
@@ -2505,8 +2512,9 @@ var AudioInput = {
2505
2512
  // array index). `searchField` is the ES path — ES flattens arrays of objects
2506
2513
  // so no index is needed there.
2507
2514
  fieldPaths: {
2508
- plainTextString: "0.transcription.result.finalText",
2509
- searchField: "transcription.result.finalText"
2515
+ plainTextString: "0.transcription.result.finalText.allText",
2516
+ searchField: "transcription.result.finalText.allText",
2517
+ lexicalValue: "0.transcription.result.finalText"
2510
2518
  },
2511
2519
  // Validation
2512
2520
  validation: {
@@ -4168,6 +4176,38 @@ var genCleanCamelCaseId = (id) => {
4168
4176
  return result.slice(0, MAX_LENGTH);
4169
4177
  };
4170
4178
 
4179
+ // src/utils/plainTextToLexical.ts
4180
+ var plainTextToLexical = (value) => {
4181
+ if (!value && value !== 0) return void 0;
4182
+ if (value?.isLexical === true) return value;
4183
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
4184
+ const text = String(value);
4185
+ const lines = text.split(/\r?\n/);
4186
+ const paragraphNodes = lines.map((line) => ({
4187
+ type: "paragraph",
4188
+ children: [
4189
+ {
4190
+ type: "text",
4191
+ text: line
4192
+ }
4193
+ ]
4194
+ }));
4195
+ return {
4196
+ allText: text,
4197
+ isLexical: true,
4198
+ editorState: {
4199
+ root: {
4200
+ children: paragraphNodes,
4201
+ direction: "ltr",
4202
+ format: "",
4203
+ indent: 0,
4204
+ type: "root",
4205
+ version: 1
4206
+ }
4207
+ }
4208
+ };
4209
+ };
4210
+
4171
4211
  // src/node.ts
4172
4212
  var import_MongoConnector3 = __toESM(require_MongoConnector());
4173
4213
  var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
@@ -4615,6 +4655,7 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
4615
4655
  isTplAnnotationEnabled,
4616
4656
  mergeAnnoDataIntoAnnotationsTags,
4617
4657
  parseSpecialConfigSyntax,
4658
+ plainTextToLexical,
4618
4659
  processAuthorAndCommonFilters,
4619
4660
  recursivelyExtractBlocks,
4620
4661
  segrigateDocs,
package/dist/node.mjs CHANGED
@@ -2301,8 +2301,9 @@ var ELASTIC_MAPPING_PRESETS = {
2301
2301
  }
2302
2302
  }
2303
2303
  },
2304
- // Audio file value (array of one object) — only the transcription.result.finalText
2305
- // is indexed as searchable text. Everything else on the audio object is ignored.
2304
+ // Audio file value (array of one object) — only the transcription.result.finalText.allText
2305
+ // is indexed as searchable text. finalText is stored in Lexical shape; allText is the
2306
+ // plain text within it. Everything else on the audio object is ignored by ES.
2306
2307
  audioTranscription: {
2307
2308
  properties: {
2308
2309
  transcription: {
@@ -2310,8 +2311,12 @@ var ELASTIC_MAPPING_PRESETS = {
2310
2311
  result: {
2311
2312
  properties: {
2312
2313
  finalText: {
2313
- type: "text",
2314
- analyzer: "LargeTextAnalyzer"
2314
+ properties: {
2315
+ allText: {
2316
+ type: "text",
2317
+ analyzer: "LargeTextAnalyzer"
2318
+ }
2319
+ }
2315
2320
  }
2316
2321
  }
2317
2322
  }
@@ -2359,7 +2364,8 @@ var LexicalTextEditor = {
2359
2364
  // Field paths
2360
2365
  fieldPaths: {
2361
2366
  plainTextString: "allText",
2362
- searchField: "allText"
2367
+ searchField: "allText",
2368
+ lexicalValue: null
2363
2369
  },
2364
2370
  // Validation
2365
2371
  validation: {
@@ -2437,8 +2443,9 @@ var AudioInput = {
2437
2443
  // array index). `searchField` is the ES path — ES flattens arrays of objects
2438
2444
  // so no index is needed there.
2439
2445
  fieldPaths: {
2440
- plainTextString: "0.transcription.result.finalText",
2441
- searchField: "transcription.result.finalText"
2446
+ plainTextString: "0.transcription.result.finalText.allText",
2447
+ searchField: "transcription.result.finalText.allText",
2448
+ lexicalValue: "0.transcription.result.finalText"
2442
2449
  },
2443
2450
  // Validation
2444
2451
  validation: {
@@ -4100,6 +4107,38 @@ var genCleanCamelCaseId = (id) => {
4100
4107
  return result.slice(0, MAX_LENGTH);
4101
4108
  };
4102
4109
 
4110
+ // src/utils/plainTextToLexical.ts
4111
+ var plainTextToLexical = (value) => {
4112
+ if (!value && value !== 0) return void 0;
4113
+ if (value?.isLexical === true) return value;
4114
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
4115
+ const text = String(value);
4116
+ const lines = text.split(/\r?\n/);
4117
+ const paragraphNodes = lines.map((line) => ({
4118
+ type: "paragraph",
4119
+ children: [
4120
+ {
4121
+ type: "text",
4122
+ text: line
4123
+ }
4124
+ ]
4125
+ }));
4126
+ return {
4127
+ allText: text,
4128
+ isLexical: true,
4129
+ editorState: {
4130
+ root: {
4131
+ children: paragraphNodes,
4132
+ direction: "ltr",
4133
+ format: "",
4134
+ indent: 0,
4135
+ type: "root",
4136
+ version: 1
4137
+ }
4138
+ }
4139
+ };
4140
+ };
4141
+
4103
4142
  // src/node.ts
4104
4143
  var import_MongoConnector3 = __toESM(require_MongoConnector());
4105
4144
  var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
@@ -4562,6 +4601,7 @@ export {
4562
4601
  isTplAnnotationEnabled,
4563
4602
  mergeAnnoDataIntoAnnotationsTags,
4564
4603
  parseSpecialConfigSyntax,
4604
+ plainTextToLexical,
4565
4605
  processAuthorAndCommonFilters,
4566
4606
  _recursExtractBlocks as recursivelyExtractBlocks,
4567
4607
  segrigateDocs,
@@ -1418,6 +1418,15 @@ declare const UI_CONTENT: {
1418
1418
  */
1419
1419
  declare const genCleanCamelCaseId: (id: string) => string;
1420
1420
 
1421
+ /**
1422
+ * Convert a plain text string into the standard Lexical value shape
1423
+ * used across the platform: { allText, isLexical, editorState }.
1424
+ *
1425
+ * If the value is already Lexical (has `isLexical: true`), returns it as-is.
1426
+ * Each line in the text becomes its own paragraph node.
1427
+ */
1428
+ declare const plainTextToLexical: (value: string | number | any) => any;
1429
+
1421
1430
  /**
1422
1431
  * BlockDef — single source of truth for a tplBlock's cross-cutting configuration.
1423
1432
  *
@@ -1452,6 +1461,13 @@ interface BlockDef {
1452
1461
  plainTextString?: string | null;
1453
1462
  /** Path appended to valuePath for ES/listing search (e.g. 'allText'). null = valuePath used directly. */
1454
1463
  searchField?: string | null;
1464
+ /**
1465
+ * Sub-path from valuePath to the Lexical object ({ allText, isLexical, editorState }).
1466
+ * null = the value at valuePath IS the Lexical object (e.g. LexicalTextEditor).
1467
+ * For AudioInput: '0.transcription.result.finalText' (the Lexical object is nested).
1468
+ * Used by annotation services that need to read/write editorState + allText.
1469
+ */
1470
+ lexicalValue?: string | null;
1455
1471
  };
1456
1472
  validation: {
1457
1473
  /** Name of the "is populated" validator fn (resolved by consumer) */
@@ -1589,8 +1605,12 @@ declare const ELASTIC_MAPPING_PRESETS: {
1589
1605
  readonly result: {
1590
1606
  readonly properties: {
1591
1607
  readonly finalText: {
1592
- readonly type: "text";
1593
- readonly analyzer: "LargeTextAnalyzer";
1608
+ readonly properties: {
1609
+ readonly allText: {
1610
+ readonly type: "text";
1611
+ readonly analyzer: "LargeTextAnalyzer";
1612
+ };
1613
+ };
1594
1614
  };
1595
1615
  };
1596
1616
  };
@@ -1702,4 +1722,4 @@ declare class BlockRegistry {
1702
1722
  /** Singleton instance — the one registry shared across the app. */
1703
1723
  declare const blockRegistry: BlockRegistry;
1704
1724
 
1705
- export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
1725
+ export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
@@ -1418,6 +1418,15 @@ declare const UI_CONTENT: {
1418
1418
  */
1419
1419
  declare const genCleanCamelCaseId: (id: string) => string;
1420
1420
 
1421
+ /**
1422
+ * Convert a plain text string into the standard Lexical value shape
1423
+ * used across the platform: { allText, isLexical, editorState }.
1424
+ *
1425
+ * If the value is already Lexical (has `isLexical: true`), returns it as-is.
1426
+ * Each line in the text becomes its own paragraph node.
1427
+ */
1428
+ declare const plainTextToLexical: (value: string | number | any) => any;
1429
+
1421
1430
  /**
1422
1431
  * BlockDef — single source of truth for a tplBlock's cross-cutting configuration.
1423
1432
  *
@@ -1452,6 +1461,13 @@ interface BlockDef {
1452
1461
  plainTextString?: string | null;
1453
1462
  /** Path appended to valuePath for ES/listing search (e.g. 'allText'). null = valuePath used directly. */
1454
1463
  searchField?: string | null;
1464
+ /**
1465
+ * Sub-path from valuePath to the Lexical object ({ allText, isLexical, editorState }).
1466
+ * null = the value at valuePath IS the Lexical object (e.g. LexicalTextEditor).
1467
+ * For AudioInput: '0.transcription.result.finalText' (the Lexical object is nested).
1468
+ * Used by annotation services that need to read/write editorState + allText.
1469
+ */
1470
+ lexicalValue?: string | null;
1455
1471
  };
1456
1472
  validation: {
1457
1473
  /** Name of the "is populated" validator fn (resolved by consumer) */
@@ -1589,8 +1605,12 @@ declare const ELASTIC_MAPPING_PRESETS: {
1589
1605
  readonly result: {
1590
1606
  readonly properties: {
1591
1607
  readonly finalText: {
1592
- readonly type: "text";
1593
- readonly analyzer: "LargeTextAnalyzer";
1608
+ readonly properties: {
1609
+ readonly allText: {
1610
+ readonly type: "text";
1611
+ readonly analyzer: "LargeTextAnalyzer";
1612
+ };
1613
+ };
1594
1614
  };
1595
1615
  };
1596
1616
  };
@@ -1702,4 +1722,4 @@ declare class BlockRegistry {
1702
1722
  /** Singleton instance — the one registry shared across the app. */
1703
1723
  declare const blockRegistry: BlockRegistry;
1704
1724
 
1705
- export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
1725
+ export { BASE_BULLMQ_CONFIG, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ELASTIC_MAPPING_PRESETS, FILTER_IDS, MONGO_SCHEMA_PRESETS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
package/dist/universal.js CHANGED
@@ -57,6 +57,7 @@ __export(universal_exports, {
57
57
  isTplAnnotationEnabled: () => isTplAnnotationEnabled,
58
58
  mergeAnnoDataIntoAnnotationsTags: () => mergeAnnoDataIntoAnnotationsTags,
59
59
  parseSpecialConfigSyntax: () => parseSpecialConfigSyntax,
60
+ plainTextToLexical: () => plainTextToLexical,
60
61
  processAuthorAndCommonFilters: () => processAuthorAndCommonFilters,
61
62
  recursivelyExtractBlocks: () => _recursExtractBlocks,
62
63
  segrigateDocs: () => segrigateDocs,
@@ -391,8 +392,9 @@ var ELASTIC_MAPPING_PRESETS = {
391
392
  }
392
393
  }
393
394
  },
394
- // Audio file value (array of one object) — only the transcription.result.finalText
395
- // is indexed as searchable text. Everything else on the audio object is ignored.
395
+ // Audio file value (array of one object) — only the transcription.result.finalText.allText
396
+ // is indexed as searchable text. finalText is stored in Lexical shape; allText is the
397
+ // plain text within it. Everything else on the audio object is ignored by ES.
396
398
  audioTranscription: {
397
399
  properties: {
398
400
  transcription: {
@@ -400,8 +402,12 @@ var ELASTIC_MAPPING_PRESETS = {
400
402
  result: {
401
403
  properties: {
402
404
  finalText: {
403
- type: "text",
404
- analyzer: "LargeTextAnalyzer"
405
+ properties: {
406
+ allText: {
407
+ type: "text",
408
+ analyzer: "LargeTextAnalyzer"
409
+ }
410
+ }
405
411
  }
406
412
  }
407
413
  }
@@ -449,7 +455,8 @@ var LexicalTextEditor = {
449
455
  // Field paths
450
456
  fieldPaths: {
451
457
  plainTextString: "allText",
452
- searchField: "allText"
458
+ searchField: "allText",
459
+ lexicalValue: null
453
460
  },
454
461
  // Validation
455
462
  validation: {
@@ -527,8 +534,9 @@ var AudioInput = {
527
534
  // array index). `searchField` is the ES path — ES flattens arrays of objects
528
535
  // so no index is needed there.
529
536
  fieldPaths: {
530
- plainTextString: "0.transcription.result.finalText",
531
- searchField: "transcription.result.finalText"
537
+ plainTextString: "0.transcription.result.finalText.allText",
538
+ searchField: "transcription.result.finalText.allText",
539
+ lexicalValue: "0.transcription.result.finalText"
532
540
  },
533
541
  // Validation
534
542
  validation: {
@@ -2569,6 +2577,38 @@ var genCleanCamelCaseId = (id) => {
2569
2577
  if (/^\d/.test(result)) result = "a" + result;
2570
2578
  return result.slice(0, MAX_LENGTH);
2571
2579
  };
2580
+
2581
+ // src/utils/plainTextToLexical.ts
2582
+ var plainTextToLexical = (value) => {
2583
+ if (!value && value !== 0) return void 0;
2584
+ if (value?.isLexical === true) return value;
2585
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
2586
+ const text = String(value);
2587
+ const lines = text.split(/\r?\n/);
2588
+ const paragraphNodes = lines.map((line) => ({
2589
+ type: "paragraph",
2590
+ children: [
2591
+ {
2592
+ type: "text",
2593
+ text: line
2594
+ }
2595
+ ]
2596
+ }));
2597
+ return {
2598
+ allText: text,
2599
+ isLexical: true,
2600
+ editorState: {
2601
+ root: {
2602
+ children: paragraphNodes,
2603
+ direction: "ltr",
2604
+ format: "",
2605
+ indent: 0,
2606
+ type: "root",
2607
+ version: 1
2608
+ }
2609
+ }
2610
+ };
2611
+ };
2572
2612
  // Annotate the CommonJS export names for ESM import in node:
2573
2613
  0 && (module.exports = {
2574
2614
  BASE_BULLMQ_CONFIG,
@@ -2608,6 +2648,7 @@ var genCleanCamelCaseId = (id) => {
2608
2648
  isTplAnnotationEnabled,
2609
2649
  mergeAnnoDataIntoAnnotationsTags,
2610
2650
  parseSpecialConfigSyntax,
2651
+ plainTextToLexical,
2611
2652
  processAuthorAndCommonFilters,
2612
2653
  recursivelyExtractBlocks,
2613
2654
  segrigateDocs,
@@ -324,8 +324,9 @@ var ELASTIC_MAPPING_PRESETS = {
324
324
  }
325
325
  }
326
326
  },
327
- // Audio file value (array of one object) — only the transcription.result.finalText
328
- // is indexed as searchable text. Everything else on the audio object is ignored.
327
+ // Audio file value (array of one object) — only the transcription.result.finalText.allText
328
+ // is indexed as searchable text. finalText is stored in Lexical shape; allText is the
329
+ // plain text within it. Everything else on the audio object is ignored by ES.
329
330
  audioTranscription: {
330
331
  properties: {
331
332
  transcription: {
@@ -333,8 +334,12 @@ var ELASTIC_MAPPING_PRESETS = {
333
334
  result: {
334
335
  properties: {
335
336
  finalText: {
336
- type: "text",
337
- analyzer: "LargeTextAnalyzer"
337
+ properties: {
338
+ allText: {
339
+ type: "text",
340
+ analyzer: "LargeTextAnalyzer"
341
+ }
342
+ }
338
343
  }
339
344
  }
340
345
  }
@@ -382,7 +387,8 @@ var LexicalTextEditor = {
382
387
  // Field paths
383
388
  fieldPaths: {
384
389
  plainTextString: "allText",
385
- searchField: "allText"
390
+ searchField: "allText",
391
+ lexicalValue: null
386
392
  },
387
393
  // Validation
388
394
  validation: {
@@ -460,8 +466,9 @@ var AudioInput = {
460
466
  // array index). `searchField` is the ES path — ES flattens arrays of objects
461
467
  // so no index is needed there.
462
468
  fieldPaths: {
463
- plainTextString: "0.transcription.result.finalText",
464
- searchField: "transcription.result.finalText"
469
+ plainTextString: "0.transcription.result.finalText.allText",
470
+ searchField: "transcription.result.finalText.allText",
471
+ lexicalValue: "0.transcription.result.finalText"
465
472
  },
466
473
  // Validation
467
474
  validation: {
@@ -2502,6 +2509,38 @@ var genCleanCamelCaseId = (id) => {
2502
2509
  if (/^\d/.test(result)) result = "a" + result;
2503
2510
  return result.slice(0, MAX_LENGTH);
2504
2511
  };
2512
+
2513
+ // src/utils/plainTextToLexical.ts
2514
+ var plainTextToLexical = (value) => {
2515
+ if (!value && value !== 0) return void 0;
2516
+ if (value?.isLexical === true) return value;
2517
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
2518
+ const text = String(value);
2519
+ const lines = text.split(/\r?\n/);
2520
+ const paragraphNodes = lines.map((line) => ({
2521
+ type: "paragraph",
2522
+ children: [
2523
+ {
2524
+ type: "text",
2525
+ text: line
2526
+ }
2527
+ ]
2528
+ }));
2529
+ return {
2530
+ allText: text,
2531
+ isLexical: true,
2532
+ editorState: {
2533
+ root: {
2534
+ children: paragraphNodes,
2535
+ direction: "ltr",
2536
+ format: "",
2537
+ indent: 0,
2538
+ type: "root",
2539
+ version: 1
2540
+ }
2541
+ }
2542
+ };
2543
+ };
2505
2544
  export {
2506
2545
  BASE_BULLMQ_CONFIG,
2507
2546
  BlockRegistry,
@@ -2540,6 +2579,7 @@ export {
2540
2579
  isTplAnnotationEnabled,
2541
2580
  mergeAnnoDataIntoAnnotationsTags,
2542
2581
  parseSpecialConfigSyntax,
2582
+ plainTextToLexical,
2543
2583
  processAuthorAndCommonFilters,
2544
2584
  _recursExtractBlocks as recursivelyExtractBlocks,
2545
2585
  segrigateDocs,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.32.0",
6
+ "version": "1.32.2",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",