@okf/ootils 1.31.2 → 1.31.3
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 +27 -2
- package/dist/browser.d.ts +27 -2
- package/dist/browser.js +202 -186
- package/dist/browser.mjs +202 -186
- package/dist/node.d.mts +27 -2
- package/dist/node.d.ts +27 -2
- package/dist/node.js +202 -186
- package/dist/node.mjs +202 -186
- package/dist/universal.d.mts +27 -2
- package/dist/universal.d.ts +27 -2
- package/dist/universal.js +202 -186
- package/dist/universal.mjs +202 -186
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -3052,8 +3052,203 @@ var compareAndGroupBlocks = (blocksPerTpl) => {
|
|
|
3052
3052
|
return Array.from(templateGroupToFilters.values());
|
|
3053
3053
|
};
|
|
3054
3054
|
|
|
3055
|
+
// src/blockRegistry/schemaPresets.ts
|
|
3056
|
+
var MONGO_SCHEMA_PRESETS = {
|
|
3057
|
+
object: { type: Object },
|
|
3058
|
+
string: { type: String }
|
|
3059
|
+
};
|
|
3060
|
+
var ELASTIC_MAPPING_PRESETS = {
|
|
3061
|
+
largeText: {
|
|
3062
|
+
properties: {
|
|
3063
|
+
allText: {
|
|
3064
|
+
type: "text",
|
|
3065
|
+
analyzer: "LargeTextAnalyzer"
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
};
|
|
3070
|
+
var CHUNKING_PRESETS = {
|
|
3071
|
+
// Lexical-shaped text — uses semantic chunking on allText
|
|
3072
|
+
lexicalSemantic: {
|
|
3073
|
+
strategy: "semanticChunking",
|
|
3074
|
+
windowSize: 3,
|
|
3075
|
+
minSimilarityScore: 0.7
|
|
3076
|
+
},
|
|
3077
|
+
// Plain text input — single chunk per field
|
|
3078
|
+
simpleText: {
|
|
3079
|
+
strategy: "simpleChunking"
|
|
3080
|
+
}
|
|
3081
|
+
};
|
|
3082
|
+
|
|
3083
|
+
// src/blockRegistry/blocks/LexicalTextEditor.ts
|
|
3084
|
+
var LexicalTextEditor = {
|
|
3085
|
+
compName: "LexicalTextEditor",
|
|
3086
|
+
// Identity
|
|
3087
|
+
category: "text",
|
|
3088
|
+
qualQuant: "qual",
|
|
3089
|
+
// Schema
|
|
3090
|
+
mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
|
|
3091
|
+
esMapping: ELASTIC_MAPPING_PRESETS.largeText,
|
|
3092
|
+
// Capabilities
|
|
3093
|
+
capabilities: {
|
|
3094
|
+
hasPlainText: true,
|
|
3095
|
+
annotation: true,
|
|
3096
|
+
aiAnnotation: true,
|
|
3097
|
+
aiEnrichment: true,
|
|
3098
|
+
searchable: true,
|
|
3099
|
+
directDataImport: true,
|
|
3100
|
+
csvExport: true,
|
|
3101
|
+
translatable: true,
|
|
3102
|
+
documentSummarizer: true,
|
|
3103
|
+
stripFromMainOnAnnoChunkSync: true,
|
|
3104
|
+
excludeFromListingProjection: true
|
|
3105
|
+
},
|
|
3106
|
+
// Field paths
|
|
3107
|
+
fieldPaths: {
|
|
3108
|
+
plainTextString: "allText",
|
|
3109
|
+
searchField: "allText",
|
|
3110
|
+
displayValue: "allText"
|
|
3111
|
+
},
|
|
3112
|
+
// Validation
|
|
3113
|
+
validation: {
|
|
3114
|
+
populatedCheckFn: "lexicalTextEditorHasValue",
|
|
3115
|
+
formValidationFn: "lexicalTextEditorHasValue"
|
|
3116
|
+
},
|
|
3117
|
+
// Translation
|
|
3118
|
+
translation: {
|
|
3119
|
+
handlerType: "LexicalBlockHandler"
|
|
3120
|
+
},
|
|
3121
|
+
// Table rendering
|
|
3122
|
+
tableCell: {
|
|
3123
|
+
cellComp: "RichTextAsPlainTextLex",
|
|
3124
|
+
sortPathSuffix: "editorState.root.children.0.children.0.text"
|
|
3125
|
+
},
|
|
3126
|
+
// CSV export
|
|
3127
|
+
csvExport: {
|
|
3128
|
+
transformFn: "KPRichLexicalEditor"
|
|
3129
|
+
},
|
|
3130
|
+
// Slack
|
|
3131
|
+
slackFormat: {
|
|
3132
|
+
handlerFn: "lexicalRichText"
|
|
3133
|
+
},
|
|
3134
|
+
// Batch import
|
|
3135
|
+
batchImport: {
|
|
3136
|
+
valueInjectorFn: "toLexicalValue"
|
|
3137
|
+
},
|
|
3138
|
+
// Content block option — TCI template builder & direct import UI
|
|
3139
|
+
contentBlockOption: {
|
|
3140
|
+
display: "Rich Text Field",
|
|
3141
|
+
icon: "TextAa",
|
|
3142
|
+
directImportGroupsIdx: [2, 2]
|
|
3143
|
+
},
|
|
3144
|
+
// Chunking config — used by okf-sub CreateChunksHandler
|
|
3145
|
+
chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
|
|
3146
|
+
};
|
|
3147
|
+
|
|
3148
|
+
// src/blockRegistry/registry.ts
|
|
3149
|
+
var BlockRegistry = class {
|
|
3150
|
+
constructor() {
|
|
3151
|
+
this.blocks = /* @__PURE__ */ new Map();
|
|
3152
|
+
this.register(LexicalTextEditor);
|
|
3153
|
+
}
|
|
3154
|
+
/** Register a block descriptor. */
|
|
3155
|
+
register(descriptor) {
|
|
3156
|
+
this.blocks.set(descriptor.compName, descriptor);
|
|
3157
|
+
}
|
|
3158
|
+
/** Get the full descriptor for a block type. Returns undefined if not registered. */
|
|
3159
|
+
getBlock(compType) {
|
|
3160
|
+
return this.blocks.get(compType);
|
|
3161
|
+
}
|
|
3162
|
+
/** Check if a block type is registered in the registry. */
|
|
3163
|
+
isRegistered(compType) {
|
|
3164
|
+
return this.blocks.has(compType);
|
|
3165
|
+
}
|
|
3166
|
+
/**
|
|
3167
|
+
* Get all registered block descriptors that have a given capability set to a truthy value.
|
|
3168
|
+
* Optionally pass a specific value to match (e.g. for enum-style capabilities).
|
|
3169
|
+
*/
|
|
3170
|
+
getBlocksByCapability(capability, value = true) {
|
|
3171
|
+
return Array.from(this.blocks.values()).filter((b) => {
|
|
3172
|
+
const cap = b.capabilities[capability];
|
|
3173
|
+
if (value === true) return !!cap;
|
|
3174
|
+
return cap === value;
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* Get compType strings for all registered blocks with a given capability.
|
|
3179
|
+
* Replaces scattered hardcoded arrays like:
|
|
3180
|
+
* const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
|
|
3181
|
+
* becomes:
|
|
3182
|
+
* const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
|
|
3183
|
+
*/
|
|
3184
|
+
getComps(capability, value = true) {
|
|
3185
|
+
return this.getBlocksByCapability(capability, value).map((b) => b.compName);
|
|
3186
|
+
}
|
|
3187
|
+
/** Get all registered blocks in a given category. */
|
|
3188
|
+
getBlocksByCategory(category) {
|
|
3189
|
+
return Array.from(this.blocks.values()).filter((b) => b.category === category);
|
|
3190
|
+
}
|
|
3191
|
+
/** Get compType strings for all qual blocks. */
|
|
3192
|
+
getQualBlocks() {
|
|
3193
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
|
|
3194
|
+
}
|
|
3195
|
+
/** Get compType strings for all quant blocks. */
|
|
3196
|
+
getQuantBlocks() {
|
|
3197
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
|
|
3198
|
+
}
|
|
3199
|
+
/** Check if a specific block has a specific capability. */
|
|
3200
|
+
hasCapability(compType, capability) {
|
|
3201
|
+
const block = this.blocks.get(compType);
|
|
3202
|
+
if (!block) return false;
|
|
3203
|
+
return !!block.capabilities[capability];
|
|
3204
|
+
}
|
|
3205
|
+
/** Get all registered block descriptors. */
|
|
3206
|
+
getAll() {
|
|
3207
|
+
return Array.from(this.blocks.values());
|
|
3208
|
+
}
|
|
3209
|
+
/**
|
|
3210
|
+
* Get compName strings for all registered blocks that have a chunking config.
|
|
3211
|
+
* Used by chunking pipelines and prompt-string injection (e.g. searchChunks tool
|
|
3212
|
+
* description) to know which fields actually have chunks to search.
|
|
3213
|
+
*/
|
|
3214
|
+
getCompsWithChunking() {
|
|
3215
|
+
return Array.from(this.blocks.values()).filter((b) => !!b.chunkingConfig).map((b) => b.compName);
|
|
3216
|
+
}
|
|
3217
|
+
/**
|
|
3218
|
+
* Filter a list of block instances down to those where annotation is enabled.
|
|
3219
|
+
* A block is annotation-enabled if its registry capability `annotation` is true.
|
|
3220
|
+
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
3221
|
+
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
3222
|
+
*
|
|
3223
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is auto-enabled.
|
|
3224
|
+
*/
|
|
3225
|
+
getAnnotationEnabledBlocks(allBlocks) {
|
|
3226
|
+
return allBlocks.filter((block) => {
|
|
3227
|
+
const blockDef = this.blocks.get(block.comp);
|
|
3228
|
+
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
3229
|
+
return block.props?.annotation?.enable === true;
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
/**
|
|
3233
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
3234
|
+
*
|
|
3235
|
+
* Resolution order:
|
|
3236
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
3237
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
3238
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
3239
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
3240
|
+
* Pass null/undefined for non-SM tenants.
|
|
3241
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
3242
|
+
* 3. Empty array.
|
|
3243
|
+
*/
|
|
3244
|
+
getTagTypesConfig(block, hardCodedTagTypesConfigForSM) {
|
|
3245
|
+
return hardCodedTagTypesConfigForSM || block.props?.annotation?.tagTypesConfig || [];
|
|
3246
|
+
}
|
|
3247
|
+
};
|
|
3248
|
+
var blockRegistry = new BlockRegistry();
|
|
3249
|
+
|
|
3055
3250
|
// src/utils/autoGenFilterConfigsFromTpl/utils/extractAndOrganizeBlocks.ts
|
|
3056
|
-
var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
3251
|
+
var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}) => {
|
|
3057
3252
|
const extractedBlocks = {};
|
|
3058
3253
|
const templateBlocksCache = /* @__PURE__ */ new Map();
|
|
3059
3254
|
const getCachedBlocks = (tpl) => {
|
|
@@ -3064,7 +3259,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3064
3259
|
};
|
|
3065
3260
|
extractedBlocks.annoTagBlocks = selectedTpls.map((tpl) => {
|
|
3066
3261
|
const allBlocks = getCachedBlocks(tpl);
|
|
3067
|
-
const allTagTypes = allBlocks.
|
|
3262
|
+
const allTagTypes = blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig).map((d) => d.tagType));
|
|
3068
3263
|
const uniqueTagTypes = [...new Set(allTagTypes)];
|
|
3069
3264
|
return {
|
|
3070
3265
|
contentType: tpl.kp_content_type,
|
|
@@ -3078,13 +3273,13 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3078
3273
|
const allBlocks = getCachedBlocks(tpl);
|
|
3079
3274
|
return {
|
|
3080
3275
|
contentType: tpl.kp_content_type,
|
|
3081
|
-
blocks:
|
|
3276
|
+
blocks: blockRegistry.getAnnotationEnabledBlocks(allBlocks)
|
|
3082
3277
|
};
|
|
3083
3278
|
});
|
|
3084
3279
|
extractedBlocks.annoRollupBlocks = selectedTpls.map((tpl) => {
|
|
3085
3280
|
const allBlocks = getCachedBlocks(tpl);
|
|
3086
3281
|
const uniqueTagTypes = Array.from(new Set(
|
|
3087
|
-
|
|
3282
|
+
blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig)).map((conf) => conf.tagType)
|
|
3088
3283
|
));
|
|
3089
3284
|
return {
|
|
3090
3285
|
contentType: tpl.kp_content_type,
|
|
@@ -3731,9 +3926,10 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
3731
3926
|
allTpls,
|
|
3732
3927
|
filterScopes,
|
|
3733
3928
|
isSelfManagedTenant = false,
|
|
3734
|
-
annotationTagsCount
|
|
3929
|
+
annotationTagsCount,
|
|
3930
|
+
smTagTypesConfig
|
|
3735
3931
|
}) => {
|
|
3736
|
-
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls);
|
|
3932
|
+
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls, { smTagTypesConfig });
|
|
3737
3933
|
const allAnnoEnabledBlocks = filterScopes.includes("anno") ? extractedBlocks.annoEnabledBlocks.flatMap((item) => item.blocks).reduce((acc, block) => {
|
|
3738
3934
|
if (!acc.find((b) => b.valuePath === block.valuePath)) {
|
|
3739
3935
|
acc.push(block);
|
|
@@ -3855,186 +4051,6 @@ var genCleanCamelCaseId = (id) => {
|
|
|
3855
4051
|
return result.slice(0, MAX_LENGTH);
|
|
3856
4052
|
};
|
|
3857
4053
|
|
|
3858
|
-
// src/blockRegistry/schemaPresets.ts
|
|
3859
|
-
var MONGO_SCHEMA_PRESETS = {
|
|
3860
|
-
object: { type: Object },
|
|
3861
|
-
string: { type: String }
|
|
3862
|
-
};
|
|
3863
|
-
var ELASTIC_MAPPING_PRESETS = {
|
|
3864
|
-
largeText: {
|
|
3865
|
-
properties: {
|
|
3866
|
-
allText: {
|
|
3867
|
-
type: "text",
|
|
3868
|
-
analyzer: "LargeTextAnalyzer"
|
|
3869
|
-
}
|
|
3870
|
-
}
|
|
3871
|
-
}
|
|
3872
|
-
};
|
|
3873
|
-
var CHUNKING_PRESETS = {
|
|
3874
|
-
// Lexical-shaped text — uses semantic chunking on allText
|
|
3875
|
-
lexicalSemantic: {
|
|
3876
|
-
strategy: "semanticChunking",
|
|
3877
|
-
windowSize: 3,
|
|
3878
|
-
minSimilarityScore: 0.7
|
|
3879
|
-
},
|
|
3880
|
-
// Plain text input — single chunk per field
|
|
3881
|
-
simpleText: {
|
|
3882
|
-
strategy: "simpleChunking"
|
|
3883
|
-
}
|
|
3884
|
-
};
|
|
3885
|
-
|
|
3886
|
-
// src/blockRegistry/blocks/LexicalTextEditor.ts
|
|
3887
|
-
var LexicalTextEditor = {
|
|
3888
|
-
compName: "LexicalTextEditor",
|
|
3889
|
-
// Identity
|
|
3890
|
-
category: "text",
|
|
3891
|
-
qualQuant: "qual",
|
|
3892
|
-
// Schema
|
|
3893
|
-
mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
|
|
3894
|
-
esMapping: ELASTIC_MAPPING_PRESETS.largeText,
|
|
3895
|
-
// Capabilities
|
|
3896
|
-
capabilities: {
|
|
3897
|
-
hasPlainText: true,
|
|
3898
|
-
annotation: true,
|
|
3899
|
-
aiAnnotation: true,
|
|
3900
|
-
aiEnrichment: true,
|
|
3901
|
-
searchable: true,
|
|
3902
|
-
directDataImport: true,
|
|
3903
|
-
csvExport: true,
|
|
3904
|
-
translatable: true,
|
|
3905
|
-
documentSummarizer: true,
|
|
3906
|
-
stripFromMainOnAnnoChunkSync: true,
|
|
3907
|
-
excludeFromListingProjection: true
|
|
3908
|
-
},
|
|
3909
|
-
// Field paths
|
|
3910
|
-
fieldPaths: {
|
|
3911
|
-
plainTextString: "allText",
|
|
3912
|
-
searchField: "allText",
|
|
3913
|
-
displayValue: "allText"
|
|
3914
|
-
},
|
|
3915
|
-
// Validation
|
|
3916
|
-
validation: {
|
|
3917
|
-
populatedCheckFn: "lexicalTextEditorHasValue",
|
|
3918
|
-
formValidationFn: "lexicalTextEditorHasValue"
|
|
3919
|
-
},
|
|
3920
|
-
// Translation
|
|
3921
|
-
translation: {
|
|
3922
|
-
handlerType: "LexicalBlockHandler"
|
|
3923
|
-
},
|
|
3924
|
-
// Table rendering
|
|
3925
|
-
tableCell: {
|
|
3926
|
-
cellComp: "RichTextAsPlainTextLex",
|
|
3927
|
-
sortPathSuffix: "editorState.root.children.0.children.0.text"
|
|
3928
|
-
},
|
|
3929
|
-
// CSV export
|
|
3930
|
-
csvExport: {
|
|
3931
|
-
transformFn: "KPRichLexicalEditor"
|
|
3932
|
-
},
|
|
3933
|
-
// Slack
|
|
3934
|
-
slackFormat: {
|
|
3935
|
-
handlerFn: "lexicalRichText"
|
|
3936
|
-
},
|
|
3937
|
-
// Batch import
|
|
3938
|
-
batchImport: {
|
|
3939
|
-
valueInjectorFn: "toLexicalValue"
|
|
3940
|
-
},
|
|
3941
|
-
// Content block option — TCI template builder & direct import UI
|
|
3942
|
-
contentBlockOption: {
|
|
3943
|
-
display: "Rich Text Field",
|
|
3944
|
-
icon: "TextAa",
|
|
3945
|
-
directImportGroupsIdx: [2, 2]
|
|
3946
|
-
},
|
|
3947
|
-
// Chunking config — used by okf-sub CreateChunksHandler
|
|
3948
|
-
chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
|
|
3949
|
-
};
|
|
3950
|
-
|
|
3951
|
-
// src/blockRegistry/registry.ts
|
|
3952
|
-
var BlockRegistry = class {
|
|
3953
|
-
constructor() {
|
|
3954
|
-
this.blocks = /* @__PURE__ */ new Map();
|
|
3955
|
-
this.register(LexicalTextEditor);
|
|
3956
|
-
}
|
|
3957
|
-
/** Register a block descriptor. */
|
|
3958
|
-
register(descriptor) {
|
|
3959
|
-
this.blocks.set(descriptor.compName, descriptor);
|
|
3960
|
-
}
|
|
3961
|
-
/** Get the full descriptor for a block type. Returns undefined if not registered. */
|
|
3962
|
-
getBlock(compType) {
|
|
3963
|
-
return this.blocks.get(compType);
|
|
3964
|
-
}
|
|
3965
|
-
/** Check if a block type is registered in the registry. */
|
|
3966
|
-
isRegistered(compType) {
|
|
3967
|
-
return this.blocks.has(compType);
|
|
3968
|
-
}
|
|
3969
|
-
/**
|
|
3970
|
-
* Get all registered block descriptors that have a given capability set to a truthy value.
|
|
3971
|
-
* Optionally pass a specific value to match (e.g. for enum-style capabilities).
|
|
3972
|
-
*/
|
|
3973
|
-
getBlocksByCapability(capability, value = true) {
|
|
3974
|
-
return Array.from(this.blocks.values()).filter((b) => {
|
|
3975
|
-
const cap = b.capabilities[capability];
|
|
3976
|
-
if (value === true) return !!cap;
|
|
3977
|
-
return cap === value;
|
|
3978
|
-
});
|
|
3979
|
-
}
|
|
3980
|
-
/**
|
|
3981
|
-
* Get compType strings for all registered blocks with a given capability.
|
|
3982
|
-
* Replaces scattered hardcoded arrays like:
|
|
3983
|
-
* const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
|
|
3984
|
-
* becomes:
|
|
3985
|
-
* const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
|
|
3986
|
-
*/
|
|
3987
|
-
getComps(capability, value = true) {
|
|
3988
|
-
return this.getBlocksByCapability(capability, value).map((b) => b.compName);
|
|
3989
|
-
}
|
|
3990
|
-
/** Get all registered blocks in a given category. */
|
|
3991
|
-
getBlocksByCategory(category) {
|
|
3992
|
-
return Array.from(this.blocks.values()).filter((b) => b.category === category);
|
|
3993
|
-
}
|
|
3994
|
-
/** Get compType strings for all qual blocks. */
|
|
3995
|
-
getQualBlocks() {
|
|
3996
|
-
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
|
|
3997
|
-
}
|
|
3998
|
-
/** Get compType strings for all quant blocks. */
|
|
3999
|
-
getQuantBlocks() {
|
|
4000
|
-
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
|
|
4001
|
-
}
|
|
4002
|
-
/** Check if a specific block has a specific capability. */
|
|
4003
|
-
hasCapability(compType, capability) {
|
|
4004
|
-
const block = this.blocks.get(compType);
|
|
4005
|
-
if (!block) return false;
|
|
4006
|
-
return !!block.capabilities[capability];
|
|
4007
|
-
}
|
|
4008
|
-
/** Get all registered block descriptors. */
|
|
4009
|
-
getAll() {
|
|
4010
|
-
return Array.from(this.blocks.values());
|
|
4011
|
-
}
|
|
4012
|
-
/**
|
|
4013
|
-
* Get compName strings for all registered blocks that have a chunking config.
|
|
4014
|
-
* Used by chunking pipelines and prompt-string injection (e.g. searchChunks tool
|
|
4015
|
-
* description) to know which fields actually have chunks to search.
|
|
4016
|
-
*/
|
|
4017
|
-
getCompsWithChunking() {
|
|
4018
|
-
return Array.from(this.blocks.values()).filter((b) => !!b.chunkingConfig).map((b) => b.compName);
|
|
4019
|
-
}
|
|
4020
|
-
/**
|
|
4021
|
-
* Filter a list of block instances down to those where annotation is enabled.
|
|
4022
|
-
* A block is annotation-enabled if its registry capability `annotation` is true.
|
|
4023
|
-
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
4024
|
-
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
4025
|
-
*
|
|
4026
|
-
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is auto-enabled.
|
|
4027
|
-
*/
|
|
4028
|
-
getAnnotationEnabledBlocks(allBlocks) {
|
|
4029
|
-
return allBlocks.filter((block) => {
|
|
4030
|
-
const blockDef = this.blocks.get(block.comp);
|
|
4031
|
-
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
4032
|
-
return block.props?.annotation?.enable === true;
|
|
4033
|
-
});
|
|
4034
|
-
}
|
|
4035
|
-
};
|
|
4036
|
-
var blockRegistry = new BlockRegistry();
|
|
4037
|
-
|
|
4038
4054
|
// src/node.ts
|
|
4039
4055
|
var import_MongoConnector3 = __toESM(require_MongoConnector());
|
|
4040
4056
|
var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
|