@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.mjs
CHANGED
|
@@ -2985,8 +2985,203 @@ var compareAndGroupBlocks = (blocksPerTpl) => {
|
|
|
2985
2985
|
return Array.from(templateGroupToFilters.values());
|
|
2986
2986
|
};
|
|
2987
2987
|
|
|
2988
|
+
// src/blockRegistry/schemaPresets.ts
|
|
2989
|
+
var MONGO_SCHEMA_PRESETS = {
|
|
2990
|
+
object: { type: Object },
|
|
2991
|
+
string: { type: String }
|
|
2992
|
+
};
|
|
2993
|
+
var ELASTIC_MAPPING_PRESETS = {
|
|
2994
|
+
largeText: {
|
|
2995
|
+
properties: {
|
|
2996
|
+
allText: {
|
|
2997
|
+
type: "text",
|
|
2998
|
+
analyzer: "LargeTextAnalyzer"
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
};
|
|
3003
|
+
var CHUNKING_PRESETS = {
|
|
3004
|
+
// Lexical-shaped text — uses semantic chunking on allText
|
|
3005
|
+
lexicalSemantic: {
|
|
3006
|
+
strategy: "semanticChunking",
|
|
3007
|
+
windowSize: 3,
|
|
3008
|
+
minSimilarityScore: 0.7
|
|
3009
|
+
},
|
|
3010
|
+
// Plain text input — single chunk per field
|
|
3011
|
+
simpleText: {
|
|
3012
|
+
strategy: "simpleChunking"
|
|
3013
|
+
}
|
|
3014
|
+
};
|
|
3015
|
+
|
|
3016
|
+
// src/blockRegistry/blocks/LexicalTextEditor.ts
|
|
3017
|
+
var LexicalTextEditor = {
|
|
3018
|
+
compName: "LexicalTextEditor",
|
|
3019
|
+
// Identity
|
|
3020
|
+
category: "text",
|
|
3021
|
+
qualQuant: "qual",
|
|
3022
|
+
// Schema
|
|
3023
|
+
mongoSchemaType: MONGO_SCHEMA_PRESETS.object,
|
|
3024
|
+
esMapping: ELASTIC_MAPPING_PRESETS.largeText,
|
|
3025
|
+
// Capabilities
|
|
3026
|
+
capabilities: {
|
|
3027
|
+
hasPlainText: true,
|
|
3028
|
+
annotation: true,
|
|
3029
|
+
aiAnnotation: true,
|
|
3030
|
+
aiEnrichment: true,
|
|
3031
|
+
searchable: true,
|
|
3032
|
+
directDataImport: true,
|
|
3033
|
+
csvExport: true,
|
|
3034
|
+
translatable: true,
|
|
3035
|
+
documentSummarizer: true,
|
|
3036
|
+
stripFromMainOnAnnoChunkSync: true,
|
|
3037
|
+
excludeFromListingProjection: true
|
|
3038
|
+
},
|
|
3039
|
+
// Field paths
|
|
3040
|
+
fieldPaths: {
|
|
3041
|
+
plainTextString: "allText",
|
|
3042
|
+
searchField: "allText",
|
|
3043
|
+
displayValue: "allText"
|
|
3044
|
+
},
|
|
3045
|
+
// Validation
|
|
3046
|
+
validation: {
|
|
3047
|
+
populatedCheckFn: "lexicalTextEditorHasValue",
|
|
3048
|
+
formValidationFn: "lexicalTextEditorHasValue"
|
|
3049
|
+
},
|
|
3050
|
+
// Translation
|
|
3051
|
+
translation: {
|
|
3052
|
+
handlerType: "LexicalBlockHandler"
|
|
3053
|
+
},
|
|
3054
|
+
// Table rendering
|
|
3055
|
+
tableCell: {
|
|
3056
|
+
cellComp: "RichTextAsPlainTextLex",
|
|
3057
|
+
sortPathSuffix: "editorState.root.children.0.children.0.text"
|
|
3058
|
+
},
|
|
3059
|
+
// CSV export
|
|
3060
|
+
csvExport: {
|
|
3061
|
+
transformFn: "KPRichLexicalEditor"
|
|
3062
|
+
},
|
|
3063
|
+
// Slack
|
|
3064
|
+
slackFormat: {
|
|
3065
|
+
handlerFn: "lexicalRichText"
|
|
3066
|
+
},
|
|
3067
|
+
// Batch import
|
|
3068
|
+
batchImport: {
|
|
3069
|
+
valueInjectorFn: "toLexicalValue"
|
|
3070
|
+
},
|
|
3071
|
+
// Content block option — TCI template builder & direct import UI
|
|
3072
|
+
contentBlockOption: {
|
|
3073
|
+
display: "Rich Text Field",
|
|
3074
|
+
icon: "TextAa",
|
|
3075
|
+
directImportGroupsIdx: [2, 2]
|
|
3076
|
+
},
|
|
3077
|
+
// Chunking config — used by okf-sub CreateChunksHandler
|
|
3078
|
+
chunkingConfig: CHUNKING_PRESETS.lexicalSemantic
|
|
3079
|
+
};
|
|
3080
|
+
|
|
3081
|
+
// src/blockRegistry/registry.ts
|
|
3082
|
+
var BlockRegistry = class {
|
|
3083
|
+
constructor() {
|
|
3084
|
+
this.blocks = /* @__PURE__ */ new Map();
|
|
3085
|
+
this.register(LexicalTextEditor);
|
|
3086
|
+
}
|
|
3087
|
+
/** Register a block descriptor. */
|
|
3088
|
+
register(descriptor) {
|
|
3089
|
+
this.blocks.set(descriptor.compName, descriptor);
|
|
3090
|
+
}
|
|
3091
|
+
/** Get the full descriptor for a block type. Returns undefined if not registered. */
|
|
3092
|
+
getBlock(compType) {
|
|
3093
|
+
return this.blocks.get(compType);
|
|
3094
|
+
}
|
|
3095
|
+
/** Check if a block type is registered in the registry. */
|
|
3096
|
+
isRegistered(compType) {
|
|
3097
|
+
return this.blocks.has(compType);
|
|
3098
|
+
}
|
|
3099
|
+
/**
|
|
3100
|
+
* Get all registered block descriptors that have a given capability set to a truthy value.
|
|
3101
|
+
* Optionally pass a specific value to match (e.g. for enum-style capabilities).
|
|
3102
|
+
*/
|
|
3103
|
+
getBlocksByCapability(capability, value = true) {
|
|
3104
|
+
return Array.from(this.blocks.values()).filter((b) => {
|
|
3105
|
+
const cap = b.capabilities[capability];
|
|
3106
|
+
if (value === true) return !!cap;
|
|
3107
|
+
return cap === value;
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
/**
|
|
3111
|
+
* Get compType strings for all registered blocks with a given capability.
|
|
3112
|
+
* Replaces scattered hardcoded arrays like:
|
|
3113
|
+
* const TEXT_FIELD_COMPONENTS = ["TextInput", "LexicalTextEditor", ...]
|
|
3114
|
+
* becomes:
|
|
3115
|
+
* const TEXT_FIELD_COMPONENTS = blockRegistry.getComps('aiTextExtraction')
|
|
3116
|
+
*/
|
|
3117
|
+
getComps(capability, value = true) {
|
|
3118
|
+
return this.getBlocksByCapability(capability, value).map((b) => b.compName);
|
|
3119
|
+
}
|
|
3120
|
+
/** Get all registered blocks in a given category. */
|
|
3121
|
+
getBlocksByCategory(category) {
|
|
3122
|
+
return Array.from(this.blocks.values()).filter((b) => b.category === category);
|
|
3123
|
+
}
|
|
3124
|
+
/** Get compType strings for all qual blocks. */
|
|
3125
|
+
getQualBlocks() {
|
|
3126
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "qual").map((b) => b.compName);
|
|
3127
|
+
}
|
|
3128
|
+
/** Get compType strings for all quant blocks. */
|
|
3129
|
+
getQuantBlocks() {
|
|
3130
|
+
return Array.from(this.blocks.values()).filter((b) => b.qualQuant === "quant").map((b) => b.compName);
|
|
3131
|
+
}
|
|
3132
|
+
/** Check if a specific block has a specific capability. */
|
|
3133
|
+
hasCapability(compType, capability) {
|
|
3134
|
+
const block = this.blocks.get(compType);
|
|
3135
|
+
if (!block) return false;
|
|
3136
|
+
return !!block.capabilities[capability];
|
|
3137
|
+
}
|
|
3138
|
+
/** Get all registered block descriptors. */
|
|
3139
|
+
getAll() {
|
|
3140
|
+
return Array.from(this.blocks.values());
|
|
3141
|
+
}
|
|
3142
|
+
/**
|
|
3143
|
+
* Get compName strings for all registered blocks that have a chunking config.
|
|
3144
|
+
* Used by chunking pipelines and prompt-string injection (e.g. searchChunks tool
|
|
3145
|
+
* description) to know which fields actually have chunks to search.
|
|
3146
|
+
*/
|
|
3147
|
+
getCompsWithChunking() {
|
|
3148
|
+
return Array.from(this.blocks.values()).filter((b) => !!b.chunkingConfig).map((b) => b.compName);
|
|
3149
|
+
}
|
|
3150
|
+
/**
|
|
3151
|
+
* Filter a list of block instances down to those where annotation is enabled.
|
|
3152
|
+
* A block is annotation-enabled if its registry capability `annotation` is true.
|
|
3153
|
+
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
3154
|
+
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
3155
|
+
*
|
|
3156
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is auto-enabled.
|
|
3157
|
+
*/
|
|
3158
|
+
getAnnotationEnabledBlocks(allBlocks) {
|
|
3159
|
+
return allBlocks.filter((block) => {
|
|
3160
|
+
const blockDef = this.blocks.get(block.comp);
|
|
3161
|
+
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
3162
|
+
return block.props?.annotation?.enable === true;
|
|
3163
|
+
});
|
|
3164
|
+
}
|
|
3165
|
+
/**
|
|
3166
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
3167
|
+
*
|
|
3168
|
+
* Resolution order:
|
|
3169
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
3170
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
3171
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
3172
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
3173
|
+
* Pass null/undefined for non-SM tenants.
|
|
3174
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
3175
|
+
* 3. Empty array.
|
|
3176
|
+
*/
|
|
3177
|
+
getTagTypesConfig(block, hardCodedTagTypesConfigForSM) {
|
|
3178
|
+
return hardCodedTagTypesConfigForSM || block.props?.annotation?.tagTypesConfig || [];
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
var blockRegistry = new BlockRegistry();
|
|
3182
|
+
|
|
2988
3183
|
// src/utils/autoGenFilterConfigsFromTpl/utils/extractAndOrganizeBlocks.ts
|
|
2989
|
-
var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
3184
|
+
var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}) => {
|
|
2990
3185
|
const extractedBlocks = {};
|
|
2991
3186
|
const templateBlocksCache = /* @__PURE__ */ new Map();
|
|
2992
3187
|
const getCachedBlocks = (tpl) => {
|
|
@@ -2997,7 +3192,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
2997
3192
|
};
|
|
2998
3193
|
extractedBlocks.annoTagBlocks = selectedTpls.map((tpl) => {
|
|
2999
3194
|
const allBlocks = getCachedBlocks(tpl);
|
|
3000
|
-
const allTagTypes = allBlocks.
|
|
3195
|
+
const allTagTypes = blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig).map((d) => d.tagType));
|
|
3001
3196
|
const uniqueTagTypes = [...new Set(allTagTypes)];
|
|
3002
3197
|
return {
|
|
3003
3198
|
contentType: tpl.kp_content_type,
|
|
@@ -3011,13 +3206,13 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3011
3206
|
const allBlocks = getCachedBlocks(tpl);
|
|
3012
3207
|
return {
|
|
3013
3208
|
contentType: tpl.kp_content_type,
|
|
3014
|
-
blocks:
|
|
3209
|
+
blocks: blockRegistry.getAnnotationEnabledBlocks(allBlocks)
|
|
3015
3210
|
};
|
|
3016
3211
|
});
|
|
3017
3212
|
extractedBlocks.annoRollupBlocks = selectedTpls.map((tpl) => {
|
|
3018
3213
|
const allBlocks = getCachedBlocks(tpl);
|
|
3019
3214
|
const uniqueTagTypes = Array.from(new Set(
|
|
3020
|
-
|
|
3215
|
+
blockRegistry.getAnnotationEnabledBlocks(allBlocks).flatMap((block) => blockRegistry.getTagTypesConfig(block, smTagTypesConfig)).map((conf) => conf.tagType)
|
|
3021
3216
|
));
|
|
3022
3217
|
return {
|
|
3023
3218
|
contentType: tpl.kp_content_type,
|
|
@@ -3664,9 +3859,10 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
3664
3859
|
allTpls,
|
|
3665
3860
|
filterScopes,
|
|
3666
3861
|
isSelfManagedTenant = false,
|
|
3667
|
-
annotationTagsCount
|
|
3862
|
+
annotationTagsCount,
|
|
3863
|
+
smTagTypesConfig
|
|
3668
3864
|
}) => {
|
|
3669
|
-
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls);
|
|
3865
|
+
const extractedBlocks = extractAndOrganizeBlocks(selectedTpls, allTpls, { smTagTypesConfig });
|
|
3670
3866
|
const allAnnoEnabledBlocks = filterScopes.includes("anno") ? extractedBlocks.annoEnabledBlocks.flatMap((item) => item.blocks).reduce((acc, block) => {
|
|
3671
3867
|
if (!acc.find((b) => b.valuePath === block.valuePath)) {
|
|
3672
3868
|
acc.push(block);
|
|
@@ -3788,186 +3984,6 @@ var genCleanCamelCaseId = (id) => {
|
|
|
3788
3984
|
return result.slice(0, MAX_LENGTH);
|
|
3789
3985
|
};
|
|
3790
3986
|
|
|
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
3987
|
// src/node.ts
|
|
3972
3988
|
var import_MongoConnector3 = __toESM(require_MongoConnector());
|
|
3973
3989
|
var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
|
package/dist/universal.d.mts
CHANGED
|
@@ -982,7 +982,9 @@ declare const buildFilterConfigurations: ({ groups, type, selectedTpls, allTpls,
|
|
|
982
982
|
|
|
983
983
|
declare const compareAndGroupBlocks: (blocksPerTpl: any[]) => any[];
|
|
984
984
|
|
|
985
|
-
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[]
|
|
985
|
+
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[], { smTagTypesConfig }?: {
|
|
986
|
+
smTagTypesConfig?: any[] | null;
|
|
987
|
+
}) => any;
|
|
986
988
|
|
|
987
989
|
declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: string[], annoEnabledBlocks?: any[]) => {
|
|
988
990
|
authorTagConfigs: {
|
|
@@ -1228,12 +1230,13 @@ declare const getFilterKeyForBlock: ({ block, scope }?: {
|
|
|
1228
1230
|
* - DEFAULT TENANTS: Dynamically discovers rollups from template structure
|
|
1229
1231
|
* - SELF-MANAGED TENANTS: Uses predefined hierarchy with conditional filters
|
|
1230
1232
|
*/
|
|
1231
|
-
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, }: {
|
|
1233
|
+
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, smTagTypesConfig, }: {
|
|
1232
1234
|
selectedTpls: any[];
|
|
1233
1235
|
allTpls: any[];
|
|
1234
1236
|
filterScopes: string[];
|
|
1235
1237
|
isSelfManagedTenant?: boolean;
|
|
1236
1238
|
annotationTagsCount?: any;
|
|
1239
|
+
smTagTypesConfig?: any[] | null;
|
|
1237
1240
|
}) => ({
|
|
1238
1241
|
sectionId: string;
|
|
1239
1242
|
sectionTitle: string;
|
|
@@ -1620,6 +1623,28 @@ declare class BlockRegistry {
|
|
|
1620
1623
|
comp: string;
|
|
1621
1624
|
props?: any;
|
|
1622
1625
|
}>): any[];
|
|
1626
|
+
/**
|
|
1627
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
1628
|
+
*
|
|
1629
|
+
* Resolution order:
|
|
1630
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
1631
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
1632
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
1633
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
1634
|
+
* Pass null/undefined for non-SM tenants.
|
|
1635
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
1636
|
+
* 3. Empty array.
|
|
1637
|
+
*/
|
|
1638
|
+
getTagTypesConfig(block: {
|
|
1639
|
+
comp: string;
|
|
1640
|
+
props?: any;
|
|
1641
|
+
}, hardCodedTagTypesConfigForSM?: Array<{
|
|
1642
|
+
tagType: string;
|
|
1643
|
+
reactKey?: string;
|
|
1644
|
+
}> | null): Array<{
|
|
1645
|
+
tagType: string;
|
|
1646
|
+
reactKey?: string;
|
|
1647
|
+
}>;
|
|
1623
1648
|
}
|
|
1624
1649
|
/** Singleton instance — the one registry shared across the app. */
|
|
1625
1650
|
declare const blockRegistry: BlockRegistry;
|
package/dist/universal.d.ts
CHANGED
|
@@ -982,7 +982,9 @@ declare const buildFilterConfigurations: ({ groups, type, selectedTpls, allTpls,
|
|
|
982
982
|
|
|
983
983
|
declare const compareAndGroupBlocks: (blocksPerTpl: any[]) => any[];
|
|
984
984
|
|
|
985
|
-
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[]
|
|
985
|
+
declare const extractAndOrganizeBlocks: (selectedTpls: any[], allTpls: any[], { smTagTypesConfig }?: {
|
|
986
|
+
smTagTypesConfig?: any[] | null;
|
|
987
|
+
}) => any;
|
|
986
988
|
|
|
987
989
|
declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: string[], annoEnabledBlocks?: any[]) => {
|
|
988
990
|
authorTagConfigs: {
|
|
@@ -1228,12 +1230,13 @@ declare const getFilterKeyForBlock: ({ block, scope }?: {
|
|
|
1228
1230
|
* - DEFAULT TENANTS: Dynamically discovers rollups from template structure
|
|
1229
1231
|
* - SELF-MANAGED TENANTS: Uses predefined hierarchy with conditional filters
|
|
1230
1232
|
*/
|
|
1231
|
-
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, }: {
|
|
1233
|
+
declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScopes, isSelfManagedTenant, annotationTagsCount, smTagTypesConfig, }: {
|
|
1232
1234
|
selectedTpls: any[];
|
|
1233
1235
|
allTpls: any[];
|
|
1234
1236
|
filterScopes: string[];
|
|
1235
1237
|
isSelfManagedTenant?: boolean;
|
|
1236
1238
|
annotationTagsCount?: any;
|
|
1239
|
+
smTagTypesConfig?: any[] | null;
|
|
1237
1240
|
}) => ({
|
|
1238
1241
|
sectionId: string;
|
|
1239
1242
|
sectionTitle: string;
|
|
@@ -1620,6 +1623,28 @@ declare class BlockRegistry {
|
|
|
1620
1623
|
comp: string;
|
|
1621
1624
|
props?: any;
|
|
1622
1625
|
}>): any[];
|
|
1626
|
+
/**
|
|
1627
|
+
* Resolve the tagTypesConfig for a block instance.
|
|
1628
|
+
*
|
|
1629
|
+
* Resolution order:
|
|
1630
|
+
* 1. `hardCodedTagTypesConfigForSM` — the intended self-managed default, which takes
|
|
1631
|
+
* priority over per-instance values (justifies not persisting per-block on self-managed).
|
|
1632
|
+
* Sourced from `GET_SELF_MANAGED_BASE_CONFIGS().annotation_tagTypesConfig` on BE,
|
|
1633
|
+
* or `platformConfigs.SELF_MANAGED_BASE_CONFIGS.annotation_tagTypesConfig` on FE.
|
|
1634
|
+
* Pass null/undefined for non-SM tenants.
|
|
1635
|
+
* 2. `block.props.annotation.tagTypesConfig` — legacy per-instance persisted value.
|
|
1636
|
+
* 3. Empty array.
|
|
1637
|
+
*/
|
|
1638
|
+
getTagTypesConfig(block: {
|
|
1639
|
+
comp: string;
|
|
1640
|
+
props?: any;
|
|
1641
|
+
}, hardCodedTagTypesConfigForSM?: Array<{
|
|
1642
|
+
tagType: string;
|
|
1643
|
+
reactKey?: string;
|
|
1644
|
+
}> | null): Array<{
|
|
1645
|
+
tagType: string;
|
|
1646
|
+
reactKey?: string;
|
|
1647
|
+
}>;
|
|
1623
1648
|
}
|
|
1624
1649
|
/** Singleton instance — the one registry shared across the app. */
|
|
1625
1650
|
declare const blockRegistry: BlockRegistry;
|