@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/node.mjs
CHANGED
|
@@ -2286,6 +2286,210 @@ var _extractBlocksFromSomeBuilders = ({
|
|
|
2286
2286
|
}
|
|
2287
2287
|
};
|
|
2288
2288
|
|
|
2289
|
+
// src/blockRegistry/schemaPresets.ts
|
|
2290
|
+
var MONGO_SCHEMA_PRESETS = {
|
|
2291
|
+
object: { type: Object },
|
|
2292
|
+
string: { type: String }
|
|
2293
|
+
};
|
|
2294
|
+
var ELASTIC_MAPPING_PRESETS = {
|
|
2295
|
+
largeText: {
|
|
2296
|
+
properties: {
|
|
2297
|
+
allText: {
|
|
2298
|
+
type: "text",
|
|
2299
|
+
analyzer: "LargeTextAnalyzer"
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
};
|
|
2304
|
+
var CHUNKING_PRESETS = {
|
|
2305
|
+
// Lexical-shaped text — uses semantic chunking on allText
|
|
2306
|
+
lexicalSemantic: {
|
|
2307
|
+
strategy: "semanticChunking",
|
|
2308
|
+
windowSize: 3,
|
|
2309
|
+
minSimilarityScore: 0.7
|
|
2310
|
+
},
|
|
2311
|
+
// Plain text input — single chunk per field
|
|
2312
|
+
simpleText: {
|
|
2313
|
+
strategy: "simpleChunking"
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
|
|
2317
|
+
// src/blockRegistry/blocks/LexicalTextEditor.ts
|
|
2318
|
+
var LexicalTextEditor = {
|
|
2319
|
+
compName: "LexicalTextEditor",
|
|
2320
|
+
// Identity
|
|
2321
|
+
category: "text",
|
|
2322
|
+
qualQuant: "qual",
|
|
2323
|
+
// Schema
|
|
2324
|
+
mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
|
|
2325
|
+
esMapping: ELASTIC_MAPPING_PRESETS.largeText,
|
|
2326
|
+
// Capabilities
|
|
2327
|
+
capabilities: {
|
|
2328
|
+
hasPlainText: true,
|
|
2329
|
+
annotation: true,
|
|
2330
|
+
aiAnnotation: true,
|
|
2331
|
+
aiEnrichment: true,
|
|
2332
|
+
searchable: true,
|
|
2333
|
+
directDataImport: true,
|
|
2334
|
+
csvExport: true,
|
|
2335
|
+
translatable: true,
|
|
2336
|
+
documentSummarizer: true,
|
|
2337
|
+
stripFromMainOnAnnoChunkSync: true,
|
|
2338
|
+
excludeFromListingProjection: true
|
|
2339
|
+
},
|
|
2340
|
+
// Field paths
|
|
2341
|
+
fieldPaths: {
|
|
2342
|
+
plainTextString: "allText",
|
|
2343
|
+
searchField: "allText",
|
|
2344
|
+
displayValue: "allText"
|
|
2345
|
+
},
|
|
2346
|
+
// Validation
|
|
2347
|
+
validation: {
|
|
2348
|
+
populatedCheckFn: "lexicalTextEditorHasValue",
|
|
2349
|
+
formValidationFn: "lexicalTextEditorHasValue"
|
|
2350
|
+
},
|
|
2351
|
+
// Translation
|
|
2352
|
+
translation: {
|
|
2353
|
+
handlerType: "LexicalBlockHandler"
|
|
2354
|
+
},
|
|
2355
|
+
// Table rendering
|
|
2356
|
+
tableCell: {
|
|
2357
|
+
cellComp: "RichTextAsPlainTextLex",
|
|
2358
|
+
sortPathSuffix: "editorState.root.children.0.children.0.text"
|
|
2359
|
+
},
|
|
2360
|
+
// CSV export
|
|
2361
|
+
csvExport: {
|
|
2362
|
+
transformFn: "KPRichLexicalEditor"
|
|
2363
|
+
},
|
|
2364
|
+
// Slack
|
|
2365
|
+
slackFormat: {
|
|
2366
|
+
handlerFn: "lexicalRichText"
|
|
2367
|
+
},
|
|
2368
|
+
// Batch import
|
|
2369
|
+
batchImport: {
|
|
2370
|
+
valueInjectorFn: "toLexicalValue"
|
|
2371
|
+
},
|
|
2372
|
+
// Content block option — TCI template builder & direct import UI
|
|
2373
|
+
contentBlockOption: {
|
|
2374
|
+
display: "Rich Text Field",
|
|
2375
|
+
icon: "TextAa",
|
|
2376
|
+
directImportGroupsIdx: [2, 2]
|
|
2377
|
+
},
|
|
2378
|
+
// Chunking config — used by okf-sub CreateChunksHandler
|
|
2379
|
+
chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
|
|
2380
|
+
};
|
|
2381
|
+
|
|
2382
|
+
// src/blockRegistry/registry.ts
|
|
2383
|
+
var BlockRegistry = class {
|
|
2384
|
+
constructor() {
|
|
2385
|
+
this.blocks = /* @__PURE__ */ new Map();
|
|
2386
|
+
this.register(LexicalTextEditor);
|
|
2387
|
+
}
|
|
2388
|
+
/** Register a block descriptor. */
|
|
2389
|
+
register(descriptor) {
|
|
2390
|
+
this.blocks.set(descriptor.compName, descriptor);
|
|
2391
|
+
}
|
|
2392
|
+
/** Get the full descriptor for a block type. Returns undefined if not registered. */
|
|
2393
|
+
getBlock(compType) {
|
|
2394
|
+
return this.blocks.get(compType);
|
|
2395
|
+
}
|
|
2396
|
+
/** Check if a block type is registered in the registry. */
|
|
2397
|
+
isRegistered(compType) {
|
|
2398
|
+
return this.blocks.has(compType);
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* Get all registered block descriptors that have a given capability set to a truthy value.
|
|
2402
|
+
* Optionally pass a specific value to match (e.g. for enum-style capabilities).
|
|
2403
|
+
*/
|
|
2404
|
+
getBlocksByCapability(capability, value = true) {
|
|
2405
|
+
return Array.from(this.blocks.values()).filter((b) => {
|
|
2406
|
+
const cap = b.capabilities[capability];
|
|
2407
|
+
if (value === true) return !!cap;
|
|
2408
|
+
return cap === value;
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
/**
|
|
2412
|
+
* Get compType strings for all registered blocks with a given capability.
|
|
2413
|
+
* Replaces scattered hardcoded arrays like:
|
|
2414
|
+
* const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
|
|
2415
|
+
* becomes:
|
|
2416
|
+
* const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
|
|
2417
|
+
*/
|
|
2418
|
+
getComps(capability, value = true) {
|
|
2419
|
+
return this.getBlocksByCapability(capability, value).map((b) => b.compName);
|
|
2420
|
+
}
|
|
2421
|
+
/** Get all registered blocks in a given category. */
|
|
2422
|
+
getBlocksByCategory(category) {
|
|
2423
|
+
return Array.from(this.blocks.values()).filter((b) => b.category === category);
|
|
2424
|
+
}
|
|
2425
|
+
/** Get compType strings for all qual blocks. */
|
|
2426
|
+
getQualBlocks() {
|
|
2427
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
|
|
2428
|
+
}
|
|
2429
|
+
/** Get compType strings for all quant blocks. */
|
|
2430
|
+
getQuantBlocks() {
|
|
2431
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
|
|
2432
|
+
}
|
|
2433
|
+
/** Check if a specific block has a specific capability. */
|
|
2434
|
+
hasCapability(compType, capability) {
|
|
2435
|
+
const block = this.blocks.get(compType);
|
|
2436
|
+
if (!block) return false;
|
|
2437
|
+
return !!block.capabilities[capability];
|
|
2438
|
+
}
|
|
2439
|
+
/** Get all registered block descriptors. */
|
|
2440
|
+
getAll() {
|
|
2441
|
+
return Array.from(this.blocks.values());
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Get compName strings for all registered blocks that have a chunking config.
|
|
2445
|
+
* Used by chunking pipelines and prompt-string injection (e.g. searchChunks tool
|
|
2446
|
+
* description) to know which fields actually have chunks to search.
|
|
2447
|
+
*/
|
|
2448
|
+
getCompsWithChunking() {
|
|
2449
|
+
return Array.from(this.blocks.values()).filter((b) => !!b.chunkingConfig).map((b) => b.compName);
|
|
2450
|
+
}
|
|
2451
|
+
/**
|
|
2452
|
+
* Filter a list of block instances down to those where annotation is enabled.
|
|
2453
|
+
* A block is annotation-enabled if its registry capability `annotation` is true.
|
|
2454
|
+
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2455
|
+
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2456
|
+
*
|
|
2457
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is auto-enabled.
|
|
2458
|
+
*/
|
|
2459
|
+
getAnnotationEnabledBlocks(allBlocks) {
|
|
2460
|
+
return allBlocks.filter((block) => {
|
|
2461
|
+
const blockDef = this.blocks.get(block.comp);
|
|
2462
|
+
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
2463
|
+
return block.props?.annotation?.enable === true;
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
/**
|
|
2467
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
2468
|
+
*
|
|
2469
|
+
* Resolution order:
|
|
2470
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
2471
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
2472
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
2473
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
2474
|
+
* Pass null/undefined for non-SM tenants.
|
|
2475
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
2476
|
+
* 3. Empty array.
|
|
2477
|
+
*/
|
|
2478
|
+
getTagTypesConfig(block, hardCodedTagTypesConfigForSM) {
|
|
2479
|
+
return hardCodedTagTypesConfigForSM || block.props?.annotation?.tagTypesConfig || [];
|
|
2480
|
+
}
|
|
2481
|
+
};
|
|
2482
|
+
var blockRegistry = new BlockRegistry();
|
|
2483
|
+
|
|
2484
|
+
// src/utils/isTplAnnotationEnabled.ts
|
|
2485
|
+
var isTplAnnotationEnabled = (tpl) => {
|
|
2486
|
+
if (tpl?.general?.segment !== "publishing") return false;
|
|
2487
|
+
const allBlocks = extractAllBlocksFromTpl({ tpl }).filter(
|
|
2488
|
+
(b) => typeof b.comp === "string"
|
|
2489
|
+
);
|
|
2490
|
+
return blockRegistry.getAnnotationEnabledBlocks(allBlocks).length > 0;
|
|
2491
|
+
};
|
|
2492
|
+
|
|
2289
2493
|
// src/utils/getRollupPossibilities.ts
|
|
2290
2494
|
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
2291
2495
|
function getRollupPossibilities({
|
|
@@ -2986,7 +3190,7 @@ var compareAndGroupBlocks = (blocksPerTpl) => {
|
|
|
2986
3190
|
};
|
|
2987
3191
|
|
|
2988
3192
|
// src/utils/autoGenFilterConfigsFromTpl/utils/extractAndOrganizeBlocks.ts
|
|
2989
|
-
var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
3193
|
+
var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}) => {
|
|
2990
3194
|
const extractedBlocks = {};
|
|
2991
3195
|
const templateBlocksCache = /* @__PURE__ */ new Map();
|
|
2992
3196
|
const getCachedBlocks = (tpl) => {
|
|
@@ -2997,7 +3201,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
2997
3201
|
};
|
|
2998
3202
|
extractedBlocks.annoTagBlocks = selectedTpls.map((tpl) => {
|
|
2999
3203
|
const allBlocks = getCachedBlocks(tpl);
|
|
3000
|
-
const allTagTypes = allBlocks.
|
|
3204
|
+
const allTagTypes = blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig).map((d) => d.tagType));
|
|
3001
3205
|
const uniqueTagTypes = [...new Set(allTagTypes)];
|
|
3002
3206
|
return {
|
|
3003
3207
|
contentType: tpl.kp_content_type,
|
|
@@ -3011,13 +3215,13 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3011
3215
|
const allBlocks = getCachedBlocks(tpl);
|
|
3012
3216
|
return {
|
|
3013
3217
|
contentType: tpl.kp_content_type,
|
|
3014
|
-
blocks:
|
|
3218
|
+
blocks: blockRegistry.getAnnotationEnabledBlocks(allBlocks)
|
|
3015
3219
|
};
|
|
3016
3220
|
});
|
|
3017
3221
|
extractedBlocks.annoRollupBlocks = selectedTpls.map((tpl) => {
|
|
3018
3222
|
const allBlocks = getCachedBlocks(tpl);
|
|
3019
3223
|
const uniqueTagTypes = Array.from(new Set(
|
|
3020
|
-
|
|
3224
|
+
blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig)).map((conf) => conf.tagType)
|
|
3021
3225
|
));
|
|
3022
3226
|
return {
|
|
3023
3227
|
contentType: tpl.kp_content_type,
|
|
@@ -3664,9 +3868,10 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
3664
3868
|
allTpls,
|
|
3665
3869
|
filterScopes,
|
|
3666
3870
|
isSelfManagedTenant = false,
|
|
3667
|
-
annotationTagsCount
|
|
3871
|
+
annotationTagsCount,
|
|
3872
|
+
smTagTypesConfig
|
|
3668
3873
|
}) => {
|
|
3669
|
-
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls);
|
|
3874
|
+
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls, { smTagTypesConfig });
|
|
3670
3875
|
const allAnnoEnabledBlocks = filterScopes.includes("anno") ? extractedBlocks.annoEnabledBlocks.flatMap((item) => item.blocks).reduce((acc, block) => {
|
|
3671
3876
|
if (!acc.find((b) => b.valuePath === block.valuePath)) {
|
|
3672
3877
|
acc.push(block);
|
|
@@ -3788,186 +3993,6 @@ var genCleanCamelCaseId = (id) => {
|
|
|
3788
3993
|
return result.slice(0, MAX_LENGTH);
|
|
3789
3994
|
};
|
|
3790
3995
|
|
|
3791
|
-
// src/blockRegistry/schemaPresets.ts
|
|
3792
|
-
var MONGO_SCHEMA_PRESETS = {
|
|
3793
|
-
object: { type: Object },
|
|
3794
|
-
string: { type: String }
|
|
3795
|
-
};
|
|
3796
|
-
var ELASTIC_MAPPING_PRESETS = {
|
|
3797
|
-
largeText: {
|
|
3798
|
-
properties: {
|
|
3799
|
-
allText: {
|
|
3800
|
-
type: "text",
|
|
3801
|
-
analyzer: "LargeTextAnalyzer"
|
|
3802
|
-
}
|
|
3803
|
-
}
|
|
3804
|
-
}
|
|
3805
|
-
};
|
|
3806
|
-
var CHUNKING_PRESETS = {
|
|
3807
|
-
// Lexical-shaped text — uses semantic chunking on allText
|
|
3808
|
-
lexicalSemantic: {
|
|
3809
|
-
strategy: "semanticChunking",
|
|
3810
|
-
windowSize: 3,
|
|
3811
|
-
minSimilarityScore: 0.7
|
|
3812
|
-
},
|
|
3813
|
-
// Plain text input — single chunk per field
|
|
3814
|
-
simpleText: {
|
|
3815
|
-
strategy: "simpleChunking"
|
|
3816
|
-
}
|
|
3817
|
-
};
|
|
3818
|
-
|
|
3819
|
-
// src/blockRegistry/blocks/LexicalTextEditor.ts
|
|
3820
|
-
var LexicalTextEditor = {
|
|
3821
|
-
compName: "LexicalTextEditor",
|
|
3822
|
-
// Identity
|
|
3823
|
-
category: "text",
|
|
3824
|
-
qualQuant: "qual",
|
|
3825
|
-
// Schema
|
|
3826
|
-
mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
|
|
3827
|
-
esMapping: ELASTIC_MAPPING_PRESETS.largeText,
|
|
3828
|
-
// Capabilities
|
|
3829
|
-
capabilities: {
|
|
3830
|
-
hasPlainText: true,
|
|
3831
|
-
annotation: true,
|
|
3832
|
-
aiAnnotation: true,
|
|
3833
|
-
aiEnrichment: true,
|
|
3834
|
-
searchable: true,
|
|
3835
|
-
directDataImport: true,
|
|
3836
|
-
csvExport: true,
|
|
3837
|
-
translatable: true,
|
|
3838
|
-
documentSummarizer: true,
|
|
3839
|
-
stripFromMainOnAnnoChunkSync: true,
|
|
3840
|
-
excludeFromListingProjection: true
|
|
3841
|
-
},
|
|
3842
|
-
// Field paths
|
|
3843
|
-
fieldPaths: {
|
|
3844
|
-
plainTextString: "allText",
|
|
3845
|
-
searchField: "allText",
|
|
3846
|
-
displayValue: "allText"
|
|
3847
|
-
},
|
|
3848
|
-
// Validation
|
|
3849
|
-
validation: {
|
|
3850
|
-
populatedCheckFn: "lexicalTextEditorHasValue",
|
|
3851
|
-
formValidationFn: "lexicalTextEditorHasValue"
|
|
3852
|
-
},
|
|
3853
|
-
// Translation
|
|
3854
|
-
translation: {
|
|
3855
|
-
handlerType: "LexicalBlockHandler"
|
|
3856
|
-
},
|
|
3857
|
-
// Table rendering
|
|
3858
|
-
tableCell: {
|
|
3859
|
-
cellComp: "RichTextAsPlainTextLex",
|
|
3860
|
-
sortPathSuffix: "editorState.root.children.0.children.0.text"
|
|
3861
|
-
},
|
|
3862
|
-
// CSV export
|
|
3863
|
-
csvExport: {
|
|
3864
|
-
transformFn: "KPRichLexicalEditor"
|
|
3865
|
-
},
|
|
3866
|
-
// Slack
|
|
3867
|
-
slackFormat: {
|
|
3868
|
-
handlerFn: "lexicalRichText"
|
|
3869
|
-
},
|
|
3870
|
-
// Batch import
|
|
3871
|
-
batchImport: {
|
|
3872
|
-
valueInjectorFn: "toLexicalValue"
|
|
3873
|
-
},
|
|
3874
|
-
// Content block option — TCI template builder & direct import UI
|
|
3875
|
-
contentBlockOption: {
|
|
3876
|
-
display: "Rich Text Field",
|
|
3877
|
-
icon: "TextAa",
|
|
3878
|
-
directImportGroupsIdx: [2, 2]
|
|
3879
|
-
},
|
|
3880
|
-
// Chunking config — used by okf-sub CreateChunksHandler
|
|
3881
|
-
chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
|
|
3882
|
-
};
|
|
3883
|
-
|
|
3884
|
-
// src/blockRegistry/registry.ts
|
|
3885
|
-
var BlockRegistry = class {
|
|
3886
|
-
constructor() {
|
|
3887
|
-
this.blocks = /* @__PURE__ */ new Map();
|
|
3888
|
-
this.register(LexicalTextEditor);
|
|
3889
|
-
}
|
|
3890
|
-
/** Register a block descriptor. */
|
|
3891
|
-
register(descriptor) {
|
|
3892
|
-
this.blocks.set(descriptor.compName, descriptor);
|
|
3893
|
-
}
|
|
3894
|
-
/** Get the full descriptor for a block type. Returns undefined if not registered. */
|
|
3895
|
-
getBlock(compType) {
|
|
3896
|
-
return this.blocks.get(compType);
|
|
3897
|
-
}
|
|
3898
|
-
/** Check if a block type is registered in the registry. */
|
|
3899
|
-
isRegistered(compType) {
|
|
3900
|
-
return this.blocks.has(compType);
|
|
3901
|
-
}
|
|
3902
|
-
/**
|
|
3903
|
-
* Get all registered block descriptors that have a given capability set to a truthy value.
|
|
3904
|
-
* Optionally pass a specific value to match (e.g. for enum-style capabilities).
|
|
3905
|
-
*/
|
|
3906
|
-
getBlocksByCapability(capability, value = true) {
|
|
3907
|
-
return Array.from(this.blocks.values()).filter((b) => {
|
|
3908
|
-
const cap = b.capabilities[capability];
|
|
3909
|
-
if (value === true) return !!cap;
|
|
3910
|
-
return cap === value;
|
|
3911
|
-
});
|
|
3912
|
-
}
|
|
3913
|
-
/**
|
|
3914
|
-
* Get compType strings for all registered blocks with a given capability.
|
|
3915
|
-
* Replaces scattered hardcoded arrays like:
|
|
3916
|
-
* const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
|
|
3917
|
-
* becomes:
|
|
3918
|
-
* const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
|
|
3919
|
-
*/
|
|
3920
|
-
getComps(capability, value = true) {
|
|
3921
|
-
return this.getBlocksByCapability(capability, value).map((b) => b.compName);
|
|
3922
|
-
}
|
|
3923
|
-
/** Get all registered blocks in a given category. */
|
|
3924
|
-
getBlocksByCategory(category) {
|
|
3925
|
-
return Array.from(this.blocks.values()).filter((b) => b.category === category);
|
|
3926
|
-
}
|
|
3927
|
-
/** Get compType strings for all qual blocks. */
|
|
3928
|
-
getQualBlocks() {
|
|
3929
|
-
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
|
|
3930
|
-
}
|
|
3931
|
-
/** Get compType strings for all quant blocks. */
|
|
3932
|
-
getQuantBlocks() {
|
|
3933
|
-
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
|
|
3934
|
-
}
|
|
3935
|
-
/** Check if a specific block has a specific capability. */
|
|
3936
|
-
hasCapability(compType, capability) {
|
|
3937
|
-
const block = this.blocks.get(compType);
|
|
3938
|
-
if (!block) return false;
|
|
3939
|
-
return !!block.capabilities[capability];
|
|
3940
|
-
}
|
|
3941
|
-
/** Get all registered block descriptors. */
|
|
3942
|
-
getAll() {
|
|
3943
|
-
return Array.from(this.blocks.values());
|
|
3944
|
-
}
|
|
3945
|
-
/**
|
|
3946
|
-
* Get compName strings for all registered blocks that have a chunking config.
|
|
3947
|
-
* Used by chunking pipelines and prompt-string injection (e.g. searchChunks tool
|
|
3948
|
-
* description) to know which fields actually have chunks to search.
|
|
3949
|
-
*/
|
|
3950
|
-
getCompsWithChunking() {
|
|
3951
|
-
return Array.from(this.blocks.values()).filter((b) => !!b.chunkingConfig).map((b) => b.compName);
|
|
3952
|
-
}
|
|
3953
|
-
/**
|
|
3954
|
-
* Filter a list of block instances down to those where annotation is enabled.
|
|
3955
|
-
* A block is annotation-enabled if its registry capability `annotation` is true.
|
|
3956
|
-
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
3957
|
-
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
3958
|
-
*
|
|
3959
|
-
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is auto-enabled.
|
|
3960
|
-
*/
|
|
3961
|
-
getAnnotationEnabledBlocks(allBlocks) {
|
|
3962
|
-
return allBlocks.filter((block) => {
|
|
3963
|
-
const blockDef = this.blocks.get(block.comp);
|
|
3964
|
-
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
3965
|
-
return block.props?.annotation?.enable === true;
|
|
3966
|
-
});
|
|
3967
|
-
}
|
|
3968
|
-
};
|
|
3969
|
-
var blockRegistry = new BlockRegistry();
|
|
3970
|
-
|
|
3971
3996
|
// src/node.ts
|
|
3972
3997
|
var import_MongoConnector3 = __toESM(require_MongoConnector());
|
|
3973
3998
|
var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
|
|
@@ -4427,6 +4452,7 @@ export {
|
|
|
4427
4452
|
getRoutePathToTagCategoryLanding,
|
|
4428
4453
|
export_getTplModelByTenant as getTplModelByTenant,
|
|
4429
4454
|
getVal,
|
|
4455
|
+
isTplAnnotationEnabled,
|
|
4430
4456
|
mergeAnnoDataIntoAnnotationsTags,
|
|
4431
4457
|
parseSpecialConfigSyntax,
|
|
4432
4458
|
processAuthorAndCommonFilters,
|
package/dist/universal.d.mts
CHANGED
|
@@ -214,6 +214,14 @@ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }
|
|
|
214
214
|
blockPathPrefix?: string;
|
|
215
215
|
}) => void;
|
|
216
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Returns true if annotation is enabled on this tpl. Two conditions must be met:
|
|
219
|
+
* 1. The tpl is in the publishing segment (annotation only makes sense for publishing).
|
|
220
|
+
* 2. At least one block on the tpl has the annotation capability in the registry
|
|
221
|
+
* (or legacy props.annotation.enable for unregistered blocks).
|
|
222
|
+
*/
|
|
223
|
+
declare const isTplAnnotationEnabled: (tpl: any) => boolean;
|
|
224
|
+
|
|
217
225
|
/**
|
|
218
226
|
* Calculates all possible rollup relationships for a tag type
|
|
219
227
|
*
|
|
@@ -982,7 +990,9 @@ declare const buildFilterConfigurations: ({ groups, type, selectedTpls, allTpls,
|
|
|
982
990
|
|
|
983
991
|
declare const compareAndGroupBlocks: (blocksPerTpl: any[]) => any[];
|
|
984
992
|
|
|
985
|
-
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[]
|
|
993
|
+
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[], { smTagTypesConfig }?: {
|
|
994
|
+
smTagTypesConfig?: any[] | null;
|
|
995
|
+
}) => any;
|
|
986
996
|
|
|
987
997
|
declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: string[], annoEnabledBlocks?: any[]) => {
|
|
988
998
|
authorTagConfigs: {
|
|
@@ -1228,12 +1238,13 @@ declare const getFilterKeyForBlock: ({ block, scope }?: {
|
|
|
1228
1238
|
* - DEFAULT TENANTS: Dynamically discovers rollups from template structure
|
|
1229
1239
|
* - SELF-MANAGED TENANTS: Uses predefined hierarchy with conditional filters
|
|
1230
1240
|
*/
|
|
1231
|
-
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, }: {
|
|
1241
|
+
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, smTagTypesConfig, }: {
|
|
1232
1242
|
selectedTpls: any[];
|
|
1233
1243
|
allTpls: any[];
|
|
1234
1244
|
filterScopes: string[];
|
|
1235
1245
|
isSelfManagedTenant?: boolean;
|
|
1236
1246
|
annotationTagsCount?: any;
|
|
1247
|
+
smTagTypesConfig?: any[] | null;
|
|
1237
1248
|
}) => ({
|
|
1238
1249
|
sectionId: string;
|
|
1239
1250
|
sectionTitle: string;
|
|
@@ -1620,8 +1631,30 @@ declare class BlockRegistry {
|
|
|
1620
1631
|
comp: string;
|
|
1621
1632
|
props?: any;
|
|
1622
1633
|
}>): any[];
|
|
1634
|
+
/**
|
|
1635
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
1636
|
+
*
|
|
1637
|
+
* Resolution order:
|
|
1638
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
1639
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
1640
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
1641
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
1642
|
+
* Pass null/undefined for non-SM tenants.
|
|
1643
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
1644
|
+
* 3. Empty array.
|
|
1645
|
+
*/
|
|
1646
|
+
getTagTypesConfig(block: {
|
|
1647
|
+
comp: string;
|
|
1648
|
+
props?: any;
|
|
1649
|
+
}, hardCodedTagTypesConfigForSM?: Array<{
|
|
1650
|
+
tagType: string;
|
|
1651
|
+
reactKey?: string;
|
|
1652
|
+
}> | null): Array<{
|
|
1653
|
+
tagType: string;
|
|
1654
|
+
reactKey?: string;
|
|
1655
|
+
}>;
|
|
1623
1656
|
}
|
|
1624
1657
|
/** Singleton instance — the one registry shared across the app. */
|
|
1625
1658
|
declare const blockRegistry: BlockRegistry;
|
|
1626
1659
|
|
|
1627
|
-
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 };
|
|
1660
|
+
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 };
|
package/dist/universal.d.ts
CHANGED
|
@@ -214,6 +214,14 @@ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }
|
|
|
214
214
|
blockPathPrefix?: string;
|
|
215
215
|
}) => void;
|
|
216
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Returns true if annotation is enabled on this tpl. Two conditions must be met:
|
|
219
|
+
* 1. The tpl is in the publishing segment (annotation only makes sense for publishing).
|
|
220
|
+
* 2. At least one block on the tpl has the annotation capability in the registry
|
|
221
|
+
* (or legacy props.annotation.enable for unregistered blocks).
|
|
222
|
+
*/
|
|
223
|
+
declare const isTplAnnotationEnabled: (tpl: any) => boolean;
|
|
224
|
+
|
|
217
225
|
/**
|
|
218
226
|
* Calculates all possible rollup relationships for a tag type
|
|
219
227
|
*
|
|
@@ -982,7 +990,9 @@ declare const buildFilterConfigurations: ({ groups, type, selectedTpls, allTpls,
|
|
|
982
990
|
|
|
983
991
|
declare const compareAndGroupBlocks: (blocksPerTpl: any[]) => any[];
|
|
984
992
|
|
|
985
|
-
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[]
|
|
993
|
+
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[], { smTagTypesConfig }?: {
|
|
994
|
+
smTagTypesConfig?: any[] | null;
|
|
995
|
+
}) => any;
|
|
986
996
|
|
|
987
997
|
declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: string[], annoEnabledBlocks?: any[]) => {
|
|
988
998
|
authorTagConfigs: {
|
|
@@ -1228,12 +1238,13 @@ declare const getFilterKeyForBlock: ({ block, scope }?: {
|
|
|
1228
1238
|
* - DEFAULT TENANTS: Dynamically discovers rollups from template structure
|
|
1229
1239
|
* - SELF-MANAGED TENANTS: Uses predefined hierarchy with conditional filters
|
|
1230
1240
|
*/
|
|
1231
|
-
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, }: {
|
|
1241
|
+
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, smTagTypesConfig, }: {
|
|
1232
1242
|
selectedTpls: any[];
|
|
1233
1243
|
allTpls: any[];
|
|
1234
1244
|
filterScopes: string[];
|
|
1235
1245
|
isSelfManagedTenant?: boolean;
|
|
1236
1246
|
annotationTagsCount?: any;
|
|
1247
|
+
smTagTypesConfig?: any[] | null;
|
|
1237
1248
|
}) => ({
|
|
1238
1249
|
sectionId: string;
|
|
1239
1250
|
sectionTitle: string;
|
|
@@ -1620,8 +1631,30 @@ declare class BlockRegistry {
|
|
|
1620
1631
|
comp: string;
|
|
1621
1632
|
props?: any;
|
|
1622
1633
|
}>): any[];
|
|
1634
|
+
/**
|
|
1635
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
1636
|
+
*
|
|
1637
|
+
* Resolution order:
|
|
1638
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
1639
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
1640
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
1641
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
1642
|
+
* Pass null/undefined for non-SM tenants.
|
|
1643
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
1644
|
+
* 3. Empty array.
|
|
1645
|
+
*/
|
|
1646
|
+
getTagTypesConfig(block: {
|
|
1647
|
+
comp: string;
|
|
1648
|
+
props?: any;
|
|
1649
|
+
}, hardCodedTagTypesConfigForSM?: Array<{
|
|
1650
|
+
tagType: string;
|
|
1651
|
+
reactKey?: string;
|
|
1652
|
+
}> | null): Array<{
|
|
1653
|
+
tagType: string;
|
|
1654
|
+
reactKey?: string;
|
|
1655
|
+
}>;
|
|
1623
1656
|
}
|
|
1624
1657
|
/** Singleton instance — the one registry shared across the app. */
|
|
1625
1658
|
declare const blockRegistry: BlockRegistry;
|
|
1626
1659
|
|
|
1627
|
-
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 };
|
|
1660
|
+
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 };
|