@okf/ootils 1.31.2 → 1.31.4
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/browser.d.mts +36 -3
- package/dist/browser.d.ts +36 -3
- package/dist/browser.js +213 -186
- package/dist/browser.mjs +212 -186
- package/dist/node.d.mts +36 -3
- package/dist/node.d.ts +36 -3
- package/dist/node.js +213 -186
- package/dist/node.mjs +212 -186
- package/dist/universal.d.mts +36 -3
- package/dist/universal.d.ts +36 -3
- package/dist/universal.js +213 -186
- package/dist/universal.mjs +212 -186
- package/package.json +1 -1
package/dist/universal.mjs
CHANGED
|
@@ -309,6 +309,210 @@ var _extractBlocksFromSomeBuilders = ({
|
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
+
// src/blockRegistry/schemaPresets.ts
|
|
313
|
+
var MONGO_SCHEMA_PRESETS = {
|
|
314
|
+
object: { type: Object },
|
|
315
|
+
string: { type: String }
|
|
316
|
+
};
|
|
317
|
+
var ELASTIC_MAPPING_PRESETS = {
|
|
318
|
+
largeText: {
|
|
319
|
+
properties: {
|
|
320
|
+
allText: {
|
|
321
|
+
type: "text",
|
|
322
|
+
analyzer: "LargeTextAnalyzer"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
var CHUNKING_PRESETS = {
|
|
328
|
+
// Lexical-shaped text — uses semantic chunking on allText
|
|
329
|
+
lexicalSemantic: {
|
|
330
|
+
strategy: "semanticChunking",
|
|
331
|
+
windowSize: 3,
|
|
332
|
+
minSimilarityScore: 0.7
|
|
333
|
+
},
|
|
334
|
+
// Plain text input — single chunk per field
|
|
335
|
+
simpleText: {
|
|
336
|
+
strategy: "simpleChunking"
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// src/blockRegistry/blocks/LexicalTextEditor.ts
|
|
341
|
+
var LexicalTextEditor = {
|
|
342
|
+
compName: "LexicalTextEditor",
|
|
343
|
+
// Identity
|
|
344
|
+
category: "text",
|
|
345
|
+
qualQuant: "qual",
|
|
346
|
+
// Schema
|
|
347
|
+
mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
|
|
348
|
+
esMapping: ELASTIC_MAPPING_PRESETS.largeText,
|
|
349
|
+
// Capabilities
|
|
350
|
+
capabilities: {
|
|
351
|
+
hasPlainText: true,
|
|
352
|
+
annotation: true,
|
|
353
|
+
aiAnnotation: true,
|
|
354
|
+
aiEnrichment: true,
|
|
355
|
+
searchable: true,
|
|
356
|
+
directDataImport: true,
|
|
357
|
+
csvExport: true,
|
|
358
|
+
translatable: true,
|
|
359
|
+
documentSummarizer: true,
|
|
360
|
+
stripFromMainOnAnnoChunkSync: true,
|
|
361
|
+
excludeFromListingProjection: true
|
|
362
|
+
},
|
|
363
|
+
// Field paths
|
|
364
|
+
fieldPaths: {
|
|
365
|
+
plainTextString: "allText",
|
|
366
|
+
searchField: "allText",
|
|
367
|
+
displayValue: "allText"
|
|
368
|
+
},
|
|
369
|
+
// Validation
|
|
370
|
+
validation: {
|
|
371
|
+
populatedCheckFn: "lexicalTextEditorHasValue",
|
|
372
|
+
formValidationFn: "lexicalTextEditorHasValue"
|
|
373
|
+
},
|
|
374
|
+
// Translation
|
|
375
|
+
translation: {
|
|
376
|
+
handlerType: "LexicalBlockHandler"
|
|
377
|
+
},
|
|
378
|
+
// Table rendering
|
|
379
|
+
tableCell: {
|
|
380
|
+
cellComp: "RichTextAsPlainTextLex",
|
|
381
|
+
sortPathSuffix: "editorState.root.children.0.children.0.text"
|
|
382
|
+
},
|
|
383
|
+
// CSV export
|
|
384
|
+
csvExport: {
|
|
385
|
+
transformFn: "KPRichLexicalEditor"
|
|
386
|
+
},
|
|
387
|
+
// Slack
|
|
388
|
+
slackFormat: {
|
|
389
|
+
handlerFn: "lexicalRichText"
|
|
390
|
+
},
|
|
391
|
+
// Batch import
|
|
392
|
+
batchImport: {
|
|
393
|
+
valueInjectorFn: "toLexicalValue"
|
|
394
|
+
},
|
|
395
|
+
// Content block option — TCI template builder & direct import UI
|
|
396
|
+
contentBlockOption: {
|
|
397
|
+
display: "Rich Text Field",
|
|
398
|
+
icon: "TextAa",
|
|
399
|
+
directImportGroupsIdx: [2, 2]
|
|
400
|
+
},
|
|
401
|
+
// Chunking config — used by okf-sub CreateChunksHandler
|
|
402
|
+
chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// src/blockRegistry/registry.ts
|
|
406
|
+
var BlockRegistry = class {
|
|
407
|
+
constructor() {
|
|
408
|
+
this.blocks = /* @__PURE__ */ new Map();
|
|
409
|
+
this.register(LexicalTextEditor);
|
|
410
|
+
}
|
|
411
|
+
/** Register a block descriptor. */
|
|
412
|
+
register(descriptor) {
|
|
413
|
+
this.blocks.set(descriptor.compName, descriptor);
|
|
414
|
+
}
|
|
415
|
+
/** Get the full descriptor for a block type. Returns undefined if not registered. */
|
|
416
|
+
getBlock(compType) {
|
|
417
|
+
return this.blocks.get(compType);
|
|
418
|
+
}
|
|
419
|
+
/** Check if a block type is registered in the registry. */
|
|
420
|
+
isRegistered(compType) {
|
|
421
|
+
return this.blocks.has(compType);
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Get all registered block descriptors that have a given capability set to a truthy value.
|
|
425
|
+
* Optionally pass a specific value to match (e.g. for enum-style capabilities).
|
|
426
|
+
*/
|
|
427
|
+
getBlocksByCapability(capability, value = true) {
|
|
428
|
+
return Array.from(this.blocks.values()).filter((b) => {
|
|
429
|
+
const cap = b.capabilities[capability];
|
|
430
|
+
if (value === true) return !!cap;
|
|
431
|
+
return cap === value;
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Get compType strings for all registered blocks with a given capability.
|
|
436
|
+
* Replaces scattered hardcoded arrays like:
|
|
437
|
+
* const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
|
|
438
|
+
* becomes:
|
|
439
|
+
* const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
|
|
440
|
+
*/
|
|
441
|
+
getComps(capability, value = true) {
|
|
442
|
+
return this.getBlocksByCapability(capability, value).map((b) => b.compName);
|
|
443
|
+
}
|
|
444
|
+
/** Get all registered blocks in a given category. */
|
|
445
|
+
getBlocksByCategory(category) {
|
|
446
|
+
return Array.from(this.blocks.values()).filter((b) => b.category === category);
|
|
447
|
+
}
|
|
448
|
+
/** Get compType strings for all qual blocks. */
|
|
449
|
+
getQualBlocks() {
|
|
450
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
|
|
451
|
+
}
|
|
452
|
+
/** Get compType strings for all quant blocks. */
|
|
453
|
+
getQuantBlocks() {
|
|
454
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
|
|
455
|
+
}
|
|
456
|
+
/** Check if a specific block has a specific capability. */
|
|
457
|
+
hasCapability(compType, capability) {
|
|
458
|
+
const block = this.blocks.get(compType);
|
|
459
|
+
if (!block) return false;
|
|
460
|
+
return !!block.capabilities[capability];
|
|
461
|
+
}
|
|
462
|
+
/** Get all registered block descriptors. */
|
|
463
|
+
getAll() {
|
|
464
|
+
return Array.from(this.blocks.values());
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Get compName strings for all registered blocks that have a chunking config.
|
|
468
|
+
* Used by chunking pipelines and prompt-string injection (e.g. searchChunks tool
|
|
469
|
+
* description) to know which fields actually have chunks to search.
|
|
470
|
+
*/
|
|
471
|
+
getCompsWithChunking() {
|
|
472
|
+
return Array.from(this.blocks.values()).filter((b) => !!b.chunkingConfig).map((b) => b.compName);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Filter a list of block instances down to those where annotation is enabled.
|
|
476
|
+
* A block is annotation-enabled if its registry capability `annotation` is true.
|
|
477
|
+
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
478
|
+
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
479
|
+
*
|
|
480
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is auto-enabled.
|
|
481
|
+
*/
|
|
482
|
+
getAnnotationEnabledBlocks(allBlocks) {
|
|
483
|
+
return allBlocks.filter((block) => {
|
|
484
|
+
const blockDef = this.blocks.get(block.comp);
|
|
485
|
+
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
486
|
+
return block.props?.annotation?.enable === true;
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
491
|
+
*
|
|
492
|
+
* Resolution order:
|
|
493
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
494
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
495
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
496
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
497
|
+
* Pass null/undefined for non-SM tenants.
|
|
498
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
499
|
+
* 3. Empty array.
|
|
500
|
+
*/
|
|
501
|
+
getTagTypesConfig(block, hardCodedTagTypesConfigForSM) {
|
|
502
|
+
return hardCodedTagTypesConfigForSM || block.props?.annotation?.tagTypesConfig || [];
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
var blockRegistry = new BlockRegistry();
|
|
506
|
+
|
|
507
|
+
// src/utils/isTplAnnotationEnabled.ts
|
|
508
|
+
var isTplAnnotationEnabled = (tpl) => {
|
|
509
|
+
if (tpl?.general?.segment !== "publishing") return false;
|
|
510
|
+
const allBlocks = extractAllBlocksFromTpl({ tpl }).filter(
|
|
511
|
+
(b) => typeof b.comp === "string"
|
|
512
|
+
);
|
|
513
|
+
return blockRegistry.getAnnotationEnabledBlocks(allBlocks).length > 0;
|
|
514
|
+
};
|
|
515
|
+
|
|
312
516
|
// src/utils/getRollupPossibilities.ts
|
|
313
517
|
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
314
518
|
function getRollupPossibilities({
|
|
@@ -1389,7 +1593,7 @@ var compareAndGroupBlocks = (blocksPerTpl) => {
|
|
|
1389
1593
|
};
|
|
1390
1594
|
|
|
1391
1595
|
// src/utils/autoGenFilterConfigsFromTpl/utils/extractAndOrganizeBlocks.ts
|
|
1392
|
-
var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
1596
|
+
var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}) => {
|
|
1393
1597
|
const extractedBlocks = {};
|
|
1394
1598
|
const templateBlocksCache = /* @__PURE__ */ new Map();
|
|
1395
1599
|
const getCachedBlocks = (tpl) => {
|
|
@@ -1400,7 +1604,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
1400
1604
|
};
|
|
1401
1605
|
extractedBlocks.annoTagBlocks = selectedTpls.map((tpl) => {
|
|
1402
1606
|
const allBlocks = getCachedBlocks(tpl);
|
|
1403
|
-
const allTagTypes = allBlocks.
|
|
1607
|
+
const allTagTypes = blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig).map((d) => d.tagType));
|
|
1404
1608
|
const uniqueTagTypes = [...new Set(allTagTypes)];
|
|
1405
1609
|
return {
|
|
1406
1610
|
contentType: tpl.kp_content_type,
|
|
@@ -1414,13 +1618,13 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
1414
1618
|
const allBlocks = getCachedBlocks(tpl);
|
|
1415
1619
|
return {
|
|
1416
1620
|
contentType: tpl.kp_content_type,
|
|
1417
|
-
blocks:
|
|
1621
|
+
blocks: blockRegistry.getAnnotationEnabledBlocks(allBlocks)
|
|
1418
1622
|
};
|
|
1419
1623
|
});
|
|
1420
1624
|
extractedBlocks.annoRollupBlocks = selectedTpls.map((tpl) => {
|
|
1421
1625
|
const allBlocks = getCachedBlocks(tpl);
|
|
1422
1626
|
const uniqueTagTypes = Array.from(new Set(
|
|
1423
|
-
|
|
1627
|
+
blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig)).map((conf) => conf.tagType)
|
|
1424
1628
|
));
|
|
1425
1629
|
return {
|
|
1426
1630
|
contentType: tpl.kp_content_type,
|
|
@@ -2067,9 +2271,10 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
2067
2271
|
allTpls,
|
|
2068
2272
|
filterScopes,
|
|
2069
2273
|
isSelfManagedTenant = false,
|
|
2070
|
-
annotationTagsCount
|
|
2274
|
+
annotationTagsCount,
|
|
2275
|
+
smTagTypesConfig
|
|
2071
2276
|
}) => {
|
|
2072
|
-
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls);
|
|
2277
|
+
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls, { smTagTypesConfig });
|
|
2073
2278
|
const allAnnoEnabledBlocks = filterScopes.includes("anno") ? extractedBlocks.annoEnabledBlocks.flatMap((item) => item.blocks).reduce((acc, block) => {
|
|
2074
2279
|
if (!acc.find((b) => b.valuePath === block.valuePath)) {
|
|
2075
2280
|
acc.push(block);
|
|
@@ -2190,186 +2395,6 @@ var genCleanCamelCaseId = (id) => {
|
|
|
2190
2395
|
if (/^\d/.test(result)) result = "a" + result;
|
|
2191
2396
|
return result.slice(0, MAX_LENGTH);
|
|
2192
2397
|
};
|
|
2193
|
-
|
|
2194
|
-
// src/blockRegistry/schemaPresets.ts
|
|
2195
|
-
var MONGO_SCHEMA_PRESETS = {
|
|
2196
|
-
object: { type: Object },
|
|
2197
|
-
string: { type: String }
|
|
2198
|
-
};
|
|
2199
|
-
var ELASTIC_MAPPING_PRESETS = {
|
|
2200
|
-
largeText: {
|
|
2201
|
-
properties: {
|
|
2202
|
-
allText: {
|
|
2203
|
-
type: "text",
|
|
2204
|
-
analyzer: "LargeTextAnalyzer"
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
};
|
|
2209
|
-
var CHUNKING_PRESETS = {
|
|
2210
|
-
// Lexical-shaped text — uses semantic chunking on allText
|
|
2211
|
-
lexicalSemantic: {
|
|
2212
|
-
strategy: "semanticChunking",
|
|
2213
|
-
windowSize: 3,
|
|
2214
|
-
minSimilarityScore: 0.7
|
|
2215
|
-
},
|
|
2216
|
-
// Plain text input — single chunk per field
|
|
2217
|
-
simpleText: {
|
|
2218
|
-
strategy: "simpleChunking"
|
|
2219
|
-
}
|
|
2220
|
-
};
|
|
2221
|
-
|
|
2222
|
-
// src/blockRegistry/blocks/LexicalTextEditor.ts
|
|
2223
|
-
var LexicalTextEditor = {
|
|
2224
|
-
compName: "LexicalTextEditor",
|
|
2225
|
-
// Identity
|
|
2226
|
-
category: "text",
|
|
2227
|
-
qualQuant: "qual",
|
|
2228
|
-
// Schema
|
|
2229
|
-
mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
|
|
2230
|
-
esMapping: ELASTIC_MAPPING_PRESETS.largeText,
|
|
2231
|
-
// Capabilities
|
|
2232
|
-
capabilities: {
|
|
2233
|
-
hasPlainText: true,
|
|
2234
|
-
annotation: true,
|
|
2235
|
-
aiAnnotation: true,
|
|
2236
|
-
aiEnrichment: true,
|
|
2237
|
-
searchable: true,
|
|
2238
|
-
directDataImport: true,
|
|
2239
|
-
csvExport: true,
|
|
2240
|
-
translatable: true,
|
|
2241
|
-
documentSummarizer: true,
|
|
2242
|
-
stripFromMainOnAnnoChunkSync: true,
|
|
2243
|
-
excludeFromListingProjection: true
|
|
2244
|
-
},
|
|
2245
|
-
// Field paths
|
|
2246
|
-
fieldPaths: {
|
|
2247
|
-
plainTextString: "allText",
|
|
2248
|
-
searchField: "allText",
|
|
2249
|
-
displayValue: "allText"
|
|
2250
|
-
},
|
|
2251
|
-
// Validation
|
|
2252
|
-
validation: {
|
|
2253
|
-
populatedCheckFn: "lexicalTextEditorHasValue",
|
|
2254
|
-
formValidationFn: "lexicalTextEditorHasValue"
|
|
2255
|
-
},
|
|
2256
|
-
// Translation
|
|
2257
|
-
translation: {
|
|
2258
|
-
handlerType: "LexicalBlockHandler"
|
|
2259
|
-
},
|
|
2260
|
-
// Table rendering
|
|
2261
|
-
tableCell: {
|
|
2262
|
-
cellComp: "RichTextAsPlainTextLex",
|
|
2263
|
-
sortPathSuffix: "editorState.root.children.0.children.0.text"
|
|
2264
|
-
},
|
|
2265
|
-
// CSV export
|
|
2266
|
-
csvExport: {
|
|
2267
|
-
transformFn: "KPRichLexicalEditor"
|
|
2268
|
-
},
|
|
2269
|
-
// Slack
|
|
2270
|
-
slackFormat: {
|
|
2271
|
-
handlerFn: "lexicalRichText"
|
|
2272
|
-
},
|
|
2273
|
-
// Batch import
|
|
2274
|
-
batchImport: {
|
|
2275
|
-
valueInjectorFn: "toLexicalValue"
|
|
2276
|
-
},
|
|
2277
|
-
// Content block option — TCI template builder & direct import UI
|
|
2278
|
-
contentBlockOption: {
|
|
2279
|
-
display: "Rich Text Field",
|
|
2280
|
-
icon: "TextAa",
|
|
2281
|
-
directImportGroupsIdx: [2, 2]
|
|
2282
|
-
},
|
|
2283
|
-
// Chunking config — used by okf-sub CreateChunksHandler
|
|
2284
|
-
chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
|
|
2285
|
-
};
|
|
2286
|
-
|
|
2287
|
-
// src/blockRegistry/registry.ts
|
|
2288
|
-
var BlockRegistry = class {
|
|
2289
|
-
constructor() {
|
|
2290
|
-
this.blocks = /* @__PURE__ */ new Map();
|
|
2291
|
-
this.register(LexicalTextEditor);
|
|
2292
|
-
}
|
|
2293
|
-
/** Register a block descriptor. */
|
|
2294
|
-
register(descriptor) {
|
|
2295
|
-
this.blocks.set(descriptor.compName, descriptor);
|
|
2296
|
-
}
|
|
2297
|
-
/** Get the full descriptor for a block type. Returns undefined if not registered. */
|
|
2298
|
-
getBlock(compType) {
|
|
2299
|
-
return this.blocks.get(compType);
|
|
2300
|
-
}
|
|
2301
|
-
/** Check if a block type is registered in the registry. */
|
|
2302
|
-
isRegistered(compType) {
|
|
2303
|
-
return this.blocks.has(compType);
|
|
2304
|
-
}
|
|
2305
|
-
/**
|
|
2306
|
-
* Get all registered block descriptors that have a given capability set to a truthy value.
|
|
2307
|
-
* Optionally pass a specific value to match (e.g. for enum-style capabilities).
|
|
2308
|
-
*/
|
|
2309
|
-
getBlocksByCapability(capability, value = true) {
|
|
2310
|
-
return Array.from(this.blocks.values()).filter((b) => {
|
|
2311
|
-
const cap = b.capabilities[capability];
|
|
2312
|
-
if (value === true) return !!cap;
|
|
2313
|
-
return cap === value;
|
|
2314
|
-
});
|
|
2315
|
-
}
|
|
2316
|
-
/**
|
|
2317
|
-
* Get compType strings for all registered blocks with a given capability.
|
|
2318
|
-
* Replaces scattered hardcoded arrays like:
|
|
2319
|
-
* const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
|
|
2320
|
-
* becomes:
|
|
2321
|
-
* const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
|
|
2322
|
-
*/
|
|
2323
|
-
getComps(capability, value = true) {
|
|
2324
|
-
return this.getBlocksByCapability(capability, value).map((b) => b.compName);
|
|
2325
|
-
}
|
|
2326
|
-
/** Get all registered blocks in a given category. */
|
|
2327
|
-
getBlocksByCategory(category) {
|
|
2328
|
-
return Array.from(this.blocks.values()).filter((b) => b.category === category);
|
|
2329
|
-
}
|
|
2330
|
-
/** Get compType strings for all qual blocks. */
|
|
2331
|
-
getQualBlocks() {
|
|
2332
|
-
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
|
|
2333
|
-
}
|
|
2334
|
-
/** Get compType strings for all quant blocks. */
|
|
2335
|
-
getQuantBlocks() {
|
|
2336
|
-
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
|
|
2337
|
-
}
|
|
2338
|
-
/** Check if a specific block has a specific capability. */
|
|
2339
|
-
hasCapability(compType, capability) {
|
|
2340
|
-
const block = this.blocks.get(compType);
|
|
2341
|
-
if (!block) return false;
|
|
2342
|
-
return !!block.capabilities[capability];
|
|
2343
|
-
}
|
|
2344
|
-
/** Get all registered block descriptors. */
|
|
2345
|
-
getAll() {
|
|
2346
|
-
return Array.from(this.blocks.values());
|
|
2347
|
-
}
|
|
2348
|
-
/**
|
|
2349
|
-
* Get compName strings for all registered blocks that have a chunking config.
|
|
2350
|
-
* Used by chunking pipelines and prompt-string injection (e.g. searchChunks tool
|
|
2351
|
-
* description) to know which fields actually have chunks to search.
|
|
2352
|
-
*/
|
|
2353
|
-
getCompsWithChunking() {
|
|
2354
|
-
return Array.from(this.blocks.values()).filter((b) => !!b.chunkingConfig).map((b) => b.compName);
|
|
2355
|
-
}
|
|
2356
|
-
/**
|
|
2357
|
-
* Filter a list of block instances down to those where annotation is enabled.
|
|
2358
|
-
* A block is annotation-enabled if its registry capability `annotation` is true.
|
|
2359
|
-
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2360
|
-
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2361
|
-
*
|
|
2362
|
-
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is auto-enabled.
|
|
2363
|
-
*/
|
|
2364
|
-
getAnnotationEnabledBlocks(allBlocks) {
|
|
2365
|
-
return allBlocks.filter((block) => {
|
|
2366
|
-
const blockDef = this.blocks.get(block.comp);
|
|
2367
|
-
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
2368
|
-
return block.props?.annotation?.enable === true;
|
|
2369
|
-
});
|
|
2370
|
-
}
|
|
2371
|
-
};
|
|
2372
|
-
var blockRegistry = new BlockRegistry();
|
|
2373
2398
|
export {
|
|
2374
2399
|
BASE_BULLMQ_CONFIG,
|
|
2375
2400
|
BlockRegistry,
|
|
@@ -2405,6 +2430,7 @@ export {
|
|
|
2405
2430
|
getRoutePathToTCI,
|
|
2406
2431
|
getRoutePathToTagCategoryLanding,
|
|
2407
2432
|
getVal,
|
|
2433
|
+
isTplAnnotationEnabled,
|
|
2408
2434
|
mergeAnnoDataIntoAnnotationsTags,
|
|
2409
2435
|
parseSpecialConfigSyntax,
|
|
2410
2436
|
processAuthorAndCommonFilters,
|