@okf/ootils 1.29.4 → 1.30.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.
package/dist/node.js CHANGED
@@ -546,8 +546,7 @@ var init_platformConfigTypes = __esm({
546
546
  "userAgreement",
547
547
  "localeData",
548
548
  "theme",
549
- "ai",
550
- "onboarding"
549
+ "ai"
551
550
  ];
552
551
  }
553
552
  });
@@ -1948,12 +1947,16 @@ __export(node_exports, {
1948
1947
  BASE_BULLMQ_CONFIG: () => BASE_BULLMQ_CONFIG,
1949
1948
  BaseProducer: () => import_BaseProducer.BaseProducer,
1950
1949
  BaseWorker: () => import_BaseWorker.BaseWorker,
1950
+ BlockRegistry: () => BlockRegistry,
1951
+ CHUNKING_PRESETS: () => CHUNKING_PRESETS,
1951
1952
  ChunksElasticSyncProducer: () => import_ChunksElasticSyncProducer.ChunksElasticSyncProducer,
1953
+ ELASTIC_MAPPING_PRESETS: () => ELASTIC_MAPPING_PRESETS,
1952
1954
  ElasticSearchConnector: () => import_ElasticSearchConnector.ElasticSearchConnector,
1953
1955
  FILTER_IDS: () => FILTER_IDS,
1954
1956
  GET_GLOBAL_BULLMQ_CONFIG: () => import_GET_GLOBAL_BULLMQ_CONFIG.GET_GLOBAL_BULLMQ_CONFIG,
1955
1957
  GeneratedEntitiesSchema: () => GeneratedEntities_default,
1956
1958
  GeneratedTopicsSchema: () => GeneratedTopics_default,
1959
+ MONGO_SCHEMA_PRESETS: () => MONGO_SCHEMA_PRESETS,
1957
1960
  MongoConnector: () => import_MongoConnector3.MongoConnector,
1958
1961
  PlatformConfigsSchema: () => PlatformConfigs_default,
1959
1962
  ProducerManager: () => import_ProducerManager.ProducerManager,
@@ -1968,6 +1971,7 @@ __export(node_exports, {
1968
1971
  _self_managed_getFixedAnnoRollupBlocks: () => _self_managed_getFixedAnnoRollupBlocks,
1969
1972
  _self_managed_getFixedAnnoTagBlock: () => _self_managed_getFixedAnnoTagBlock,
1970
1973
  autoGenFilterConfigsFromTpl: () => autoGenFilterConfigsFromTpl,
1974
+ blockRegistry: () => blockRegistry,
1971
1975
  buildFilterConfigurations: () => buildFilterConfigurations,
1972
1976
  compareAndGroupBlocks: () => compareAndGroupBlocks,
1973
1977
  deleteVal: () => deleteVal,
@@ -3819,6 +3823,164 @@ var genCleanCamelCaseId = (id) => {
3819
3823
  return result.slice(0, MAX_LENGTH);
3820
3824
  };
3821
3825
 
3826
+ // src/blockRegistry/schemaPresets.ts
3827
+ var MONGO_SCHEMA_PRESETS = {
3828
+ object: { type: Object },
3829
+ string: { type: String }
3830
+ };
3831
+ var ELASTIC_MAPPING_PRESETS = {
3832
+ largeText: {
3833
+ properties: {
3834
+ allText: {
3835
+ type: "text",
3836
+ analyzer: "LargeTextAnalyzer"
3837
+ }
3838
+ }
3839
+ }
3840
+ };
3841
+ var CHUNKING_PRESETS = {
3842
+ // Lexical-shaped text — uses semantic chunking on allText
3843
+ lexicalSemantic: {
3844
+ strategy: "semanticChunking",
3845
+ windowSize: 3,
3846
+ minSimilarityScore: 0.7
3847
+ },
3848
+ // Plain text input — single chunk per field
3849
+ simpleText: {
3850
+ strategy: "simpleChunking"
3851
+ }
3852
+ };
3853
+
3854
+ // src/blockRegistry/blocks/LexicalTextEditor.ts
3855
+ var LexicalTextEditor = {
3856
+ compName: "LexicalTextEditor",
3857
+ // Identity
3858
+ category: "text",
3859
+ qualQuant: "qual",
3860
+ // Schema
3861
+ mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
3862
+ esMapping: ELASTIC_MAPPING_PRESETS.largeText,
3863
+ // Capabilities
3864
+ capabilities: {
3865
+ hasPlainText: true,
3866
+ hasLexicalShape: true,
3867
+ annotation: true,
3868
+ aiAnnotation: true,
3869
+ aiEnrichment: true,
3870
+ aiChatQualField: true,
3871
+ aiChatQuantField: false,
3872
+ searchable: true,
3873
+ directDataImport: true,
3874
+ csvExport: true,
3875
+ translatable: true,
3876
+ documentSummarizer: true,
3877
+ stripFromMainOnAnnoChunkSync: true
3878
+ },
3879
+ // Field paths
3880
+ fieldPaths: {
3881
+ plainTextString: "allText",
3882
+ searchField: "allText",
3883
+ displayValue: "allText"
3884
+ },
3885
+ // Validation
3886
+ validation: {
3887
+ populatedCheckFn: "lexicalTextEditorHasValue",
3888
+ formValidationFn: "lexicalTextEditorHasValue"
3889
+ },
3890
+ // Translation
3891
+ translation: {
3892
+ handlerType: "LexicalBlockHandler"
3893
+ },
3894
+ // Table rendering
3895
+ tableCell: {
3896
+ cellComp: "RichTextAsPlainTextLex",
3897
+ sortPathSuffix: "editorState.root.children.0.children.0.text"
3898
+ },
3899
+ // CSV export
3900
+ csvExport: {
3901
+ transformFn: "KPRichLexicalEditor"
3902
+ },
3903
+ // Slack
3904
+ slackFormat: {
3905
+ handlerFn: "lexicalRichText"
3906
+ },
3907
+ // Batch import
3908
+ batchImport: {
3909
+ valueInjectorFn: "toLexicalValue"
3910
+ },
3911
+ // Content block option — TCI template builder & direct import UI
3912
+ contentBlockOption: {
3913
+ display: "Rich Text Field",
3914
+ icon: "TextAa"
3915
+ },
3916
+ // Chunking config — used by okf-sub CreateChunksHandler
3917
+ chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
3918
+ };
3919
+
3920
+ // src/blockRegistry/registry.ts
3921
+ var BlockRegistry = class {
3922
+ constructor() {
3923
+ this.blocks = /* @__PURE__ */ new Map();
3924
+ this.register(LexicalTextEditor);
3925
+ }
3926
+ /** Register a block descriptor. */
3927
+ register(descriptor) {
3928
+ this.blocks.set(descriptor.compName, descriptor);
3929
+ }
3930
+ /** Get the full descriptor for a block type. Returns undefined if not registered. */
3931
+ getBlock(compType) {
3932
+ return this.blocks.get(compType);
3933
+ }
3934
+ /** Check if a block type is registered in the registry. */
3935
+ isRegistered(compType) {
3936
+ return this.blocks.has(compType);
3937
+ }
3938
+ /**
3939
+ * Get all registered block descriptors that have a given capability set to a truthy value.
3940
+ * Optionally pass a specific value to match (e.g. for enum-style capabilities).
3941
+ */
3942
+ getBlocksByCapability(capability, value = true) {
3943
+ return Array.from(this.blocks.values()).filter((b) => {
3944
+ const cap = b.capabilities[capability];
3945
+ if (value === true) return !!cap;
3946
+ return cap === value;
3947
+ });
3948
+ }
3949
+ /**
3950
+ * Get compType strings for all registered blocks with a given capability.
3951
+ * Replaces scattered hardcoded arrays like:
3952
+ * const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
3953
+ * becomes:
3954
+ * const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
3955
+ */
3956
+ getComps(capability, value = true) {
3957
+ return this.getBlocksByCapability(capability, value).map((b) => b.compName);
3958
+ }
3959
+ /** Get all registered blocks in a given category. */
3960
+ getBlocksByCategory(category) {
3961
+ return Array.from(this.blocks.values()).filter((b) => b.category === category);
3962
+ }
3963
+ /** Get compType strings for all qual blocks. */
3964
+ getQualBlocks() {
3965
+ return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
3966
+ }
3967
+ /** Get compType strings for all quant blocks. */
3968
+ getQuantBlocks() {
3969
+ return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
3970
+ }
3971
+ /** Check if a specific block has a specific capability. */
3972
+ hasCapability(compType, capability) {
3973
+ const block = this.blocks.get(compType);
3974
+ if (!block) return false;
3975
+ return !!block.capabilities[capability];
3976
+ }
3977
+ /** Get all registered block descriptors. */
3978
+ getAll() {
3979
+ return Array.from(this.blocks.values());
3980
+ }
3981
+ };
3982
+ var blockRegistry = new BlockRegistry();
3983
+
3822
3984
  // src/node.ts
3823
3985
  var import_MongoConnector3 = __toESM(require_MongoConnector());
3824
3986
  var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
@@ -4210,12 +4372,16 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
4210
4372
  BASE_BULLMQ_CONFIG,
4211
4373
  BaseProducer,
4212
4374
  BaseWorker,
4375
+ BlockRegistry,
4376
+ CHUNKING_PRESETS,
4213
4377
  ChunksElasticSyncProducer,
4378
+ ELASTIC_MAPPING_PRESETS,
4214
4379
  ElasticSearchConnector,
4215
4380
  FILTER_IDS,
4216
4381
  GET_GLOBAL_BULLMQ_CONFIG,
4217
4382
  GeneratedEntitiesSchema,
4218
4383
  GeneratedTopicsSchema,
4384
+ MONGO_SCHEMA_PRESETS,
4219
4385
  MongoConnector,
4220
4386
  PlatformConfigsSchema,
4221
4387
  ProducerManager,
@@ -4230,6 +4396,7 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
4230
4396
  _self_managed_getFixedAnnoRollupBlocks,
4231
4397
  _self_managed_getFixedAnnoTagBlock,
4232
4398
  autoGenFilterConfigsFromTpl,
4399
+ blockRegistry,
4233
4400
  buildFilterConfigurations,
4234
4401
  compareAndGroupBlocks,
4235
4402
  deleteVal,
package/dist/node.mjs CHANGED
@@ -551,8 +551,7 @@ var init_platformConfigTypes = __esm({
551
551
  "userAgreement",
552
552
  "localeData",
553
553
  "theme",
554
- "ai",
555
- "onboarding"
554
+ "ai"
556
555
  ];
557
556
  }
558
557
  });
@@ -3757,6 +3756,164 @@ var genCleanCamelCaseId = (id) => {
3757
3756
  return result.slice(0, MAX_LENGTH);
3758
3757
  };
3759
3758
 
3759
+ // src/blockRegistry/schemaPresets.ts
3760
+ var MONGO_SCHEMA_PRESETS = {
3761
+ object: { type: Object },
3762
+ string: { type: String }
3763
+ };
3764
+ var ELASTIC_MAPPING_PRESETS = {
3765
+ largeText: {
3766
+ properties: {
3767
+ allText: {
3768
+ type: "text",
3769
+ analyzer: "LargeTextAnalyzer"
3770
+ }
3771
+ }
3772
+ }
3773
+ };
3774
+ var CHUNKING_PRESETS = {
3775
+ // Lexical-shaped text — uses semantic chunking on allText
3776
+ lexicalSemantic: {
3777
+ strategy: "semanticChunking",
3778
+ windowSize: 3,
3779
+ minSimilarityScore: 0.7
3780
+ },
3781
+ // Plain text input — single chunk per field
3782
+ simpleText: {
3783
+ strategy: "simpleChunking"
3784
+ }
3785
+ };
3786
+
3787
+ // src/blockRegistry/blocks/LexicalTextEditor.ts
3788
+ var LexicalTextEditor = {
3789
+ compName: "LexicalTextEditor",
3790
+ // Identity
3791
+ category: "text",
3792
+ qualQuant: "qual",
3793
+ // Schema
3794
+ mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
3795
+ esMapping: ELASTIC_MAPPING_PRESETS.largeText,
3796
+ // Capabilities
3797
+ capabilities: {
3798
+ hasPlainText: true,
3799
+ hasLexicalShape: true,
3800
+ annotation: true,
3801
+ aiAnnotation: true,
3802
+ aiEnrichment: true,
3803
+ aiChatQualField: true,
3804
+ aiChatQuantField: false,
3805
+ searchable: true,
3806
+ directDataImport: true,
3807
+ csvExport: true,
3808
+ translatable: true,
3809
+ documentSummarizer: true,
3810
+ stripFromMainOnAnnoChunkSync: true
3811
+ },
3812
+ // Field paths
3813
+ fieldPaths: {
3814
+ plainTextString: "allText",
3815
+ searchField: "allText",
3816
+ displayValue: "allText"
3817
+ },
3818
+ // Validation
3819
+ validation: {
3820
+ populatedCheckFn: "lexicalTextEditorHasValue",
3821
+ formValidationFn: "lexicalTextEditorHasValue"
3822
+ },
3823
+ // Translation
3824
+ translation: {
3825
+ handlerType: "LexicalBlockHandler"
3826
+ },
3827
+ // Table rendering
3828
+ tableCell: {
3829
+ cellComp: "RichTextAsPlainTextLex",
3830
+ sortPathSuffix: "editorState.root.children.0.children.0.text"
3831
+ },
3832
+ // CSV export
3833
+ csvExport: {
3834
+ transformFn: "KPRichLexicalEditor"
3835
+ },
3836
+ // Slack
3837
+ slackFormat: {
3838
+ handlerFn: "lexicalRichText"
3839
+ },
3840
+ // Batch import
3841
+ batchImport: {
3842
+ valueInjectorFn: "toLexicalValue"
3843
+ },
3844
+ // Content block option — TCI template builder & direct import UI
3845
+ contentBlockOption: {
3846
+ display: "Rich Text Field",
3847
+ icon: "TextAa"
3848
+ },
3849
+ // Chunking config — used by okf-sub CreateChunksHandler
3850
+ chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
3851
+ };
3852
+
3853
+ // src/blockRegistry/registry.ts
3854
+ var BlockRegistry = class {
3855
+ constructor() {
3856
+ this.blocks = /* @__PURE__ */ new Map();
3857
+ this.register(LexicalTextEditor);
3858
+ }
3859
+ /** Register a block descriptor. */
3860
+ register(descriptor) {
3861
+ this.blocks.set(descriptor.compName, descriptor);
3862
+ }
3863
+ /** Get the full descriptor for a block type. Returns undefined if not registered. */
3864
+ getBlock(compType) {
3865
+ return this.blocks.get(compType);
3866
+ }
3867
+ /** Check if a block type is registered in the registry. */
3868
+ isRegistered(compType) {
3869
+ return this.blocks.has(compType);
3870
+ }
3871
+ /**
3872
+ * Get all registered block descriptors that have a given capability set to a truthy value.
3873
+ * Optionally pass a specific value to match (e.g. for enum-style capabilities).
3874
+ */
3875
+ getBlocksByCapability(capability, value = true) {
3876
+ return Array.from(this.blocks.values()).filter((b) => {
3877
+ const cap = b.capabilities[capability];
3878
+ if (value === true) return !!cap;
3879
+ return cap === value;
3880
+ });
3881
+ }
3882
+ /**
3883
+ * Get compType strings for all registered blocks with a given capability.
3884
+ * Replaces scattered hardcoded arrays like:
3885
+ * const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
3886
+ * becomes:
3887
+ * const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
3888
+ */
3889
+ getComps(capability, value = true) {
3890
+ return this.getBlocksByCapability(capability, value).map((b) => b.compName);
3891
+ }
3892
+ /** Get all registered blocks in a given category. */
3893
+ getBlocksByCategory(category) {
3894
+ return Array.from(this.blocks.values()).filter((b) => b.category === category);
3895
+ }
3896
+ /** Get compType strings for all qual blocks. */
3897
+ getQualBlocks() {
3898
+ return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
3899
+ }
3900
+ /** Get compType strings for all quant blocks. */
3901
+ getQuantBlocks() {
3902
+ return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
3903
+ }
3904
+ /** Check if a specific block has a specific capability. */
3905
+ hasCapability(compType, capability) {
3906
+ const block = this.blocks.get(compType);
3907
+ if (!block) return false;
3908
+ return !!block.capabilities[capability];
3909
+ }
3910
+ /** Get all registered block descriptors. */
3911
+ getAll() {
3912
+ return Array.from(this.blocks.values());
3913
+ }
3914
+ };
3915
+ var blockRegistry = new BlockRegistry();
3916
+
3760
3917
  // src/node.ts
3761
3918
  var import_MongoConnector3 = __toESM(require_MongoConnector());
3762
3919
  var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
@@ -4163,12 +4320,16 @@ export {
4163
4320
  BASE_BULLMQ_CONFIG,
4164
4321
  export_BaseProducer as BaseProducer,
4165
4322
  export_BaseWorker as BaseWorker,
4323
+ BlockRegistry,
4324
+ CHUNKING_PRESETS,
4166
4325
  export_ChunksElasticSyncProducer as ChunksElasticSyncProducer,
4326
+ ELASTIC_MAPPING_PRESETS,
4167
4327
  export_ElasticSearchConnector as ElasticSearchConnector,
4168
4328
  FILTER_IDS,
4169
4329
  export_GET_GLOBAL_BULLMQ_CONFIG as GET_GLOBAL_BULLMQ_CONFIG,
4170
4330
  GeneratedEntities_default as GeneratedEntitiesSchema,
4171
4331
  GeneratedTopics_default as GeneratedTopicsSchema,
4332
+ MONGO_SCHEMA_PRESETS,
4172
4333
  export_MongoConnector as MongoConnector,
4173
4334
  PlatformConfigs_default as PlatformConfigsSchema,
4174
4335
  export_ProducerManager as ProducerManager,
@@ -4183,6 +4344,7 @@ export {
4183
4344
  _self_managed_getFixedAnnoRollupBlocks,
4184
4345
  _self_managed_getFixedAnnoTagBlock,
4185
4346
  autoGenFilterConfigsFromTpl,
4347
+ blockRegistry,
4186
4348
  buildFilterConfigurations,
4187
4349
  compareAndGroupBlocks,
4188
4350
  deleteVal,
@@ -1367,4 +1367,186 @@ declare const UI_CONTENT: {
1367
1367
  */
1368
1368
  declare const genCleanCamelCaseId: (id: string) => string;
1369
1369
 
1370
- export { BASE_BULLMQ_CONFIG, FILTER_IDS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
1370
+ /**
1371
+ * BlockDef — single source of truth for a tplBlock's cross-cutting configuration.
1372
+ *
1373
+ * Each block type (e.g. LexicalTextEditor, TextInput) declares its capabilities,
1374
+ * schema types, field paths, validation, and translation config in one place.
1375
+ * Consumers across all repos query the registry instead of maintaining scattered arrays/switches.
1376
+ */
1377
+ interface BlockDef {
1378
+ compName: string;
1379
+ category: 'text' | 'selection' | 'tags' | 'date' | 'number' | 'media' | 'structural' | 'special';
1380
+ qualQuant: 'qual' | 'quant' | null;
1381
+ /** Mongoose schema type — the actual value returned to compToTypeMap (e.g. { type: Object }) */
1382
+ mongoSchemaType: Record<string, any>;
1383
+ /** Elasticsearch mapping shape — used directly by generateMappingsFromTpl */
1384
+ esMapping: Record<string, any> | null;
1385
+ capabilities: BlockCapabilities;
1386
+ /** Sub-paths within the block's value. null = value itself is used directly. */
1387
+ fieldPaths: {
1388
+ /** Path to get the plain text string (e.g. 'allText'). null = value itself is the string. */
1389
+ plainTextString?: string | null;
1390
+ /** Path appended to valuePath for ES/listing search (e.g. 'allText'). null = valuePath used directly. */
1391
+ searchField?: string | null;
1392
+ /** Path to get display value for table/card rendering (e.g. 'allText'). null = value itself. */
1393
+ displayValue?: string | null;
1394
+ };
1395
+ validation: {
1396
+ /** Name of the "is populated" validator fn (resolved by consumer) */
1397
+ populatedCheckFn: string;
1398
+ /** Name of form validation fn, if different from populatedCheck */
1399
+ formValidationFn?: string;
1400
+ };
1401
+ translation?: {
1402
+ /** Handler type for auto-translation (e.g. 'lexical', 'text', 'tags', 'rte') */
1403
+ handlerType: string;
1404
+ };
1405
+ tableCell?: {
1406
+ /** The cell component to render in table view (e.g. 'RichTextAsPlainTextLex') */
1407
+ cellComp: string;
1408
+ /** Sub-path appended to valuePath for backend sort (e.g. 'editorState.root.children.0.children.0.text') */
1409
+ sortPathSuffix?: string;
1410
+ /** Extra props to pass to the cell component */
1411
+ cellProps?: Record<string, any>;
1412
+ };
1413
+ csvExport?: {
1414
+ /** Transform function name for CSV export */
1415
+ transformFn: string;
1416
+ };
1417
+ slackFormat?: {
1418
+ /** Handler function name for Slack message formatting */
1419
+ handlerFn: string;
1420
+ };
1421
+ batchImport?: {
1422
+ /** Function name that transforms raw import value into the block's expected shape */
1423
+ valueInjectorFn: string;
1424
+ };
1425
+ /** How this block renders as a selectable option in TCI template builder and direct import UI */
1426
+ contentBlockOption?: {
1427
+ display: string;
1428
+ icon?: string;
1429
+ iconWeight?: string;
1430
+ displayInDirectImportUI?: string;
1431
+ };
1432
+ /** Full chunking config used by okf-sub CreateChunksHandler */
1433
+ chunkingConfig?: {
1434
+ strategy: string;
1435
+ [key: string]: any;
1436
+ };
1437
+ }
1438
+ interface BlockCapabilities {
1439
+ /** Block's value contains extractable plain text (even if value also has other structure like JSON) */
1440
+ hasPlainText: boolean;
1441
+ /** Block's value is in the Lexical shape — editorState, allText, etc. */
1442
+ hasLexicalShape: boolean;
1443
+ /**
1444
+ * General annotation flag — this block type supports annotation
1445
+ * (human, human-in-the-loop, or AI). Used by general checks: should the
1446
+ * annotation UI render, should we scan this field for anno data, should we
1447
+ * queue an annos rebuild, should this field appear in annotation explorer, etc.
1448
+ */
1449
+ annotation: boolean;
1450
+ /**
1451
+ * AI auto-annotation flag — AI auto-annotation and human-in-the-loop
1452
+ * annotation pipelines should process this block type. Subset of `annotation`
1453
+ * — only meaningful when annotation is also true. Used by AI suggestion services
1454
+ * and auto-annotation pipelines.
1455
+ */
1456
+ aiAnnotation: boolean;
1457
+ /** Supports AI enrichment — categorization, sentiment analysis, NER */
1458
+ aiEnrichment: boolean;
1459
+ /** Treated as qualitative in AI Chat? */
1460
+ aiChatQualField: boolean;
1461
+ /** Treated as quantitative in AI Chat? */
1462
+ aiChatQuantField: boolean;
1463
+ /** Can be searched via ES/listing search? */
1464
+ searchable: boolean;
1465
+ /** Supported in direct data import? */
1466
+ directDataImport: boolean;
1467
+ /** Has CSV export transform? */
1468
+ csvExport: boolean;
1469
+ /** Supports auto-translation? */
1470
+ translatable: boolean;
1471
+ /** Included in document summarizer? */
1472
+ documentSummarizer: boolean;
1473
+ /**
1474
+ * Strip this block's value from `main` when syncing to chunks/annos collections.
1475
+ * Used for large-payload blocks (like Lexical) to avoid duplicating their full text
1476
+ * in chunk/anno metadata — the actual text already lives in the chunks/annos themselves.
1477
+ */
1478
+ stripFromMainOnAnnoChunkSync: boolean;
1479
+ }
1480
+
1481
+ /**
1482
+ * Shared schema presets for mongoSchemaType and esMapping.
1483
+ *
1484
+ * RULE: All mongo schema types and ES mappings MUST be defined here as presets.
1485
+ * Block defs reference these — never define schema shapes inline in a block def.
1486
+ */
1487
+ declare const MONGO_SCHEMA_PRESETS: {
1488
+ readonly object: {
1489
+ readonly type: ObjectConstructor;
1490
+ };
1491
+ readonly string: {
1492
+ readonly type: StringConstructor;
1493
+ };
1494
+ };
1495
+ declare const ELASTIC_MAPPING_PRESETS: {
1496
+ readonly largeText: {
1497
+ readonly properties: {
1498
+ readonly allText: {
1499
+ readonly type: "text";
1500
+ readonly analyzer: "LargeTextAnalyzer";
1501
+ };
1502
+ };
1503
+ };
1504
+ };
1505
+ declare const CHUNKING_PRESETS: {
1506
+ readonly lexicalSemantic: {
1507
+ readonly strategy: "semanticChunking";
1508
+ readonly windowSize: 3;
1509
+ readonly minSimilarityScore: 0.7;
1510
+ };
1511
+ readonly simpleText: {
1512
+ readonly strategy: "simpleChunking";
1513
+ };
1514
+ };
1515
+
1516
+ declare class BlockRegistry {
1517
+ private blocks;
1518
+ constructor();
1519
+ /** Register a block descriptor. */
1520
+ register(descriptor: BlockDef): void;
1521
+ /** Get the full descriptor for a block type. Returns undefined if not registered. */
1522
+ getBlock(compType: string): BlockDef | undefined;
1523
+ /** Check if a block type is registered in the registry. */
1524
+ isRegistered(compType: string): boolean;
1525
+ /**
1526
+ * Get all registered block descriptors that have a given capability set to a truthy value.
1527
+ * Optionally pass a specific value to match (e.g. for enum-style capabilities).
1528
+ */
1529
+ getBlocksByCapability(capability: keyof BlockCapabilities, value?: boolean | string): BlockDef[];
1530
+ /**
1531
+ * Get compType strings for all registered blocks with a given capability.
1532
+ * Replaces scattered hardcoded arrays like:
1533
+ * const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
1534
+ * becomes:
1535
+ * const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
1536
+ */
1537
+ getComps(capability: keyof BlockCapabilities, value?: boolean | string): string[];
1538
+ /** Get all registered blocks in a given category. */
1539
+ getBlocksByCategory(category: BlockDef['category']): BlockDef[];
1540
+ /** Get compType strings for all qual blocks. */
1541
+ getQualBlocks(): string[];
1542
+ /** Get compType strings for all quant blocks. */
1543
+ getQuantBlocks(): string[];
1544
+ /** Check if a specific block has a specific capability. */
1545
+ hasCapability(compType: string, capability: keyof BlockCapabilities): boolean;
1546
+ /** Get all registered block descriptors. */
1547
+ getAll(): BlockDef[];
1548
+ }
1549
+ /** Singleton instance — the one registry shared across the app. */
1550
+ declare const blockRegistry: BlockRegistry;
1551
+
1552
+ 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, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };